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

Reporting errors through a Sentry Java Agent

Open adinauer opened this issue 3 years ago • 5 comments

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.

adinauer avatar Jan 17 '23 10:01 adinauer

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

marandaneto avatar Jan 17 '23 11:01 marandaneto

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

adinauer avatar Jan 17 '23 11:01 adinauer

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

adinauer avatar Jan 18 '23 07:01 adinauer

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

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

@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.

adinauer avatar Jun 24 '24 05:06 adinauer