otel

package
v0.5.3 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package otel provides OpenTelemetry instrumentation utilities for the registry server.

Index

Constants

View Source
const (
	AttrRegistryName  = attribute.Key("registry.name")
	AttrRegistryType  = attribute.Key("registry.type")
	AttrServerName    = attribute.Key("server.name")
	AttrServerVersion = attribute.Key("server.version")
	AttrPageSize      = attribute.Key("pagination.limit")
	AttrResultCount   = attribute.Key("result.count")
	AttrHasCursor     = attribute.Key("pagination.has_cursor")
)

Common attribute keys for business context used across the application. Using shared keys ensures consistent attribute naming in traces.

Variables

This section is empty.

Functions

func RecordError

func RecordError(span trace.Span, err error)

RecordError records an error on a span and sets the span status to error. It safely handles nil spans and nil errors. Note: The status description is intentionally generic to prevent sensitive information (e.g., SQL queries, connection strings) from appearing in trace status. The full error details are still available via span events for debugging.

func StartSpan

func StartSpan(
	ctx context.Context,
	tracer trace.Tracer,
	name string,
	opts ...trace.SpanStartOption,
) (context.Context, trace.Span)

StartSpan starts a new span if the tracer is non-nil, otherwise returns a no-op span. This provides graceful degradation when tracing is disabled.

Types

This section is empty.

Jump to

Keyboard shortcuts

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