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 ¶
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 ¶
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.
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.