Feature Request: Tracing Sampling Rate Configuration for Langfuse #2104
himansrivastava
started this conversation in
Ideas
Replies: 1 comment 1 reply
-
Thanks for raising this, totally agree that this would be extremely useful. Thoughts
Option 1: Sampling with random number -> complex as it needs to be implemented one-by-one for the different integrations
Option 2: Sampling by applying a function to the trace_id -> stateless
Example implementation import random
def deterministic_sample(trace_id, sample_rate):
random.seed(42) # Fixed seed for reproducibility
hash_value = hash(uuid)
normalized_hash = (hash_value & 0xFFFFFFFF) / 2**32 # Normalize to [0, 1)
return normalized_hash < sample_rate I think the first implementation is difficult to maintain and might introduce a lot of memory leakage problems when run at scale. The second would be much easier to implement. What do you think? |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Describe the feature or potential improvement
Description
I would like to request the addition of a tracing sampling rate configuration option to Langfuse. This feature would allow users to set a specific sampling rate for tracing, enabling more efficient and manageable logging practices.
Benefits
Improved Performance: By allowing users to set a sampling rate, Langfuse can reduce the volume of traces collected, which can significantly improve application performance and reduce overhead. This is particularly beneficial in high-throughput environments where tracing every single request can be resource-intensive.
Cost Efficiency: Reducing the number of traces collected can lead to substantial cost savings, especially when using cloud-based service that charge based on data volume. Users can achieve better cost management without compromising on critical insights.
Enhanced Focus on Critical Data: Sampling allows users to focus on the most relevant traces, making it easier to identify and troubleshoot issues. This targeted approach can improve the efficiency of debugging and monitoring activities.
Scalability: As applications grow in complexity and user base, the ability to control the tracing rate becomes essential. This feature will support the scalability of Langfuse, ensuring it remains effective and manageable at larger scales.
User Flexibility: Providing a configurable sampling rate empowers users to customize their tracing strategy according to their specific needs and constraints. Different applications and environments have varying requirements, and this flexibility ensures broader applicability and user satisfaction.
Proposed Implementation
TRACING_SAMPLING_RATE
).I believe this feature will greatly enhance the utility and performance of Langfuse and look forward to its consideration.
Additional information
No response
Beta Was this translation helpful? Give feedback.
All reactions