-
-
Notifications
You must be signed in to change notification settings - Fork 435
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
Java SDK basic OTEL Support #2327
Comments
I've looked at the documentation and through the code, but I couldn't find an answer to this simple question: say that I'm using the Sentry OpenTelemetry Java agent, what am I supposed to see on my Sentry dashboard? To give some context, I'm trying to instrument an off-the-shelf application (Keycloak to be precise) with the Java agent, with the goal of seeing generated exceptions on my Sentry dashboard. Is this use case supposed to be (already) possible? |
Hello @dalbani. We're not using exporters to send the Spans to Sentry but instead rely on a SpanProcessor which converts OpenTelemetry Spans into Sentry Transactions / Spans. I haven't tried instrumenting keycloak myself and I don't know what underlying frameworks (if any) it uses so I can't say for sure whether something would show up. I wasn't able to find any direct instrumentation for it in the OpenTelemetry repository (https://github.com/open-telemetry/opentelemetry-java-instrumentation/tree/main/instrumentation). If it does work you should be able to see transactions in the Sentry UI under "Performance". |
I guess you should at least be able to see some database queries showing up in Sentry. |
Thanks @adinauer for the response. I suppose what I'm looking for is for the Java agent to act as a big |
Yes for now you'd have to rely on one of the logging integrations (logback, log4j2, jul) for capturing errors. We have #2480 to explore capturing errors via the Java Agent. I guess we'd have to find the place where unhandled exceptions are caught for every framework we want to support and capture it there. We don't have plans for doing this for things like keycloak though. It would be for commonly used frameworks. |
For the record, I've stumbled upon an extension for Quarkus (the framework Keycloak is based on) for an integration with Sentry: https://github.com/quarkiverse/quarkus-logging-sentry. [*] [*] It's your call obviously, but having an official support for Quarkus would be great, I think. |
Description
More details tbd
Our plan is to create a
SpanProcessor
(for sending spans to Sentry) as well as probably aTextMapPropagator
(for dealing with tracing across systems).We'll probably also need to provide an agent
JAR
for people to auto instrument their applications.There may be problems with initializing Sentry in combination with the agent, needs investigation.
Implementing it should address #1348 .
Here's issues on other SDKs implementing OTEL support:
Challenges faced
Accessing the initialized
Sentry
instance of the target application from the OTEL Java AgentAsked on OTEL GH and got some suggestions:
Use reflection
This would require us to perform every interaction with Sentry using reflection, not just retrieving the instance but every invocation which would lead to very difficult maintenance and brittle code
Add
Sentry
to the bootstrap classloaderso the same instance can be accessed from the target application and the OTEL Java Agent: This requires us to create our own custom distro of the OTEL Java Agent as shown in their samples. We first tried producing an agent JAR with
SpanProcessor
added as extension but that didn't allow us to add to the bootstrap classloader.TODOs
main
instrumenter
to options and makestartTransaction
andcreateChild
no-op if theinstrumenter
performing the operation does not match the configured one.SpanProcessor
TextMapPropagator
null
classloader (i.e. bootstrap classloader) doesn't cause issuessentry-trace
andbaggage
headers. #2376SentrySpanProcessor
,SentryPropagator
etc.sentry-opentelemetry
modulesHubAdapter
instead ofSentry
The text was updated successfully, but these errors were encountered: