telemetry

package
v0.1.17 Latest Latest
Warning

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

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

Documentation

Overview

Package telemetry configures OpenTelemetry for the sal process and is where the rest of sal starts the spans it records around its long running steps: building and running SAL modules, validating RDF, diffing and loading the Iceberg table, and answering queries.

Nothing is exported unless the environment asks for it with the standard OpenTelemetry variables, so a plain `sal build` pays only for no-op spans. Setting OTEL_EXPORTER_OTLP_ENDPOINT (or a signal specific OTEL_EXPORTER_OTLP_TRACES_ENDPOINT / OTEL_EXPORTER_OTLP_METRICS_ENDPOINT) turns on OTLP export of traces and metrics; OTEL_TRACES_EXPORTER and OTEL_METRICS_EXPORTER pick an exporter explicitly, one of `otlp`, `console` (pretty printed to stderr), or `none`. OTEL_EXPORTER_OTLP_PROTOCOL selects `http/protobuf` (the default) or `grpc`.

Along with the traces sal records itself, the metrics side reports the Go runtime's memory and goroutine figures and the process and system CPU and memory usage, so a slow build can be read against what the machine was doing.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func End

func End(span trace.Span, err error)

End ends a span, recording err as its status when the step it covers failed. It is meant to be deferred with the function's named error result:

ctx, span := telemetry.Start(ctx, "step")
defer func() { telemetry.End(span, err) }()

func Setup

func Setup(ctx context.Context, processors ...SpanProcessor) (func(context.Context) error, error)

Setup installs the OpenTelemetry SDK when the environment configures an exporter, or when the caller gives it a span processor of its own, and returns the function that flushes and stops it, which must run before the process exits or the last spans and metrics are lost. With no exporter configured and no processor, the global providers are left as no-ops and the returned function does nothing.

func Start

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

Start begins a span named name under ctx with the given attributes and returns the context the span's children should be started from.

func Tracer

func Tracer() trace.Tracer

Tracer is the tracer every span sal records comes from. It reads the global provider on each call, so a span started before Setup ran is a no-op and one started after it is exported.

Types

type SpanProcessor

type SpanProcessor = sdktrace.SpanProcessor

SpanProcessor sees every span sal records as it starts and ends. It is how the progress pane of `sal build` follows the build without an exporter.

Jump to

Keyboard shortcuts

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