otel

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package otel provides otel support.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddSpan

func AddSpan(ctx context.Context, spanName string, keyValues ...attribute.KeyValue) (context.Context, trace.Span)

AddSpan adds an otel span to the existing trace.

func AddTraceToRequest

func AddTraceToRequest(ctx context.Context, r *http.Request)

AddTraceToRequest adds the current trace id to the request so it can be delivered to the service being called.

func GetTraceID

func GetTraceID(ctx context.Context) string

GetTraceID returns the trace id from the context.

func InitTracing

func InitTracing(log *logger.Logger, cfg Config) (trace.TracerProvider, func(ctx context.Context), error)

InitTracing configures open telemetry to be used with the service.

func InjectTracing

func InjectTracing(ctx context.Context, tracer trace.Tracer) context.Context

InjectTracing initializes the request for tracing by writing otel related information into the response and saving the tracer and trace id in the context for later use.

Types

type Config

type Config struct {
	ServiceName    string
	Host           string
	ExcludedRoutes map[string]struct{}
	Probability    float64
}

Config defines the information needed to init tracing.

Jump to

Keyboard shortcuts

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