Versions in this module Expand all Collapse all v0 v0.2.0 May 15, 2026 Changes in this version + type LangfuseClient struct + func NewLangfuseClient() *LangfuseClient + func (c *LangfuseClient) Enabled() bool + func (c *LangfuseClient) Flush(ctx context.Context) error + func (c *LangfuseClient) Trace(ctx context.Context, ev TraceEvent) + type TraceEvent struct + EndTime time.Time + ID string + Input string + Metadata map[string]string + Model string + Name string + Output string + StartTime time.Time + Usage *UsageInfo + type UsageInfo struct + CompletionTokens int + CostUSD float64 + PromptTokens int + TotalTokens int v0.1.0 May 12, 2026 Changes in this version + func EndSpanWithError(span *Span, err error) + type OTelProviders struct + func InitOTelSDK(cfg TelemetryConfig) (*OTelProviders, error) + func (p *OTelProviders) FlushOTel(ctx context.Context) error + func (p *OTelProviders) OTelTracer() interface{} + func (p *OTelProviders) RecordMetric(name string, value int64, attrs ...interface{}) + func (p *OTelProviders) ShutdownOTel(ctx context.Context) error + func (p *OTelProviders) StartOTelSpan(ctx context.Context, name string, attrs ...interface{}) (context.Context, interface{}) + type Providers struct + func InitTelemetry(cfg TelemetryConfig) (*Providers, error) + func (p *Providers) Flush(ctx context.Context) error + func (p *Providers) IsEnabled() bool + func (p *Providers) Shutdown(ctx context.Context) error + func (p *Providers) Tracer() *Tracer + type SessionSpan struct + Attributes map[string]string + Children []*SessionSpan + Duration time.Duration + EndTime time.Time + ID string + Name string + ParentID string + StartTime time.Time + Status SpanStatus + type SessionTrace struct + Root *SessionSpan + SessionID string + StartTime time.Time + func NewSessionTrace(sessionID string) *SessionTrace + func (st *SessionTrace) CurrentSpanID() string + func (st *SessionTrace) EndSpan(spanID string, status SpanStatus) + func (st *SessionTrace) FormatTree() string + func (st *SessionTrace) GetSpan(spanID string) *SessionSpan + func (st *SessionTrace) StartSpan(name string, attrs map[string]string) string + func (st *SessionTrace) Summary() TraceSummary + func (st *SessionTrace) ToJSON() ([]byte, error) + type Span struct + EndTime time.Time + Events []SpanEvent + Name string + ParentID string + SpanID string + StartTime time.Time + Tags map[string]string + TraceID string + func SpanFromContext(ctx context.Context) (*Span, bool) + func StartAPICallSpan(ctx context.Context, t *Tracer, provider, model string) (context.Context, *Span) + func StartAgentLoopSpan(ctx context.Context, t *Tracer, provider, model string, messageCount int) (context.Context, *Span) + func StartCompactSpan(ctx context.Context, t *Tracer, strategy string, tokensBefore int) (context.Context, *Span) + func StartSessionSpan(ctx context.Context, t *Tracer, sessionID string) (context.Context, *Span) + func StartToolSpan(ctx context.Context, t *Tracer, toolName, toolID string) (context.Context, *Span) + func (s *Span) AddEvent(name string, tags map[string]string) + func (s *Span) Duration() time.Duration + func (s *Span) Finish() + func (s *Span) SetTag(key, value string) + type SpanEvent struct + Name string + Tags map[string]string + Timestamp time.Time + type SpanStatus int + const SpanError + const SpanOK + func (s *SpanStatus) UnmarshalJSON(data []byte) error + func (s SpanStatus) MarshalJSON() ([]byte, error) + func (s SpanStatus) String() string + type TelemetryConfig struct + Enabled bool + Endpoint string + ExporterProto string + Headers map[string]string + LogsInterval time.Duration + MetricsInterval time.Duration + ServiceName string + ServiceVersion string + ShutdownTimeout time.Duration + TracesInterval time.Duration + func DefaultTelemetryConfig() TelemetryConfig + type TraceSummary struct + Errors int + LLMCalls int + ToolCalls int + TotalCostUSD float64 + TotalDuration time.Duration + TotalTokensIn int + TotalTokensOut int + type Tracer struct + func NewTracer() *Tracer + func (t *Tracer) Clear() + func (t *Tracer) Disable() + func (t *Tracer) Enable() + func (t *Tracer) IsEnabled() bool + func (t *Tracer) Spans() []*Span + func (t *Tracer) StartSpan(ctx context.Context, name string) (context.Context, *Span)