oracle-watchdog

tracing

import "github.com/afreidah/oracle-watchdog/internal/tracing"

Index

Variables

Version of the service for trace metadata. Set at build time via -ldflags “-X github.com/afreidah/oracle-watchdog/internal/tracing.Version=…”

var Version = "dev"

func DurationAttr

func DurationAttr(name string, seconds float64) attribute.KeyValue

DurationAttr creates a duration attribute in seconds.

func ErrorAttr

func ErrorAttr(err error) attribute.KeyValue

ErrorAttr creates an error attribute.

func Init

func Init(ctx context.Context, mode, endpoint string) (func(context.Context) error, error)

Init initializes the OpenTelemetry tracer with the OTLP/HTTP exporter and returns a shutdown function that should be deferred. The endpoint resolves in precedence order: the endpoint argument (from config), then the OTEL_EXPORTER_OTLP_ENDPOINT env var, then defaultOTLPEndpoint. All forms are a bare host:port with no scheme.

func InstanceAttr

func InstanceAttr(id string) attribute.KeyValue

InstanceAttr creates an instance ID attribute.

func NodeAttr

func NodeAttr(name string) attribute.KeyValue

NodeAttr creates a node name attribute.

func PeerServiceAttr

func PeerServiceAttr(name string) attribute.KeyValue

PeerServiceAttr creates a peer.service attribute for service graph edges.

func ServerAddressAttr

func ServerAddressAttr(addr string) attribute.KeyValue

ServerAddressAttr creates a server.address attribute.

func StartClientSpan

func StartClientSpan(ctx context.Context, name string, attrs ...attribute.KeyValue) (context.Context, trace.Span)

StartClientSpan creates a span with SpanKindClient for outbound service calls. Client spans are required for Tempo’s service graph to detect service-to-service edges.

func StartSpan

func StartSpan(ctx context.Context, name string, attrs ...attribute.KeyValue) (context.Context, trace.Span)

StartSpan starts a new span with the given name and returns context + span.

func StateAttr

func StateAttr(state string) attribute.KeyValue

StateAttr creates a lifecycle state attribute.

func StatusAttr

func StatusAttr(status string) attribute.KeyValue

StatusAttr creates a status attribute (alive, missing, restarting).

func Tracer

func Tracer() trace.Tracer

Tracer returns the global tracer instance.

Generated by gomarkdoc