open-telemetry / opentelemetry-cpp-contrib

https://opentelemetry.io/
Apache License 2.0
123 stars 137 forks source link

Add feature to ignore paths, such that no span is created for the specfifc paths matching the regex. #361

Closed aryanishan1001 closed 6 months ago

aryanishan1001 commented 8 months ago

Is your feature request related to a problem? Since spans for some requests might be unwanted, thus this feature is necessary.

Describe the solution you'd like Can be implemented by taking. imput from user about the paths they want to ignore, and not making spans for that call.

toredash commented 8 months ago

Isn't this already present ? https://github.com/open-telemetry/opentelemetry-cpp-contrib/blob/2a0db982f3d7ee91dfbe8150435e49e837bfb7ce/instrumentation/nginx/README.md?plain=1#L218

To ignore spans for common health endpoints:

opentelemetry_ignore_paths (?:livez?|readyz?|health(?:y|z)?|liveness|readiness|metrics|ping)$;
norman-zon commented 6 months ago

@toredash I can't get 'opentelemetry_ignore_paths' to work.

I set opentelemetry_ignore_paths ^/fastly-probe$; in a location snippet, but still spans are created for the path /fastly-probe. Other variations like ^fastly-probe$ , ^/fastly-probe, fastly-probeetc. don't work either.

I am running ingress-nginx controller v0.10.0, which is compiled with --with-pcre-jit.

In the example above you use a proper regex, yet in the tests, a single string is used.

Can you help me out? Do you need further info?

norman-zon commented 6 months ago

Putting opentelemetry_ignore_paths in a http block instead of location fixed it for me

toredash commented 6 months ago

Putting opentelemetry_ignore_paths in a http block instead of location fixed it for me

Thats where I put it as well so figures why it didnt work :)

DebajitDas commented 6 months ago

This is for /instrumentation/otelwebservermodule.

aryanishan1001 commented 6 months ago

Ignore Path feature has been implemented in Otel-webserver-module Nginx