Documentation
¶
Index ¶
- func ExtractGRPCContext(ctx context.Context) context.Context
- func ExtractHTTPContext(c *fiber.Ctx) context.Context
- func HandleSpanError(span *trace.Span, message string, err error)
- func InjectGRPCContext(ctx context.Context) context.Context
- func InjectHTTPContext(headers *http.Header, ctx context.Context)
- func SetSpanAttributesFromStruct(span *trace.Span, key string, valueStruct any) error
- type Telemetry
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExtractGRPCContext ¶ added in v1.17.0
ExtractGRPCContext extracts OpenTelemetry trace context from incoming gRPC metadata and injects it into the context. It handles case normalization for W3C trace headers.
func ExtractHTTPContext ¶ added in v1.17.0
ExtractHTTPContext extracts OpenTelemetry trace context from incoming HTTP headers and injects it into the context. It works with Fiber's HTTP context.
func HandleSpanError ¶
HandleSpanError sets the status of the span to error and records the error.
func InjectGRPCContext ¶ added in v1.17.0
InjectGRPCContext injects OpenTelemetry trace context into outgoing gRPC metadata. It normalizes W3C trace headers to lowercase for gRPC compatibility.
func InjectHTTPContext ¶ added in v1.17.0
InjectHTTPContext modifies HTTP headers for trace propagation in outgoing client requests
Types ¶
type Telemetry ¶
type Telemetry struct {
LibraryName string
ServiceName string
ServiceVersion string
DeploymentEnv string
CollectorExporterEndpoint string
TracerProvider *sdktrace.TracerProvider
MetricProvider *sdkmetric.MeterProvider
LoggerProvider *sdklog.LoggerProvider
EnableTelemetry bool
// contains filtered or unexported fields
}
func (*Telemetry) InitializeTelemetry ¶
InitializeTelemetry initializes the telemetry providers and sets them globally. (Logger is being passed as a parameter because it not exists in the global context at this point to be injected)
func (*Telemetry) ShutdownTelemetry ¶
func (tl *Telemetry) ShutdownTelemetry()
ShutdownTelemetry shuts down the telemetry providers and exporters.