otel

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package otel adapts the core hook.Hooks callbacks to OpenTelemetry spans and attributes. It is the only place that imports the otel packages; core stays free of any observability backend. Initialize a tracer provider in main for spans to be exported; with no provider, otel uses a no-op tracer.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewHooks

func NewHooks() *hook.Hooks

NewHooks returns hook.Hooks that emit OpenTelemetry spans for tool calls and record errors and gate/authorize decisions as span attributes. It uses the global tracer provider; initialize one (e.g. an OTLP exporter) in main for spans to be exported. Without a provider, otel uses a no-op tracer.

func Setup added in v0.1.6

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

Setup initializes the global TracerProvider from the standard OTLP environment variables so the spans emitted by NewHooks are actually exported. When neither OTEL_EXPORTER_OTLP_ENDPOINT nor OTEL_EXPORTER_OTLP_TRACES_ENDPOINT is set, it leaves the no-op global provider untouched and returns a no-op shutdown. The exporter speaks OTLP over HTTP/protobuf; endpoint, headers, and TLS come from the standard OTEL_EXPORTER_OTLP_* variables read by the exporter itself.

Types

This section is empty.

Jump to

Keyboard shortcuts

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