Documentation
¶
Overview ¶
Package observer centralizes the adapter's OpenTelemetry instrumentation: ACP request spans and metrics, prompt-turn GenAI metrics, permission and elicitation dialogs, session store operations, and native process exits.
Index ¶
- func InstrumentationName(vendor string) string
- type Config
- type ElicitationResult
- type Observer
- func (o *Observer) AddActiveSession(ctx context.Context, delta int64)
- func (o *Observer) RecordProcessExit(ctx context.Context, outcome string, err error)
- func (o *Observer) RecordRawMessageEmitFailure(ctx context.Context, err error)
- func (o *Observer) RecordRepublish(ctx context.Context, reason string)
- func (o *Observer) StartACP(ctx context.Context, meta map[string]any, method string, ...) (context.Context, func(error))
- func (o *Observer) StartElicitation(ctx context.Context) (context.Context, func(ElicitationResult))
- func (o *Observer) StartPermission(ctx context.Context, toolName string, mode string) (context.Context, func(PermissionResult))
- func (o *Observer) StartPrompt(ctx context.Context, meta map[string]any, model string) (context.Context, func(PromptResult))
- func (o *Observer) StartSessionStore(ctx context.Context, operation SessionStoreOperation) (context.Context, func(error))
- type PermissionResult
- type PromptResult
- type SessionStoreOperation
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InstrumentationName ¶
InstrumentationName returns a sibling's OpenTelemetry scope.
Types ¶
type Config ¶
type Config struct {
Vendor string
NativeClient string
MeterProvider metric.MeterProvider
Propagator propagation.TextMapPropagator
TracerProvider trace.TracerProvider
Version string
}
Config wires optional OpenTelemetry providers into an Observer.
type ElicitationResult ¶
ElicitationResult finishes one elicitation-request observation.
type Observer ¶
type Observer struct {
// contains filtered or unexported fields
}
Observer records adapter spans and metrics; nil providers degrade to no-ops.
func (*Observer) AddActiveSession ¶
AddActiveSession adjusts the active-session gauge.
func (*Observer) RecordProcessExit ¶
RecordProcessExit counts one native process exit.
func (*Observer) RecordRawMessageEmitFailure ¶
RecordRawMessageEmitFailure counts one raw-event notification failure.
func (*Observer) RecordRepublish ¶ added in v0.1.1
RecordRepublish marks the session store span in ctx with why a mirror commit published the whole generation. An empty reason records nothing.
func (*Observer) StartACP ¶
func (o *Observer) StartACP(ctx context.Context, meta map[string]any, method string, attrs ...attribute.KeyValue) (context.Context, func(error))
StartACP begins one ACP request observation.
func (*Observer) StartElicitation ¶
StartElicitation begins one elicitation-request observation.
func (*Observer) StartPermission ¶
func (o *Observer) StartPermission(ctx context.Context, toolName string, mode string) (context.Context, func(PermissionResult))
StartPermission begins one permission-request observation.
func (*Observer) StartPrompt ¶
func (o *Observer) StartPrompt(ctx context.Context, meta map[string]any, model string) (context.Context, func(PromptResult))
StartPrompt begins one prompt-turn observation.
func (*Observer) StartSessionStore ¶
func (o *Observer) StartSessionStore(ctx context.Context, operation SessionStoreOperation) (context.Context, func(error))
StartSessionStore begins one session store operation observation.
type PermissionResult ¶
PermissionResult finishes one permission-request observation.
type PromptResult ¶
type PromptResult struct {
CachedReadTokens int
CachedWriteTokens int
Err error
Model string
Provider string
InputTokens int
OutputTokens int
StopReason string
TotalTokens int
}
PromptResult finishes one prompt-turn observation.
func PromptResultFrom ¶
func PromptResultFrom(resp acp.PromptResponse, err error, model, provider string) PromptResult
PromptResultFrom records the response usage and resolves a provider from a qualified model when the caller does not supply one.
type SessionStoreOperation ¶
type SessionStoreOperation string
SessionStoreOperation names one observed session store operation.
const ( SessionStoreCommit SessionStoreOperation = "commit" SessionStoreLoad SessionStoreOperation = "load" SessionStoreLoadRecord SessionStoreOperation = "load_record" SessionStoreList SessionStoreOperation = "list" )
The session store operations a sibling observes: a mirror commit, a full load, a configuration-only load, and a listing.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package exporters wires the OTEL_* exporter, propagator, and log-bridge configuration a sibling's command binary hands to its Agent.
|
Package exporters wires the OTEL_* exporter, propagator, and log-bridge configuration a sibling's command binary hands to its Agent. |