exporter

package module
v0.0.0-...-d298684 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 18, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package exporter contains basic exporters for xtel like stdout and otlp.

Index

Examples

Constants

This section is empty.

Variables

View Source
var WithTracesExporterInsecure = &insecure{}

WithTracesExporterInsecure permits connecting to the trace endpoint without a certificate.

Functions

func NewOTLP

func NewOTLP(opts ...Option) xtel.TraceExporterFunc

NewOTLP returns a new exporter and starts it. It configs the new exporter with the given Options.

Example
package main

import (
	"fmt"

	"github.com/gojekfarm/xtools/xtel"
	"github.com/gojekfarm/xtools/xtel/exporter"
)

func main() {
	_, err := xtel.NewProvider("eg-service", exporter.NewOTLP(exporter.WithTracesExporterInsecure))
	if err != nil {
		fmt.Printf("failed exporting traces to exporter: %s\n", err)
	}
}
Output:

func NewPrometheus

func NewPrometheus(opts PrometheusOptions) xtel.MetricReaderFunc

NewPrometheus returns a new prometheus metric.Reader. It configs the new exporter with the given PrometheusOptions.

Example
package main

import (
	"fmt"

	"github.com/gojekfarm/xtools/xtel"
	"github.com/gojekfarm/xtools/xtel/exporter"
)

func main() {
	_, err := xtel.NewProvider("eg-service", exporter.NewPrometheus(exporter.PrometheusOptions{}))
	if err != nil {
		fmt.Printf("failed exporting metrics to prometheus: %s\n", err)
	}
}
Output:

func NewSTDOut

func NewSTDOut(opts STDOutOptions) xtel.TraceExporterFunc

NewSTDOut exports and writes exported tracing telemetry information in JSON for the given STDOutOptions.

Example
package main

import (
	"fmt"

	"github.com/gojekfarm/xtools/xtel"
	"github.com/gojekfarm/xtools/xtel/exporter"
)

func main() {
	_, err := xtel.NewProvider("eg-service", exporter.NewSTDOut(exporter.STDOutOptions{PrettyPrint: true}))
	if err != nil {
		fmt.Printf("failed printing traces to terminal: %s\n", err)
	}
}
Output:

Types

type Mode

type Mode int

Mode is the used to control the export configuration of the otlptrace package exporters.

const (
	// GRPC is the default exporters configurations for the Exporter.
	GRPC Mode = iota
	// HTTP can set as the configuration for the Exporter.
	HTTP
)

type Option

type Option interface {
	// contains filtered or unexported methods
}

Option defines the implementation of the configurations.

func WithTracesExporterEndpoint

func WithTracesExporterEndpoint(url string) Option

WithTracesExporterEndpoint configures the endpoint for sending traces via OTLP.

type PrometheusOptions

type PrometheusOptions struct {
	Registerer pc.Registerer
}

PrometheusOptions handles the configuration of Prometheus exporter.

type STDOutOptions

type STDOutOptions struct {
	PrettyPrint bool
}

STDOutOptions handles the configuration of STDOUT output. It handles the PrettyPrint parameter of the application.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL