Documentation
¶
Index ¶
- func NewLangfuse(cfg LangfuseConfig, deps LangfuseDeps) (captelemetry.Exporter, error)
- func NewNone() (captelemetry.Exporter, error)
- type Langfuse
- func (l *Langfuse) BeginObservation(ctx context.Context, meta captelemetry.ObservationMeta) (context.Context, func(captelemetry.ObservationEnd))
- func (l *Langfuse) BeginTurn(ctx context.Context, meta captelemetry.TurnMeta) (context.Context, func(captelemetry.TurnEnd))
- func (l *Langfuse) Flush(ctx context.Context) error
- func (l *Langfuse) RecordEvent(ctx context.Context, name string, attrs map[string]string)
- func (l *Langfuse) Shutdown(ctx context.Context) error
- type LangfuseConfig
- type LangfuseDeps
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewLangfuse ¶
func NewLangfuse(cfg LangfuseConfig, deps LangfuseDeps) (captelemetry.Exporter, error)
NewLangfuse registers telemetry/langfuse: Export traces to Langfuse via the Go SDK ingestion API.
Best practices:
- Point baseUrl at your Langfuse host, e.g. https://cloud.langfuse.com.
- Keep keys in credentials/env via publicKeyRef and secretKeyRef.
- Pair with runner.default and loop.default telemetry deps so shutdown flushes spans.
func NewNone ¶
func NewNone() (captelemetry.Exporter, error)
NewNone registers telemetry/none: No-op telemetry exporter for default builds.
Types ¶
type Langfuse ¶
type Langfuse struct {
// contains filtered or unexported fields
}
func (*Langfuse) BeginObservation ¶
func (l *Langfuse) BeginObservation(ctx context.Context, meta captelemetry.ObservationMeta) (context.Context, func(captelemetry.ObservationEnd))
func (*Langfuse) BeginTurn ¶
func (l *Langfuse) BeginTurn(ctx context.Context, meta captelemetry.TurnMeta) (context.Context, func(captelemetry.TurnEnd))
func (*Langfuse) RecordEvent ¶
type LangfuseConfig ¶
type LangfuseConfig struct {
// BaseURL is the Langfuse host, e.g. https://cloud.langfuse.com.
BaseURL string `json:"baseUrl"`
// PublicKeyRef resolves the Langfuse public key, e.g. env:LANGFUSE_PUBLIC_KEY.
PublicKeyRef string `json:"publicKeyRef"`
// SecretKeyRef resolves the Langfuse secret key, e.g. env:LANGFUSE_SECRET_KEY.
SecretKeyRef string `json:"secretKeyRef"`
// Environment labels traces in Langfuse.
Environment string `json:"environment"`
// Release labels the deploying artifact.
Release string `json:"release"`
// SampleRate in (0,1]; 1 exports every turn.
SampleRate float64 `json:"sampleRate"`
// FlushIntervalSeconds configures the Langfuse SDK batch flush interval.
FlushIntervalSeconds int `json:"flushIntervalSeconds"`
// MaxPayloadBytes truncates exported input/output payloads.
MaxPayloadBytes int `json:"maxPayloadBytes"`
// RedactInputs scrubs sensitive keys from exported inputs.
RedactInputs bool `json:"redactInputs"`
// RedactOutputs scrubs sensitive keys from exported outputs.
RedactOutputs bool `json:"redactOutputs"`
}
type LangfuseDeps ¶
type LangfuseDeps struct {
Credentials credentials.Store `json:"credentials"`
}
Click to show internal directories.
Click to hide internal directories.