-
Notifications
You must be signed in to change notification settings - Fork 872
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
Enable HttpServer / HttpClient instrumentation to exclude query strings #2302
Comments
I think this is a very sensible request. My only concern is that if we bring in a configuration for removing query string, then why not fragment and/or path as well? :) Just having one configuration option seems random, having all of them seems like explosion. We have to find some balance... |
We could have a config that states which parts of the url to keep. Something like
|
I think the original ask makes a lot of sense (although sensitive data in query strings and paths should probably be sternly discouraged)...but I'm not sure it makes sense to provide a la carte choosing of url components. In fact, it makes it easy to break url syntax this way. I'll offer up a balance as @iNikem suggested:
What do you think? |
this proposal sounds reasonable, I might extend it to include the ability to redact so in your example it would be |
cc: @johnbley who has been thinking about this open-telemetry/oteps#100 |
I say if we're going to bother with this, let's go all-out and have a class MyFilter implements SpanFilter {
public void filter(Span s) {
String url =s.getAttribute("http.url");
if (url != null) {
s.setAttribute(redact(url));
} } }
tracerProvider.addFilter(new MyFilter()); We can grow a declarative layer on top of this if desired, akin to ideas proposed above, but my view is that app authors/owners will always come up with something new/unpredicated and there needs to be a safety valve we can point them to. NB I did something similar with |
I agree that a general purpose mechanism would be even better. If |
Is it possible to inject a SpanProcessor into the agent from the application jar? I tried to use |
It also appears that the java SpanProcessor enforces that attributes cannot be set after a span has ended. So the SpanProcessor approach does not work at the moment. |
hey @ben-childs-docusign, this can be accomplished by implementing a delegating SpanExporter which "decorates" the SpanData before passing it on to the underlying SpanExporter, check out https://github.com/open-telemetry/opentelemetry-java/blob/4a945e63e3bd1d309ba189dcd3c6c7a0b5db535c/sdk-extensions/tracing-incubator/src/main/java/io/opentelemetry/sdk/extension/incubator/trace/data/DelegatingSpanData.java#L22-L48 and check out the new extension mechanism that makes extending the javaagent with custom SpanExporter much easier now: https://github.com/open-telemetry/opentelemetry-java-instrumentation/tree/main/examples/extension#introduction |
linking to @mateuszrzeszutek's response #5680 (comment) |
Closing based on #2302 (comment) |
Is your feature request related to a problem? Please describe.
We would like to exclude query strings from http client and http server spans from our traces in order to avoid logging sensitive information to our tracing infrastructure.
Describe the solution you'd like
Ideally there would be some ability to configure which parts of the URL should be included in these spans, for our purposes we would just like the scheme, host and path.
Describe alternatives you've considered
We could write custom code to instrument our services or build a custom version of the instrumentation library but I think this would be a generally useful feature.
Additional context
This is the current code in HttpServerTracer for setting the url attribute:
If it is possible to access configuration here we could parse the url and scrub the sections as defined in configuration.
The text was updated successfully, but these errors were encountered: