pub struct LangfuseConfig {Show 17 fields
pub public_key: String,
pub secret_key: String,
pub base_url: String,
pub timeout: Duration,
pub flush_at: usize,
pub flush_interval: Duration,
pub sample_rate: f64,
pub environment: Option<String>,
pub release: Option<String>,
pub debug: bool,
pub tracing_enabled: bool,
pub mask: Option<Arc<dyn Fn(Value) -> Value + Send + Sync>>,
pub additional_headers: Option<HashMap<String, String>>,
pub max_retries: usize,
pub media_upload_thread_count: usize,
pub io_capture_enabled: bool,
pub should_export_span: Option<Arc<dyn Fn(&SpanData) -> bool + Send + Sync>>,
}Expand description
Configuration for the Langfuse client.
Supports construction via the builder pattern (LangfuseConfig::builder)
or from environment variables (LangfuseConfig::from_env).
Fields§
§public_key: StringLangfuse public key (required).
secret_key: StringLangfuse secret key (required).
base_url: StringLangfuse API base URL. Defaults to https://cloud.langfuse.com.
timeout: DurationHTTP request timeout. Defaults to 5 seconds.
flush_at: usizeNumber of events to buffer before flushing. Defaults to 512.
flush_interval: DurationMaximum interval between flushes. Defaults to 5 seconds.
sample_rate: f64Sampling rate for traces (0.0–1.0). Defaults to 1.0 (100%).
environment: Option<String>Optional environment tag for traces.
release: Option<String>Optional release tag for traces.
debug: boolEnable debug logging. Defaults to false.
tracing_enabled: boolEnable tracing. Defaults to true.
mask: Option<Arc<dyn Fn(Value) -> Value + Send + Sync>>Optional mask function applied to JSON values before storing as span attributes.
additional_headers: Option<HashMap<String, String>>Optional additional HTTP headers sent with every request.
max_retries: usizeMaximum number of retries for HTTP requests. Defaults to 3.
media_upload_thread_count: usizeNumber of threads for media uploads. Defaults to 4.
io_capture_enabled: boolWhether I/O capture is enabled for the observe decorator. Defaults to true.
should_export_span: Option<Arc<dyn Fn(&SpanData) -> bool + Send + Sync>>Optional filter function to decide whether a span should be exported.
Implementations§
Source§impl LangfuseConfig
impl LangfuseConfig
Sourcepub fn builder() -> LangfuseConfigBuilder
pub fn builder() -> LangfuseConfigBuilder
Create a new builder for LangfuseConfig.
Sourcepub fn from_env() -> Result<LangfuseConfig, ConfigError>
pub fn from_env() -> Result<LangfuseConfig, ConfigError>
Build configuration from environment variables.
Required env vars: LANGFUSE_PUBLIC_KEY, LANGFUSE_SECRET_KEY.
Optional: LANGFUSE_BASE_URL, LANGFUSE_TIMEOUT, LANGFUSE_FLUSH_AT,
LANGFUSE_FLUSH_INTERVAL, LANGFUSE_SAMPLE_RATE,
LANGFUSE_TRACING_ENVIRONMENT, LANGFUSE_RELEASE,
LANGFUSE_DEBUG, LANGFUSE_TRACING_ENABLED,
LANGFUSE_MAX_RETRIES, LANGFUSE_MEDIA_UPLOAD_THREAD_COUNT,
LANGFUSE_OBSERVE_DECORATOR_IO_CAPTURE_ENABLED.
Sourcepub fn basic_auth_header(&self) -> String
pub fn basic_auth_header(&self) -> String
Generate the HTTP Basic Auth header value.
Sourcepub fn otel_endpoint(&self) -> String
pub fn otel_endpoint(&self) -> String
Get the OTLP traces endpoint URL.
Sourcepub fn api_base_url(&self) -> String
pub fn api_base_url(&self) -> String
Get the REST API base URL.
Trait Implementations§
Source§impl Clone for LangfuseConfig
impl Clone for LangfuseConfig
Source§fn clone(&self) -> LangfuseConfig
fn clone(&self) -> LangfuseConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more