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

Add WithSampler option #468

Conversation

thomasgouveia
Copy link
Contributor

This PR adds a new built-in sampler to filter traces based on the HTTP request path.

This feature could be handy when deploying into orchestration systems like Kubernetes that produce a trace for each liveness/readiness probe and could lead to higher storage costs.

Fixes #454

@thomasgouveia thomasgouveia requested a review from a team November 6, 2023 15:12
Copy link

linux-foundation-easycla bot commented Nov 6, 2023

CLA Signed

The committers listed above are authorized under a signed CLA.

  • ✅ login: thomasgouveia / name: Thomas Gouveia (803f528)
  • ✅ login: MrAlias / name: Tyler Yahn (81c93b5)

@thomasgouveia thomasgouveia force-pushed the f-454-build-in-sampler-to-filter-traces-with-request-path branch 3 times, most recently from b88895c to bf6e610 Compare November 6, 2023 15:22
Copy link
Contributor

@MrAlias MrAlias left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see this as a scalable way to support custom sampling. It adds a one-off solution for a single sampler.

I would rather be in favor of supporting samplers like the exporter is supported. E.g. an "auto" package in contrib and a generic option here that accepts a sampler interface.

@thomasgouveia
Copy link
Contributor Author

Hi @MrAlias, If I understand correctly, you want to :

LGTM in that case because it allows flexibility and customization for anyone who wants to build a custom auto instrumentation binary.

@MrAlias
Copy link
Contributor

MrAlias commented Nov 6, 2023

+1 to WithSampler.

I think the contrib addition is up for discussion. I think there are a few models for that addition. We would likely want to support environment variables there.

For this though, I think adding a sampler option is a good start. 👍

@thomasgouveia thomasgouveia force-pushed the f-454-build-in-sampler-to-filter-traces-with-request-path branch 2 times, most recently from 2a9e24d to 9b82733 Compare November 6, 2023 16:27
@thomasgouveia
Copy link
Contributor Author

@MrAlias I've just updated the PR with what we discussed. I've also updated the related issue. Let me know if something is missing!

@thomasgouveia thomasgouveia requested a review from MrAlias November 6, 2023 16:30
@thomasgouveia thomasgouveia changed the title Add built-in sampler to filter traces based on HTTP request path Add new Nov 6, 2023
@thomasgouveia thomasgouveia changed the title Add new Add WithSampler option Nov 6, 2023
CHANGELOG.md Outdated Show resolved Hide resolved
instrumentation.go Outdated Show resolved Hide resolved
Add a new `WithSampler` method allowing end-users to provide their own implementation of OpenTelemetry sampler directly through the package API.

Signed-off-by: thomasgouveia <gouveia.thomas@outlook.fr>
@thomasgouveia thomasgouveia force-pushed the f-454-build-in-sampler-to-filter-traces-with-request-path branch from 9b82733 to 803f528 Compare November 6, 2023 17:02
@MrAlias MrAlias merged commit 731fa1e into open-telemetry:main Nov 7, 2023
12 checks passed
@MrAlias MrAlias added this to the v0.8.0-alpha milestone Nov 14, 2023
@MrAlias MrAlias mentioned this pull request Nov 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add new option method WithSampler
3 participants