Documentation
¶
Index ¶
- func NewContext(ctx context.Context, t *RequestTrace) context.Context
- func NewSpanContext(ctx context.Context, s *Span) context.Context
- type LLMAttrs
- type MCPAttrs
- type Metadata
- type PluginAttrs
- type RequestTrace
- func (t *RequestTrace) AddAsync()
- func (t *RequestTrace) AddSpan(s *Span) *Span
- func (t *RequestTrace) Done()
- func (t *RequestTrace) End()
- func (t *RequestTrace) EndedAt() time.Time
- func (t *RequestTrace) LLMUsage() *adapter.CanonicalUsage
- func (t *RequestTrace) Metadata() Metadata
- func (t *RequestTrace) ObserveLLMResult(model, finishReason string)
- func (t *RequestTrace) ObserveLLMTurnID(turnID string)
- func (t *RequestTrace) ObserveLLMUsage(u *adapter.CanonicalUsage)
- func (t *RequestTrace) OnComplete(fn func())
- func (t *RequestTrace) PluginTracesEnabled() bool
- func (t *RequestTrace) RequestTracesEnabled() bool
- func (t *RequestTrace) SetConsumer(id, name string)
- func (t *RequestTrace) SetGating(requestTraces, pluginTraces bool)
- func (t *RequestTrace) SetStatusReason(reason string)
- func (t *RequestTrace) Spans() []*Span
- func (t *RequestTrace) StartSpan(spanType SpanType, name string) *Span
- func (t *RequestTrace) StartedAt() time.Time
- func (t *RequestTrace) StatusReason() string
- func (t *RequestTrace) TraceID() string
- type Span
- func (s *Span) End()
- func (s *Span) EndedAt() time.Time
- func (s *Span) Error() string
- func (s *Span) HasDecision() bool
- func (s *Span) LLMAttrsCopy() (LLMAttrs, bool)
- func (s *Span) Latency() time.Duration
- func (s *Span) MCPAttrsCopy() (MCPAttrs, bool)
- func (s *Span) ObserveUsage(u *adapter.CanonicalUsage)
- func (s *Span) PluginAttrsCopy() PluginAttrs
- func (s *Span) SetDecision(decision string)
- func (s *Span) SetError(msg string)
- func (s *Span) SetExtras(extras any)
- func (s *Span) SetLLMResult(model, finishReason string)
- func (s *Span) SetLatency(d time.Duration)
- func (s *Span) SetMCPRequest(method, operation, tool, prompt, resourceURI string)
- func (s *Span) SetMCPStatus(status string, rpcErrorCode int)
- func (s *Span) SetMCPTargets(targets int)
- func (s *Span) SetMCPUpstream(...)
- func (s *Span) SetMode(mode string)
- func (s *Span) SetScore(score float64, label string)
- func (s *Span) SetStage(stage string)
- func (s *Span) SetStatusCode(code int)
- func (s *Span) SetTurnID(turnID string)
- func (s *Span) StatusCode() int
- func (s *Span) Usage() *adapter.CanonicalUsage
- type SpanType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewContext ¶
func NewContext(ctx context.Context, t *RequestTrace) context.Context
Types ¶
type PluginAttrs ¶
type RequestTrace ¶
type RequestTrace struct {
// contains filtered or unexported fields
}
func FromContext ¶
func FromContext(ctx context.Context) *RequestTrace
func New ¶
func New(traceID string, meta Metadata) *RequestTrace
func (*RequestTrace) AddAsync ¶
func (t *RequestTrace) AddAsync()
AddAsync registers asynchronous work (a detached span) that must complete before the trace is published. Pair every AddAsync with a Done.
func (*RequestTrace) AddSpan ¶
func (t *RequestTrace) AddSpan(s *Span) *Span
func (*RequestTrace) Done ¶
func (t *RequestTrace) Done()
Done releases one unit of outstanding work (the request hold or an async span). The last Done fires OnComplete exactly once.
func (*RequestTrace) End ¶
func (t *RequestTrace) End()
func (*RequestTrace) EndedAt ¶
func (t *RequestTrace) EndedAt() time.Time
func (*RequestTrace) LLMUsage ¶
func (t *RequestTrace) LLMUsage() *adapter.CanonicalUsage
func (*RequestTrace) Metadata ¶
func (t *RequestTrace) Metadata() Metadata
func (*RequestTrace) ObserveLLMResult ¶
func (t *RequestTrace) ObserveLLMResult(model, finishReason string)
func (*RequestTrace) ObserveLLMTurnID ¶
func (t *RequestTrace) ObserveLLMTurnID(turnID string)
func (*RequestTrace) ObserveLLMUsage ¶
func (t *RequestTrace) ObserveLLMUsage(u *adapter.CanonicalUsage)
func (*RequestTrace) OnComplete ¶
func (t *RequestTrace) OnComplete(fn func())
OnComplete registers the callback fired once the request and all of its asynchronous spans (e.g. post_response plugins) have finished. It must be set before the request hold is released via Done.
func (*RequestTrace) PluginTracesEnabled ¶
func (t *RequestTrace) PluginTracesEnabled() bool
func (*RequestTrace) RequestTracesEnabled ¶
func (t *RequestTrace) RequestTracesEnabled() bool
func (*RequestTrace) SetConsumer ¶
func (t *RequestTrace) SetConsumer(id, name string)
func (*RequestTrace) SetGating ¶
func (t *RequestTrace) SetGating(requestTraces, pluginTraces bool)
func (*RequestTrace) SetStatusReason ¶
func (t *RequestTrace) SetStatusReason(reason string)
func (*RequestTrace) Spans ¶
func (t *RequestTrace) Spans() []*Span
func (*RequestTrace) StartSpan ¶
func (t *RequestTrace) StartSpan(spanType SpanType, name string) *Span
func (*RequestTrace) StartedAt ¶
func (t *RequestTrace) StartedAt() time.Time
func (*RequestTrace) StatusReason ¶
func (t *RequestTrace) StatusReason() string
func (*RequestTrace) TraceID ¶
func (t *RequestTrace) TraceID() string
type Span ¶
type Span struct {
ID string
ParentID string
Type SpanType
Name string
StartedAt time.Time
LLM *LLMAttrs
Plugin *PluginAttrs
MCP *MCPAttrs
// contains filtered or unexported fields
}
func SpanFromContext ¶
func (*Span) HasDecision ¶
func (*Span) LLMAttrsCopy ¶
func (*Span) MCPAttrsCopy ¶
func (*Span) ObserveUsage ¶
func (s *Span) ObserveUsage(u *adapter.CanonicalUsage)
func (*Span) PluginAttrsCopy ¶
func (s *Span) PluginAttrsCopy() PluginAttrs
func (*Span) SetDecision ¶
func (*Span) SetLLMResult ¶
func (*Span) SetLatency ¶
func (*Span) SetMCPRequest ¶
func (*Span) SetMCPStatus ¶
func (*Span) SetMCPTargets ¶
func (*Span) SetMCPUpstream ¶
func (*Span) SetStatusCode ¶
func (*Span) StatusCode ¶
func (*Span) Usage ¶
func (s *Span) Usage() *adapter.CanonicalUsage
Click to show internal directories.
Click to hide internal directories.