getsentry / sentry-java

A Sentry SDK for Java, Android and other JVM languages.
https://docs.sentry.io/
MIT License
1.12k stars 428 forks source link

Reporting errors through a Sentry Java Agent #2480

Open adinauer opened 1 year ago

adinauer commented 1 year ago

Problem Statement

We rely on other libraries to offer some callbacks or require users to manipulate / wrap libraries for errors to be reported to Sentry. By using a Java Agent we could wrap calls and capture errors where there's no clean API to usually do so. We already do something similar for Android using sentry-android-gradle-plugin.

Solution Brainstorm

A Sentry Java Agent similar to the OTEL agent. Maybe we can combine them so we don't have to figure out how to make them co-exist. Or we could offer a separate agent just for errors which uses common code that we can also leverage in the Sentry OTEL Java Agent.

marandaneto commented 1 year ago

Relates to https://github.com/getsentry/sentry-java/issues/801 but that's Android specific

adinauer commented 1 year ago

Should take care not to add too much overhead to the application (i.e. not make it slow).

adinauer commented 1 year ago

We already had an agent at some point (https://github.com/getsentry/sentry-java/tree/agent-latest/agent). Here's some feedback for it: https://github.com/getsentry/sentry-java/issues/617

ivan-klass commented 1 month ago

Shouldn't this be closed in favour of sentry-opentelemetry-agent?

adinauer commented 3 weeks ago

@ivan-klass the idea was to make use of the Java Agents bytecode manipulation to add error instrumentation. This can help in cases where libraries are hard to support due to lack of callbacks etc.

It's just an idea we might follow up on at some point.