aws-otel-java-instrumentation icon indicating copy to clipboard operation
aws-otel-java-instrumentation copied to clipboard

Ignore tracing health checks

Open mrewak opened this issue 1 year ago • 3 comments

I'd like to ignore sending traces for health check paths or even all actuator paths. My spring boot app with java instrumentation and deployed as ECS service generates many X-Ray traces unnecessary (at least for me). We are using aws-observability/aws-otel-collector deployed as a central gateway as a ECS service.

Provide config option for the agent to ignore some of the paths or other solution to the issue:

  • ignore health paths in aws-otel-collector (?)
  • ignore health paths on the X-Ray side (?)

I've found https://github.com/open-telemetry/opentelemetry-java-instrumentation/issues/1060 and probably it can be the solution but it is fixed/implemented in the latest opentelemetry java agent but not in aws-otel-java-instrumentation

mrewak avatar Jan 21 '25 08:01 mrewak

You can setup X-Ray remote sampling by following the instruction below, and then create a rule to filter out the traces you don't want to send to X-Ray

  1. Steps to setup remote sampling
    • https://aws-otel.github.io/docs/getting-started/remote-sampling
  2. Steps to setup X-Ray sampling rules to filter traces. In general, create a rule with URL path: <health_check_path> and set both Reservoir and Rate to 0
    • https://docs.aws.amazon.com/xray/latest/devguide/xray-console-sampling.html#xray-console-sampling-examples

mxiamxia avatar Jan 24 '25 18:01 mxiamxia

Thanks, yes, I was considering this but as a last resort as this won't stop sending unnecessary traces from the instrumented service.

mrewak avatar Jan 31 '25 14:01 mrewak

Thanks, yes, I was considering this but as a last resort as this won't stop sending unnecessary traces from the instrumented service.

Since you have aws-otel-collector, you can configure ADOT SDK with OTEL_TRACES_SAMPLER_ARG and OTEL_TRACES_SAMPLER to read from X-Ray remote sampling. The rules are applied to the client side, so it will help in your case I think?

bjrara avatar Mar 06 '25 06:03 bjrara

This issue is stale because it has been open 90 days with no activity. If you want to keep this issue open, please just leave a comment below and auto-close will be canceled

github-actions[bot] avatar Jun 08 '25 20:06 github-actions[bot]

This issue was closed because it has been marked as stale for 30 days with no activity.

github-actions[bot] avatar Jul 13 '25 20:07 github-actions[bot]