You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
All methods are thread-safe. The client maintains context propagation using
102
-
OpenTelemetry's context management, allowing concurrent operations across
103
-
different threads while maintaining correct trace relationships.
88
+
Parameters:
89
+
public_key (Optional[str]): Your Langfuse public API key. Can also be set via LANGFUSE_PUBLIC_KEY environment variable.
90
+
secret_key (Optional[str]): Your Langfuse secret API key. Can also be set via LANGFUSE_SECRET_KEY environment variable.
91
+
host (Optional[str]): The Langfuse API host URL. Defaults to "https://cloud.langfuse.com". Can also be set via LANGFUSE_HOST environment variable.
92
+
timeout (Optional[int]): Timeout in seconds for API requests. Defaults to 30 seconds.
93
+
httpx_client (Optional[httpx.Client]): Custom httpx client for making non-tracing HTTP requests. If not provided, a default client will be created.
94
+
debug (bool): Enable debug logging. Defaults to False. Can also be set via LANGFUSE_DEBUG environment variable.
95
+
tracing_enabled (Optional[bool]): Enable or disable tracing. Defaults to True. Can also be set via LANGFUSE_TRACING_ENABLED environment variable.
96
+
flush_at (Optional[int]): Number of spans to batch before sending to the API. Defaults to 512. Can also be set via LANGFUSE_FLUSH_AT environment variable.
97
+
flush_interval (Optional[float]): Time in seconds between batch flushes. Defaults to 5 seconds. Can also be set via LANGFUSE_FLUSH_INTERVAL environment variable.
98
+
environment (Optional[str]): Environment name for tracing. Default is 'default'. Can also be set via LANGFUSE_TRACING_ENVIRONMENT environment variable. Can be any lowercase alphanumeric string with hyphens and underscores that does not start with 'langfuse'.
99
+
release (Optional[str]): Release version/hash of your application. Used for grouping analytics by release.
100
+
media_upload_thread_count (Optional[int]): Number of background threads for handling media uploads. Defaults to 1. Can also be set via LANGFUSE_MEDIA_UPLOAD_THREAD_COUNT environment variable.
101
+
sample_rate (Optional[float]): Sampling rate for traces (0.0 to 1.0). Defaults to 1.0 (100% of traces are sampled). Can also be set via LANGFUSE_SAMPLE_RATE environment variable.
102
+
mask (Optional[MaskFunction]): Function to mask sensitive data in traces before sending to the API.
f"Security: Span rejected - belongs to project '{span.instrumentation_scope.attributes.get('public_key')}' but processor is for '{self.public_key}'. "
91
+
f"Security: Span rejected - belongs to project '{span.instrumentation_scope.attributes.get('public_key')ifspan.instrumentation_scopeandspan.instrumentation_scope.attributeselseNone}' but processor is for '{self.public_key}'. "
92
92
f"This prevents cross-project data leakage in multi-project environments."
0 commit comments