telemetry

package
v0.23.0 Latest Latest
Warning

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

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

Documentation

Overview

Package telemetry installs OpenTelemetry for the anfra CLI and `anfra serve`: the global tracer provider and W3C propagation, which the spans anfra already makes (apptracing's per op, httpkit's per request) go to.

Always on, for the ids it gives each span: log records carry them, so one request's records join across services (docs/designs/logs.md). Exported only when an endpoint is set. Everything is configured by the standard OTEL_* environment variables, which the SDK and its exporter read themselves: OTEL_EXPORTER_OTLP_ENDPOINT (or OTEL_EXPORTER_OTLP_TRACES_ENDPOINT) turns export on, over OTLP/HTTP; OTEL_SERVICE_NAME and OTEL_RESOURCE_ATTRIBUTES label it; and OTEL_SDK_DISABLED=true turns it all off, ids included. Without an endpoint, a span is sampled only when its caller's is, and nothing is exported: each still has its ids, and passes them on (traceparent).

A copy of anfra-cloud's shared/telemetry, trimmed to traces and over HTTP, as anfra-node exports: one collector endpoint serves both.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Setup

func Setup(ctx context.Context, service, version string) (shutdown func(context.Context) error, err error)

Setup installs the tracer provider the environment asks for, and returns the function that flushes and stops it; call it on the way out, with a deadline. On error nothing is installed.

Types

This section is empty.

Jump to

Keyboard shortcuts

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