Documentation
¶
Index ¶
- Variables
- func GetCurrentSpan(ctx context.Context, tracerName string, opts ...trace.TracerOption) trace.Span
- func GetMeter(meterName string, opts ...metric.MeterOption) metric.Meter
- func GetTracer(tracerName string, opts ...trace.TracerOption) trace.Tracer
- func NewSpan(ctx context.Context, traceName string, opts ...trace.SpanStartOption) (context.Context, trace.Span)
- func RecordError(ctx context.Context, err error)
- type OTELConfigs
- type Option
- type TracingIDs
Constants ¶
This section is empty.
Variables ¶
var ( // ErrTraceExporterInitialization is an error that occurs when the traces exporter fails to start. ErrTraceExporterInitialization = errors.New("failed to start traces exporter") )
Functions ¶
func GetCurrentSpan ¶
GetCurrentSpan returns a span instance.
func GetMeter ¶
func GetMeter(meterName string, opts ...metric.MeterOption) metric.Meter
GetMeter returns a meter instance
func GetTracer ¶
func GetTracer(tracerName string, opts ...trace.TracerOption) trace.Tracer
GetTracer returns a tracer instance.
func NewSpan ¶ added in v0.0.13
func NewSpan(ctx context.Context, traceName string, opts ...trace.SpanStartOption) (context.Context, trace.Span)
NewSpan creates and starts a new trace span with the provided context, trace name, and optional span start options.
func RecordError ¶ added in v0.0.48
RecordError records an error in the current span associated with the provided context.
Types ¶
type OTELConfigs ¶
type OTELConfigs struct {
Service struct {
Name string
Version string
Environment string
}
Endpoints struct {
Traces string
Metrics string
Logs string
}
Enabled bool
}
func NewDefaultCfg ¶ added in v0.0.14
func NewDefaultCfg() *OTELConfigs
func (*OTELConfigs) IsEnabled ¶
func (t *OTELConfigs) IsEnabled() bool
type Option ¶
type Option func(*OTELConfigs)
Option defines a telemetry configuration option.
func WithLogsEndpoint ¶ added in v0.0.29
WithLogsEndpoint sets the endpoint for the logs exporter.
func WithMetricEndpoint ¶ added in v0.0.13
WithMetricEndpoint sets the endpoint for the metrics exporter.
func WithOtelEnabled ¶ added in v0.0.13
WithOtelEnabled enables or disables telemetry.
func WithService ¶
WithService sets the service name, version and environment.
func WithTraceEndpoint ¶ added in v0.0.13
WithTraceEndpoint sets the endpoint for the traces exporter.
type TracingIDs ¶ added in v0.0.13
TracingIDs represents the tracing IDs (TraceID and SpanID) associated with a span.
func GetSpanDataFromContext ¶ added in v0.0.13
func GetSpanDataFromContext(ctx context.Context) TracingIDs
GetSpanDataFromContext extracts tracing IDs (TraceID and SpanID) from the given context and returns them as TracingIDs.