sentry-java icon indicating copy to clipboard operation
sentry-java copied to clipboard

Option / documentation to filter out sentry internal transactions from default Opentelemetry export

Open ivan-klass opened this issue 1 year ago • 3 comments

Problem Statement

When using sentry-opentelemetry-agent while intentionaly keeping the main (otlp) exporter, in my traces panel I see a lot of internal sentry requests performed multiple times per second. I would prefer a simple way to disable it, especially when it's not SENTRY_DEBUG.

Screenshot 2024-06-20 at 11 08 07

I've tried sentry-opentelemetry-agentcustomization but it kind of lacks documentation:

  • adding it as a runtime dependency doesn't seem to change the behavior
  • adding it as yet another java agent doesn't work:
Error occurred during initialization of VM
agent library failed Agent_OnLoad: instrument
Failed to find Premain-Class manifest attribute in /opt/docker/bin/../sentry-opentelemetry-agentcustomization/sentry-opentelemetry-agentcustomization-8.0.0-alpha.1.jar

Solution Brainstorm

Add a boolean property and env var like sentry.internal.otel-export andSENTRY_INTERNAL_OTEL_EXPORT

ivan-klass avatar Jun 20 '24 09:06 ivan-klass

Thanks for opening this issue @ivan-klass, we're currently in the process of reworking our OpenTelemetry Agent. I think it should be enough to simply use SamplingDecision.DROP in OpenTelemetry Sampler when we detect an internal Sentry span. Would you agree?

adinauer avatar Jun 24 '24 05:06 adinauer

@adinauer thanks! Sounds good. Waiting for the next 8.x.x jar (8.0.0-alpha.2 ?) so I can verify

ivan-klass avatar Jun 26 '24 10:06 ivan-klass

Hey @ivan-klass, we've just released 8.0.0-alpha.2 of the Java SDK, there's instructions how to upgrade in the changelog. If you decide to give it a try, any feedback is welcome 🙏 .

adinauer avatar Jun 26 '24 16:06 adinauer

@adinauer Hi! Thanks! Just checked the new JAR an here's what I see:

If I don't touch OTEL_LOGS_EXPORTER, I now see warnings like

 WARN io.opentelemetry.exporter.internal.grpc.GrpcExporter - Failed to export logs. Server responded with gRPC status code 2

But if I set OTEL_LOGS_EXPORTER=none It seems like Sentry traces become broken - it has only the outer span and expanding them says there's nothing more

Empty — Transaction did not report any span data

ivan-klass avatar Jul 04 '24 17:07 ivan-klass

Thanks for the feedback @ivan-klass, that's odd. I'm not sure how Sentry and OTEL_LOGS_EXPORTER are linked.

What version of the sentry-opentelemetry-agent did you test with?

We found some bugs and are about to release alpha 4 soon. Maybe that'll fix this too.

adinauer avatar Jul 05 '24 05:07 adinauer

@ivan-klass we've just released https://github.com/getsentry/sentry-java/releases/tag/8.0.0-alpha.4, can you please retest?

adinauer avatar Jul 08 '24 07:07 adinauer

@adinauer now everything seems fine, thank you guys!

ivan-klass avatar Jul 08 '24 11:07 ivan-klass