-
Notifications
You must be signed in to change notification settings - Fork 97
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 new option method WithSampler
#454
Comments
I would rather see it as a configuration to HTTP/gRPC instrumentations. |
Hi @pellared, Seems better. In which repository is the code for HTTP/gRPC instrumentation? I'll move the issue to the right repository. |
@thomasgouveia It is here. There is no need to change anything. |
Ok perfect. I have a branch on my local fork with my changes to support the filter on the request path, I can submit a PR for this and we'll see how it should be organized in the PR review if you (or another reviewer) is ok. |
Doing a PR always helps (even if it is not going to be merged it facilities the discussions) 👍 My preference for the env var name would be something like |
I'll do it ASAP.
Do you prefer to use only this variable? What I want to say is by default, we can keep the actual sampler and if |
I think it's a great idea. |
Hello, We need this too on our side and this is a great idea to implement it in the base code. |
Sure, I'll add this before opening the PR |
Another point to consider is https://www.w3.org/TR/trace-context/#trace-flags |
…ath (open-telemetry#454) Add a new built-in sampler to filter out traces with attribute `http.target` matching a given filter. The filter could be provided either using the `WithPathFilter` method or using the environment variable `OTEL_GO_AUTO_HTTP_INSTRUMENTATION_FILTER_PATH`. Signed-off-by: thomasgouveia <gouveia.thomas@outlook.fr>
…ath (open-telemetry#454) Add a new built-in sampler to filter out traces with attribute `http.target` matching a given filter. The filter could be provided either using the `WithPathFilter` method or using the environment variable `OTEL_GO_AUTO_HTTP_INSTRUMENTATION_FILTER_PATH`. Signed-off-by: thomasgouveia <gouveia.thomas@outlook.fr>
…ath (open-telemetry#454) Add a new built-in sampler to filter out traces with attribute `http.target` matching a given filter. The filter could be provided either using the `WithPathFilter` method or using the environment variable `OTEL_GO_AUTO_HTTP_INSTRUMENTATION_FILTER_PATH`. Signed-off-by: thomasgouveia <gouveia.thomas@outlook.fr>
…ath (open-telemetry#454) Add a new built-in sampler to filter out traces with attribute `http.target` matching a given filter. The filter could be provided either using the `WithPathFilter` method or using the environment variable `OTEL_GO_AUTO_HTTP_INSTRUMENTATION_FILTER_PATH`. Signed-off-by: thomasgouveia <gouveia.thomas@outlook.fr>
Add a new built-in sampler to filter out traces with attribute `http.target` matching a given filter. The filter could be provided either using the `WithPathFilter` method or using the environment variable `OTEL_GO_AUTO_HTTP_INSTRUMENTATION_FILTER_PATH`. Signed-off-by: thomasgouveia <gouveia.thomas@outlook.fr>
As stated by @MrAlias in #468, we will not add a custom sampler code directly in this repository, so that the base auto instrumentation remains generic. Instead, I'll add a new option method I'll update the issue title in consequence. |
WithSampler
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>
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>
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>
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> Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
Is your feature request related to a problem? Please describe.
We want to use the
opentelemetry-go-instrumentation
to auto-instrument our Go microservices. To reduce storage costs and provide a better sampling strategy, we want something that allows us to exclude some traces when their request path (e.g./health
) matches a regular expression.This could be very useful in environments like Kubernetes or similar where probes are regularly sent to the app.
Describe the solution you'd like
My first idea was to write a custom Go-specific sampler,
RequestPathSampler
, that takes a simple list of regular expressions as a parameter. For instance, when I configure my auto instrumentation, I would like to have :When configured with the environment variables above, all traces matching the given pattern will be automatically dropped at the instrumentation level.
I dug a little into the code and saw that in
instrumentation.go
, we force the usage of thetrace.AlwaysSample
sampler. Maybe we can update a little this part of the code, in addition to adding theRequestPathSampler
code to have something more modular for the sampler implementation, through a factory for instance.I can make a PR for this proposal if needed.
Describe alternatives you've considered
Currently, I haven't found any viable workaround to drop some traces based on the path. I forked the repository into the company's GitLab to add this feature, but this is not ideal at all because I need to maintain my version of the project in addition to the feature. It would be better to have it included in the upstream repository.
Additional context
Related issues: open-telemetry/opentelemetry-java-instrumentation#1060
The text was updated successfully, but these errors were encountered: