Help us shape the future of Go! Take the 2026 Go Developer Survey

telemetry

package
v0.3.69 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 13, 2026 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// IngestVersionV3 is the legacy batch ingestion API (POST /api/public/ingestion).
	IngestVersionV3 = "v3"
	// IngestVersionV4 is the OpenTelemetry-based API (OTLP POST /api/public/otel/v1/traces).
	IngestVersionV4 = "v4"
)

Langfuse ingestion API versions.

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(_ struct{}, _ struct{}) (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 (*Langfuse) BeginTurn

func (l *Langfuse) BeginTurn(ctx context.Context, meta captelemetry.TurnMeta) (context.Context, func(captelemetry.TurnEnd))

func (*Langfuse) Flush

func (l *Langfuse) Flush(ctx context.Context) error

func (*Langfuse) RecordEvent

func (l *Langfuse) RecordEvent(ctx context.Context, name string, attrs map[string]string)

func (*Langfuse) Shutdown

func (l *Langfuse) Shutdown(ctx context.Context) error

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"`
	// IngestVersion selects the Langfuse ingestion API: "v4" (default, OTLP
	// /api/public/otel/v1/traces, for Langfuse server v4) or "v3" (legacy batch
	// /api/public/ingestion, for Langfuse server v3 and earlier).
	IngestVersion string `json:"ingestVersion"`
	// 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. 0 means no limit.
	MaxPayloadBytes int `json:"maxPayloadBytes"`
	// MaxFieldBytes truncates individual message content fields in llm.generation
	// input while keeping JSON valid. Oversized fields end with
	// `\n...[truncated N]` where N is omitted bytes. Omit to default to 8192; set 0 for no limit.
	MaxFieldBytes *int `json:"maxFieldBytes"`
	// DeduplicateGenerationPrefix omits message prefixes identical to the previous
	// llm.generation observation within the same trace.
	DeduplicateGenerationPrefix *bool `json:"deduplicateGenerationPrefix"`
	// RedactInputs scrubs sensitive keys from exported inputs.
	RedactInputs bool `json:"redactInputs"`
	// RedactOutputs scrubs sensitive keys from exported outputs.
	RedactOutputs bool `json:"redactOutputs"`
}

func (*LangfuseConfig) SetDefaults added in v0.3.48

func (c *LangfuseConfig) SetDefaults()

SetDefaults implements pluginkit.Defaulter.

func (*LangfuseConfig) Validate added in v0.3.48

func (c *LangfuseConfig) Validate() error

Validate implements pluginkit.Validator.

type LangfuseDeps

type LangfuseDeps struct {
	Credentials credentials.Store    `json:"credentials"`
	Telemetry   captelemetry.Toolkit `json:"telemetry"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL