otelx

package
v0.4.7 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2024 License: Apache-2.0 Imports: 16 Imported by: 4

Documentation

Overview

Package otelx provides configuration options for various OpenTelemetry integrations.

Index

Constants

View Source
const (
	StdOutProvider   = "stdout"
	OTLPHTTPProvider = "otlphttp"
	OTLPGRPCProvider = "otlpgrpc"
)

Variables

View Source
var (
	ErrUnknownProvider = errors.New("unknown provider")
	ErrInvalidConfig   = errors.New("failed parsing trace config(s)")
)

Functions

func NewTracer

func NewTracer(c Config, name string, logger *zap.SugaredLogger) error

Types

type Config

type Config struct {
	// Enabled to enable tracing
	Enabled bool `json:"enabled" koanf:"enabled" default:"false"`
	// Provider to use for tracing
	Provider string `json:"provider" koanf:"provider" default:"stdout"`
	// Environment to set for the service
	Environment string `json:"environment" koanf:"environment" default:"development"`
	// StdOut settings for the stdout provider
	StdOut StdOut `json:"stdout" koanf:"stdout"`
	// OTLP settings for the otlp provider
	OTLP OTLP `json:"otlp" koanf:"otlp"`
}

Config defines the configuration settings for opentelemetry tracing

type OTLP

type OTLP struct {
	// Endpoint to send the traces to
	Endpoint string `json:"endpoint" koanf:"endpoint" default:"localhost:4317"`
	// Insecure to disable TLS
	Insecure bool `json:"insecure" koanf:"insecure" default:"true"`
	// Certificate to use for TLS
	Certificate string `json:"certificate" koanf:"certificate"`
	// Headers to send with the request
	Headers []string `json:"headers" koanf:"headers"`
	// Compression to use for the request
	Compression string `json:"compression" koanf:"compression"`
	// Timeout for the request
	Timeout time.Duration `json:"timeout" koanf:"timeout" default:"10s"`
}

OTLP settings for the otlp provider

type StdOut

type StdOut struct {
	// Pretty enables pretty printing of the output
	Pretty bool `json:"pretty" koanf:"pretty" default:"true"`
	// DisableTimestamp disables the timestamp in the output
	DisableTimestamp bool `json:"disableTimestamp" koanf:"disableTimestamp" default:"false"`
}

StdOut settings for the stdout provider

Jump to

Keyboard shortcuts

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