Documentation
¶
Overview ¶
Package telemetry reports what AgentExperience does to OpenTelemetry: the spans and metrics that docs/telemetry.md documents for .NET, under the same source and meter names, span names, instruments, dimensions and attributes, for the operations the Go port performs.
The core and the Agent Framework integration only call a small observer hook (agentexperience.SetObserver) and import no OpenTelemetry. This module is the optional adapter: it depends on the OpenTelemetry API only, configures no SDK and no exporter (the host does, as it does for the .NET library), and is enabled with one call:
disable := telemetry.Enable() // uses the global tracer and meter providers the application configured defer disable()
A failure in a provider, an exporter or this adapter is recovered and never reaches the agent. Attributes never carry record content, task text, scopes or error messages; a failing operation records its error's type name only.
Index ¶
Constants ¶
const ( SpanNamePrefix = "agentexperience." OperationCount = "agentexperience.operation.count" OperationDuration = "agentexperience.operation.duration" OperationFailures = "agentexperience.operation.failures" // The metric dimensions. DimensionOperation = "operation" DimensionOutcome = "outcome" DimensionErrorClass = "error.class" DimensionNested = "nested" // The span attributes the adapter writes itself. AttributeOperation = "agentexperience.operation" AttributeOutcome = "agentexperience.outcome" AttributeErrorClass = "agentexperience.error.class" AttributeErrorType = "error.type" )
The names the adapter writes. Tests pin each against docs/telemetry-names.json, which is generated from the .NET definitions.
Variables ¶
This section is empty.
Functions ¶
func Enable ¶
func Enable(options ...Option) (disable func())
Enable registers an observer built from options with the library and returns the function that unregisters it.
func Instruments ¶
func Instruments() [][3]string
Instruments are the three instruments every meter publishes: name, kind and unit.
func SpanAttributes ¶
func SpanAttributes() []string
SpanAttributes is every span attribute the adapter can write.
Types ¶
type Observer ¶
type Observer struct {
// contains filtered or unexported fields
}
Observer is the agentexperience.Observer that reports to OpenTelemetry.
func NewObserver ¶
NewObserver is an observer reporting to the global providers, or to the ones the options name.
type Option ¶
type Option func(*Observer)
Option configures an Observer.
func WithMeterProvider ¶
func WithMeterProvider(mp metric.MeterProvider) Option
WithMeterProvider reports metrics to mp instead of the global meter provider.
func WithTracerProvider ¶
func WithTracerProvider(tp trace.TracerProvider) Option
WithTracerProvider reports spans to tp instead of the global tracer provider.