Documentation
¶
Overview ¶
Package otel implements Surface 3 — OpenTelemetry GenAI export. It emits one span per governed model call carrying the attribute set pinned in api/v1/otel-genai.md (gen_ai.* + riskkernel.*), so a run becomes observable in whatever OTLP backend the user already runs (Grafana Tempo, SigNoz, Jaeger, Honeycomb, Datadog, …).
It is OFF unless the user configures an OTLP endpoint. RiskKernel never emits telemetry on its own — spans go only to the endpoint the user points it at. This is the only package besides internal/provider permitted outbound network.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Call ¶
type Call struct {
RunID string
StepIndex int32
Provider string
Operation string // e.g. "chat"
RequestModel string
ResponseModel string
MaxTokens int
Temperature *float64
PromptTokens int64
OutputTokens int64
CostUSD float64
Priced bool
FinishReason string
ResponseID string
BudgetTokensLimit int64
BudgetTokensRemaining int64
BudgetDollarsLimit float64
BudgetDollarsRemaining float64
HaltReason string // empty if none
Err error // non-nil if the call failed
Start time.Time
End time.Time
}
Call is the data for one governed model-call span.
type Tracer ¶
type Tracer struct {
// contains filtered or unexported fields
}
Tracer emits governed-call spans. The zero value and Disabled() are safe no-ops.
func Disabled ¶
func Disabled() *Tracer
Disabled returns a no-op Tracer (used when no OTLP endpoint is configured and in tests).
func New ¶
New builds a Tracer. If cfg.Endpoint is empty it returns a disabled no-op Tracer (no exporter, no network). Otherwise it wires an OTLP exporter (grpc or http) to the configured endpoint.
func NewWithProcessor ¶
func NewWithProcessor(sp sdktrace.SpanProcessor, serviceName string) *Tracer
NewWithProcessor builds an enabled Tracer around a caller-supplied span processor — useful for custom pipelines and for tests (e.g. an in-memory span recorder).
func (*Tracer) RecordCall ¶
RecordCall emits a span for one governed model call. No-op when disabled.