otel

package
v0.0.34 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2026 License: MIT Imports: 20 Imported by: 0

Documentation

Overview

Package otel provides lightweight OpenTelemetry setup for pi-go, driven entirely by environment variables sourced from ~/.pi-go/.env so secrets never appear in the process environment.

The following env vars are consumed:

OTEL_SERVICE_NAME        defaults to "pi-go"
OTEL_EXPORTER_OTLP_ENDPOINT  collector endpoint (e.g. https://collector:4317)
OTEL_EXPORTER_OTLP_PROTOCOL  "grpc" or "http" (default)
OTEL_TRACES_EXPORTER    "otlp" (default), "console", or "none"

If no exporter is configured, tracing is a no-op (tracer returns no-op spans).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AttributeBool

func AttributeBool(key string, value bool) attribute.KeyValue

AttributeBool returns a bool attribute key-value pair.

func AttributeInt

func AttributeInt(key string, value int) attribute.KeyValue

AttributeInt returns an int attribute key-value pair.

func AttributeString

func AttributeString(key string, value string) attribute.KeyValue

AttributeString returns a string attribute key-value pair.

func IsAvailable added in v0.0.31

func IsAvailable() bool

IsAvailable checks whether the configured OTLP endpoint is reachable. Returns true if the port is open, false otherwise. Returns false if exporter is set to "none" or empty (tracing is inactive anyway).

func IsEnabled

func IsEnabled() bool

IsEnabled returns true when OTEL tracing is active (exporter is set and not "none"/"").

func Shutdown

func Shutdown(ctx context.Context) error

Shutdown flushes and shuts down the global TracerProvider. Call this at program exit.

func Tracer

func Tracer(name string) trace.Tracer

Tracer returns a named tracer for the acp-server package. The underlying TracerProvider is initialized once from the .env source.

Types

This section is empty.

Jump to

Keyboard shortcuts

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