telemetry

package
v0.34.0 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2026 License: Apache-2.0 Imports: 6 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package telemetry provides OpenTelemetry integration for GopherAgent via the EventHandler system. It is an optional import: applications that do not need tracing never pay for it.

Wire it at startup:

tp := sdktrace.NewTracerProvider(sdktrace.WithBatcher(exporter))
tracer := tp.Tracer("gopheragent")
loop.OnEvent(telemetry.NewOTelHandler(tracer))

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewOTelHandler

func NewOTelHandler(tracer trace.Tracer) agent.EventHandler

NewOTelHandler returns an agent.EventHandler that instruments every agent iteration with OpenTelemetry tracing.

Span lifecycle per session key:

  • Root span "agent.iteration" is opened lazily on the first event.
  • "tool_call" → span event "tool.execute" with tool name attribute.
  • "action_required" → span event "hitl.action_required".
  • "error" → RecordError + SetStatus(Error) + End.
  • "done" → SetStatus(Ok) + End.

The tracer's parent context is the ctx passed to RunIteration / RunIterationStream, so the agent spans nest correctly inside existing traces.

Types

This section is empty.

Jump to

Keyboard shortcuts

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