Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🚀 Feature: Support for trace sampling #2109

Open
1 task done
nitin302 opened this issue Oct 8, 2024 · 11 comments
Open
1 task done

🚀 Feature: Support for trace sampling #2109

nitin302 opened this issue Oct 8, 2024 · 11 comments
Labels
enhancement New feature or request

Comments

@nitin302
Copy link

nitin302 commented Oct 8, 2024

Which component is this feature for?

Traceloop SDK

🔖 Feature description

Traces should have support for setting sampling rate.

🎤 Why is this feature needed ?

Sampling rate helps control the trace volume and improves performance for very high throughput or latency sensitive applications. Also, limiting trace volume helps control cost.

✌️ How do you aim to achieve this?

Similar to https://langfuse.com/docs/tracing-features/sampling or via configuration

🔄️ Additional Information

No response

👀 Have you spent some time to check if this feature request has been raised before?

  • I checked and didn't find similar issue

Are you willing to submit PR?

None

@dosubot dosubot bot added the enhancement New feature or request label Oct 8, 2024
@nirga
Copy link
Member

nirga commented Oct 8, 2024

Thanks @nitin302 - we support it on the Traceloop platform, and this is supported through a standard OpenTelemetry collector, which is the recommended deployment for high-scale applications. Is that what you're looking for?

@nitin302
Copy link
Author

nitin302 commented Oct 8, 2024

do you suggest via these - https://opentelemetry.io/docs/concepts/sampling/#collector

@nirga
Copy link
Member

nirga commented Oct 8, 2024

@nitin302 exactly

@nitin302 nitin302 closed this as completed Oct 8, 2024
@nitin302
Copy link
Author

nitin302 commented Oct 9, 2024

@nirga since we use batching via disable_batch, do you think sampling directly via the library is not required?

@nitin302 nitin302 reopened this Oct 9, 2024
@nirga
Copy link
Member

nirga commented Oct 9, 2024

@nitin302, no you can do it on the collector level and it should work. We can keep this open cause I think supporting this through the SDK itself is valuable - but I'd say there are good ways to do it today even without the SDK itself.

@Nikhil172913832
Copy link

I am interested in contributing to this issue. Can you provide an overview of what has to be done.

@nirga
Copy link
Member

nirga commented Oct 9, 2024

I would look into implementing something similar to otel samplers - https://opentelemetry.io/docs/concepts/sampling/
Potentially this may also be available on the otel SDK itself and we just need to use it

@Nikhil172913832
Copy link

Just to confirm my understanding: In the OpenTelemetry Collector, we configure the sampling rate through the sampling_percentage parameter in the config file. Following @nitin302 's suggestion, I believe the request is to allow for setting the sampling rate directly in the SDK constructor (similar to how Langfuse handles it), rather than relying on external configurations.

@nirga
Copy link
Member

nirga commented Oct 10, 2024

Exactly @Nikhil172913832. And potentially this is a feature already supported by the underlying OpenTelemetry SDK

@Nikhil172913832
Copy link

The approach I thought of is to provide an optional argument in the TracerWrapper class in packages/traceloop-sdk/traceloop/sdk/tracing/tracing.py. If the user provides a value in the constructor, it will be passed into the constructor of the sampling processor. Otherwise, it will fall back to the default behavior and rely on the sampling percentage specified in the config.yaml. Looking forward to you feedback.

@nirga
Copy link
Member

nirga commented Oct 19, 2024

Sounds good @Nikhil172913832 - make sure to propagate it one level up to the traceloop initializer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants