telemetry

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

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

Constants

This section is empty.

Variables

View Source
var Tracer trace.Tracer = otel.Tracer("readproof")

Tracer is used throughout the codebase for all readproof.* spans.

Functions

func RecordCacheResult

func RecordCacheResult(ctx context.Context, hit bool)

func RecordManifestCreated

func RecordManifestCreated(ctx context.Context)

func RecordMaterializationCreated

func RecordMaterializationCreated(ctx context.Context)

func RecordResolve

func RecordResolve(ctx context.Context, uri string, durationSeconds float64, err error)

func RecordRunCommitted

func RecordRunCommitted(ctx context.Context)

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 RecordSnapshotCreated(ctx context.Context)

func RecordSourceFetch

func RecordSourceFetch(ctx context.Context, sourceType string, durationSeconds float64, err error)

func RecordTagResolve

func RecordTagResolve(ctx context.Context)

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

type Shutdown func(context.Context) error

Shutdown flushes and closes any configured exporters. Safe to call even when Init ran in no-op mode.

func Init

func Init(ctx context.Context, serviceName string) (Shutdown, error)

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.

Jump to

Keyboard shortcuts

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