Documentation ¶
Overview ¶
Package traces provides a wrapper around OpenTelemetry to add standard fields to the span.
Index ¶
- func EndError(span trace.Span, err error)
- func EndOK(span trace.Span)
- func GinTracingMiddleware() gin.HandlerFunc
- func Initialize(exporter sdktrace.SpanExporter, ...) (shutdown func(context.Context) error, err error)
- func NewHTTPExporter(ctx context.Context, url string, opts ...otlptracehttp.Option) (exporter sdktrace.SpanExporter, err error)
- func NewNoopExporter() sdktrace.SpanExporter
- func NewSpan(traceCtx context.Context, spanName string, kind trace.SpanKind, ...) (spanCtx context.Context, span trace.Span, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GinTracingMiddleware ¶
func GinTracingMiddleware() gin.HandlerFunc
func Initialize ¶
func Initialize(exporter sdktrace.SpanExporter, ver, apiName, buildDate, commitHash, env string) (shutdown func(context.Context) error, err error)
Initialize initializes the tracing system.
func NewHTTPExporter ¶
func NewHTTPExporter(ctx context.Context, url string, opts ...otlptracehttp.Option) (exporter sdktrace.SpanExporter, err error)
NewHTTPExporter creates a new HTTP exporter.
func NewNoopExporter ¶
func NewNoopExporter() sdktrace.SpanExporter
func NewSpan ¶
func NewSpan(traceCtx context.Context, spanName string, kind trace.SpanKind, attributes ...attribute.KeyValue) (spanCtx context.Context, span trace.Span, err error)
NewSpan starts a new span with using the supplied context. in: ctx: The context. If nil, an error is returned. in: spanName: The name of the span. in: kind: The arg kind is used to set the span kind. The constant trace.SpanKind is defined here: https://pkg.go.dev/go.opentelemetry.io/otel/trace@v1.15. in: attributes: The attributes to add to the span. out: ctx: The context with the span added. out: span: The span. out: err: The error if the context is nil.
Types ¶
This section is empty.