Documentation
¶
Overview ¶
Package telemetry is the single seam between bones command code and any OpenTelemetry tracer. Default builds (no -tags=otel) get a zero-cost no-op; `go build -tags=otel` swaps in the real OTel-backed implementation.
This file holds the build-tag-free types every caller speaks: Attr (a typed key/value pair built via String/Int/Bool) and EndFunc (the deferred cleanup returned by RecordCommand). The two RecordCommand implementations live in telemetry_default.go and telemetry_otel.go respectively.
Both implementations live in this package so the OTel branch can read Attr's unexported fields directly without exposing them to callers.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Attr ¶
type Attr struct {
// contains filtered or unexported fields
}
Attr is a typed key/value pair attached to a recorded command. Construct values via String, Int, or Bool — the zero value is intentionally useless so unsupported types fail at the constructor rather than silently flowing into the OTel branch.
type EndFunc ¶
type EndFunc func(err error)
EndFunc finalizes a span started by RecordCommand. Pass the operation's terminal error (or nil on success); the OTel branch records the error and closes the span. Always call exactly once — typically via `defer end(err)` against a named-return `err`.
func RecordCommand ¶
RecordCommand is the no-op default. With -tags=otel the implementation in telemetry_otel.go takes over and starts a real span. Returning the same ctx (rather than a derived child) keeps the no-op observably equivalent to "no instrumentation present at all."