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

Cannot setup custom sampling with micrometer-tracing-bridge-brave #950

Open
sandra-markerud opened this issue Jan 27, 2025 · 0 comments
Open

Comments

@sandra-markerud
Copy link

Hello,

I am using micrometer tracing for enabling tracing in my spring boot (cloud) application.
Tracing and sampling to zipkin works as expected.
However, now I need to make some custom sampling decisions based on paths, header values or jwt claims from the bearer token within the 'Authorization' header.

Something like:

  • never sample requests to '/actuator' endpoints
  • never sample requests to some specific endpoints within the application like '/anonymous'
  • always sample requests with header 'foo' having value 'bar'
  • fallback to configured percentage sampling for everything else

After some research I found that brave seems to offer possibilities to do so:
Brave: https://github.com/openzipkin/brave/blob/master/brave/README.md#custom-sampling

However, I don't seem to be able to wire it correctly within the micrometer setup.

I am aware of the possibility of using 'ObservationPredicate' e.g. for not observing specific paths, but that doesn't cover my needs.
I don'T want/need to manipulate the observation as such but only customize the sampling decisions.

My micrometer-tracing-bridge-brave example:
https://github.com/sandra-markerud/spring-demos/tree/feature/custom-sampling-brave

The SamplingConfiguration tries to setup a HttpTracing that respects the custom rules for sampling. However, the HttpTracing bean is not used, only the Tracing bean instead.

Any help is appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants