telemetry

package
v1.17.0 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2026 License: MIT Imports: 39 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CodeUnset = codes.Unset
	CodeError = codes.Error
	CodeOk    = codes.Ok
)

Span status codes.

View Source
const (
	SpanKindUnspecified = trace.SpanKindUnspecified
	SpanKindInternal    = trace.SpanKindInternal
	SpanKindServer      = trace.SpanKindServer
	SpanKindClient      = trace.SpanKindClient
	SpanKindProducer    = trace.SpanKindProducer
	SpanKindConsumer    = trace.SpanKindConsumer
)

SpanKind constants.

Variables

View Source
var (
	Bool         = attribute.Bool
	BoolSlice    = attribute.BoolSlice
	Float64      = attribute.Float64
	Float64Slice = attribute.Float64Slice
	Int          = attribute.Int
	Int64        = attribute.Int64
	Int64Slice   = attribute.Int64Slice
	IntSlice     = attribute.IntSlice
	String       = attribute.String
	StringSlice  = attribute.StringSlice
	Stringer     = attribute.Stringer
)

Attribute functions for creating span attributes.

View Source
var (
	WithAttributes = trace.WithAttributes
	WithLinks      = trace.WithLinks
	WithSpanKind   = trace.WithSpanKind
	WithTimestamp  = trace.WithTimestamp
)

Span start options.

View Source
var (
	PropagationHeaderCarrier = func(h http.Header) propagation.HeaderCarrier {
		return propagation.HeaderCarrier(h)
	}
	PropagationMapCarrier = func(m map[string]string) propagation.MapCarrier {
		return propagation.MapCarrier(m)
	}
)

Propagation carriers for context propagation.

View Source
var (
	TelemetryFacade telemetry.Telemetry
	ConfigFacade    config.Config
)

Functions

This section is empty.

Types

type Application

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

func NewApplication

func NewApplication(cfg Config) (*Application, error)

func (*Application) Logger

func (r *Application) Logger(name string, opts ...otellog.LoggerOption) otellog.Logger

func (*Application) Meter

func (r *Application) Meter(name string, opts ...otelmetric.MeterOption) otelmetric.Meter

func (*Application) MeterProvider

func (r *Application) MeterProvider() otelmetric.MeterProvider

func (*Application) Propagator

func (r *Application) Propagator() propagation.TextMapPropagator

func (*Application) Shutdown

func (r *Application) Shutdown(ctx context.Context) error

func (*Application) Tracer

func (r *Application) Tracer(name string, opts ...oteltrace.TracerOption) oteltrace.Tracer

func (*Application) TracerProvider

func (r *Application) TracerProvider() oteltrace.TracerProvider

type Config

type Config struct {
	Resource    map[string]string
	Service     ServiceConfig
	Propagators string
	Logs        LogsConfig
	Metrics     MetricsConfig
	Traces      TracesConfig
	Exporters   map[string]ExporterEntry
}

func (Config) GetExporter

func (c Config) GetExporter(name string) (ExporterEntry, bool)

type ExporterDriver

type ExporterDriver string
const (
	LogExporterDriverCustom  ExporterDriver = "custom"
	LogExporterDriverOTLP    ExporterDriver = "otlp"
	LogExporterDriverConsole ExporterDriver = "console"
)
const (
	MetricsExporterDriverCustom  ExporterDriver = "custom"
	MetricsExporterDriverOTLP    ExporterDriver = "otlp"
	MetricsExporterDriverConsole ExporterDriver = "console"
)
const (
	TraceExporterDriverCustom  ExporterDriver = "custom"
	TraceExporterDriverOTLP    ExporterDriver = "otlp"
	TraceExporterDriverZipkin  ExporterDriver = "zipkin"
	TraceExporterDriverConsole ExporterDriver = "console"
)

type ExporterEntry

type ExporterEntry struct {
	Driver   ExporterDriver
	Endpoint string
	Insecure bool
	Timeout  time.Duration

	// OTLP-specific
	Protocol Protocol
	Headers  map[string]string

	// Metric Specific
	MetricTemporality MetricTemporality `json:"metric_temporality"`

	// Console Driver Specific
	PrettyPrint bool `json:"pretty_print"`

	// For custom Exporter
	Via any
}

type KeyValue

type KeyValue = attribute.KeyValue

type LogsConfig

type LogsConfig struct {
	Exporter  string
	Processor LogsProcessorConfig
}

type LogsProcessorConfig

type LogsProcessorConfig struct {
	Interval time.Duration
	Timeout  time.Duration
}

type MetricTemporality

type MetricTemporality string
const (
	TemporalityCumulative MetricTemporality = "cumulative"
	TemporalityDelta      MetricTemporality = "delta"
)

type MetricsConfig

type MetricsConfig struct {
	Exporter string
	Reader   MetricsReaderConfig
}

type MetricsReaderConfig

type MetricsReaderConfig struct {
	Interval time.Duration
	Timeout  time.Duration
}

type Protocol

type Protocol string
const (
	ProtocolGRPC         Protocol = "grpc"
	ProtocolHTTPProtobuf Protocol = "http/protobuf"
	ProtocolHTTPJSON     Protocol = "http/json"
)

type SamplerConfig

type SamplerConfig struct {
	Type   string
	Ratio  float64
	Parent bool
}

type ServiceConfig

type ServiceConfig struct {
	Name        string
	Version     string
	Environment string
}

type ServiceProvider

type ServiceProvider struct {
}

func (*ServiceProvider) Boot

func (r *ServiceProvider) Boot(app foundation.Application)

func (*ServiceProvider) Register

func (r *ServiceProvider) Register(app foundation.Application)

func (*ServiceProvider) Relationship

func (r *ServiceProvider) Relationship() binding.Relationship

type ShutdownFunc

type ShutdownFunc = func(context.Context) error

func NewMeterProvider

func NewMeterProvider(ctx context.Context, cfg Config, opts ...sdkmetric.Option) (metric.MeterProvider, ShutdownFunc, error)

func NoopShutdown

func NoopShutdown() ShutdownFunc

NoopShutdown returns a ShutdownFunc that does nothing and returns nil.

type TracesConfig

type TracesConfig struct {
	Exporter string
	Sampler  SamplerConfig
}

Directories

Path Synopsis
instrumentation
log

Jump to

Keyboard shortcuts

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