observability

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

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

Go to latest
Published: Apr 30, 2024 License: MPL-2.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitMetricsProvider

func InitMetricsProvider(logger zerolog.Logger, addr string, credentials *credentials.TransportCredentials, collectionInterval time.Duration, opts ...metric.Option) (func(), error)

Initializes an OTLP exporter, and configures the corresponding trace and metric providers.

NOTE: this temporarily returns a metric.MeterProvider while opentelemetry-go reworks the metrics API upstream to support globals. This will be updated in tandem when https://github.com/open-telemetry/opentelemetry-go/pull/2587 is deployed.

func InitTraceProvider

func InitTraceProvider(logger zerolog.Logger, serviceName string, addr string, creds *credentials.TransportCredentials, pyroscopeConfig PyroscopeConfig, opts ...sdktrace.TracerProviderOption) (func(), error)

Initializes an OTLP exporter, and configures the corresponding trace and metric providers.

func LoadKeyPair

func LoadKeyPair(ca_path, cert_path, key_path string) (*credentials.TransportCredentials, error)

func WithDefaultMetricOpts

func WithDefaultMetricOpts(serviceName string) []metric.Option

func WithDefaultResource

func WithDefaultResource(ctx context.Context, serviceName string) (*resource.Resource, error)

func WithDefaultResourceOpts

func WithDefaultResourceOpts() []resource.Option

func WithDefaultTracingOpts

func WithDefaultTracingOpts(serviceName string) []sdktrace.TracerProviderOption

func WithNomad

func WithNomad() resource.Option

WithHost adds attributes from the host to the configured resource.

Types

type Option

type Option func(*TelemetryOptions) error

func MetricOptions

func MetricOptions(metricOptions ...metric.Option) Option

func Resource

func Resource(resource resource.Resource) Option

func TracingOptions

func TracingOptions(tracingOptions ...sdktrace.TracerProviderOption) Option

type PyroscopeConfig

type PyroscopeConfig struct {
	URL   string `toml:"url"`
	Token string `toml:"token"`
	User  string `toml:"user"`
	// contains filtered or unexported fields
}

func (*PyroscopeConfig) Start

func (c *PyroscopeConfig) Start(ctx context.Context, serviceName string) error

func (*PyroscopeConfig) Stop

func (c *PyroscopeConfig) Stop() error

type PyroscopeLogger

type PyroscopeLogger struct {
	// contains filtered or unexported fields
}

func (*PyroscopeLogger) Debugf

func (l *PyroscopeLogger) Debugf(a string, b ...interface{})

func (*PyroscopeLogger) Errorf

func (l *PyroscopeLogger) Errorf(a string, b ...interface{})

func (*PyroscopeLogger) Infof

func (l *PyroscopeLogger) Infof(a string, b ...interface{})

type TelemetryConfig

type TelemetryConfig struct {
	OTLPAddr     string `toml:"addr"`
	OTLPCAPath   string `toml:"ca_path"`
	OTLPCertPath string `toml:"cert_path"`
	OTLPKeyPath  string `toml:"key_path"`
	Insecure     bool   `toml:"insecure"`

	ServiceName string `toml:"service_name"`

	MetricsCollectionInterval time.Duration `toml:"metrics_collection_interval"`

	Pyroscope PyroscopeConfig `toml:"pyroscope"`
	// contains filtered or unexported fields
}

func (*TelemetryConfig) InitializeTelemetry

func (t *TelemetryConfig) InitializeTelemetry(ctx context.Context, serviceName string, logger zerolog.Logger, options ...Option) error

Initialize Metrics + Tracing for the app. NOTE: you must call defer t.Stop() to propely cleanup

func (*TelemetryConfig) Merge

func (t *TelemetryConfig) Merge(o *TelemetryConfig) error

func (*TelemetryConfig) RegisterFlags

func (t *TelemetryConfig) RegisterFlags(f *flag.FlagSet)

func (*TelemetryConfig) Shutdown

func (t *TelemetryConfig) Shutdown(ctx context.Context, logger zerolog.Logger) error

func (*TelemetryConfig) Validate

func (t *TelemetryConfig) Validate() error

type TelemetryOptions

type TelemetryOptions struct {
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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