Documentation
¶
Overview ¶
Package telemetry wires OpenTelemetry tracing and metrics for readproof/readproofd.
otel.Tracer/otel.Meter return delegating implementations: code that grabs a Tracer/Meter at package-init time (before Init runs) still starts exporting correctly once Init installs the real providers. When OTEL_EXPORTER_OTLP_ENDPOINT is unset, Init is a no-op and every call throughout the codebase is a safe no-op too — instrumentation never requires a collector to be running.
Index ¶
- Variables
- func RecordCacheResult(ctx context.Context, hit bool)
- func RecordManifestCreated(ctx context.Context)
- func RecordMaterializationCreated(ctx context.Context)
- func RecordResolve(ctx context.Context, uri string, durationSeconds float64, err error)
- func RecordRunCommitted(ctx context.Context)
- func RecordSnapshotCreated(ctx context.Context)
- func RecordSourceFetch(ctx context.Context, sourceType string, durationSeconds float64, err error)
- func RecordTagResolve(ctx context.Context)
- func SetTracerProvider(tp trace.TracerProvider) (restore func())
- type Shutdown
Constants ¶
This section is empty.
Variables ¶
var Tracer trace.Tracer = otel.Tracer("readproof")
Tracer is used throughout the codebase for all readproof.* spans.
Functions ¶
func RecordCacheResult ¶
func RecordManifestCreated ¶
func RecordResolve ¶
func RecordRunCommitted ¶
RecordRunCommitted counts one run reaching a committed manifest. Run ids are caller-supplied and unbounded, so they stay off the metric and live only on the readproof.run.commit span, where cardinality is not a cost.
func RecordSnapshotCreated ¶
func RecordSourceFetch ¶
func RecordTagResolve ¶
RecordTagResolve counts one resolve served from a tag ref. The tag name is deliberately not a label: tags are user-named and unbounded, and the per-tag breakdown belongs in traces.
func SetTracerProvider ¶
func SetTracerProvider(tp trace.TracerProvider) (restore func())
SetTracerProvider points Tracer at tp and returns a function restoring the previous Tracer. It is the supported way for a test to capture readproof.* spans with an in-memory exporter without going through Init (which requires an OTLP endpoint and would export off-box). Init is unaffected: production wiring still runs through it, and the no-op default stands until one of the two is called.
Types ¶
type Shutdown ¶
Shutdown flushes and closes any configured exporters. Safe to call even when Init ran in no-op mode.
func Init ¶
Init configures the global TracerProvider/MeterProvider from the standard OTEL_EXPORTER_OTLP_ENDPOINT (and related OTEL_EXPORTER_OTLP_*) environment variables, which the otlptracehttp/otlpmetrichttp exporters read automatically. If none is set, Init does nothing and returns a no-op Shutdown — every otel.Tracer/otel.Meter call elsewhere remains a safe no-op.