open-telemetry / opentelemetry-android

OpenTelemetry Tooling for Android
Apache License 2.0
145 stars 34 forks source link

Request for Documentation and Example on ANR Detection in OpenTelemetry Android Library #496

Open stas-rudevitsky opened 1 month ago

stas-rudevitsky commented 1 month ago

Hello OpenTelemetry Team,

I am currently working on integrating the OpenTelemetry Android library into my project and I'm particularly interested in utilizing the ANR (Application Not Responding) detection feature. However, I have not been able to find concrete examples or detailed documentation on how to implement this feature.

Based on the repository description, it is mentioned that the library supports ANR detection among other features. Despite my attempts, I encountered several issues with dependencies and couldn't find the necessary AnrInstrumentation class or relevant documentation to guide me through the implementation.

breedx-splk commented 1 month ago

Hi @stas-rudevitsky, thanks for the inquiry. We're in the process of a major re-shaping of this instrumentation and how it is wired up to this agent and your application. We don't yet have a release build that contains the changes, nor do we have a working example yet. It's coming soon, though!

If you don't mind getting your hands dirty, you can roll up your sleeves and try the 0.7 SNAPSHOT build before then. You'll need to make sure you match the otel android agent version with this instrumentation version. Including it in the runtime classpath should be enough for the ANR instrumentation to be installed at runtime.

The snapshots are here: https://oss.sonatype.org/content/repositories/snapshots/io/opentelemetry/android/instrumentation-anr/0.7.0-alpha-SNAPSHOT/

For ANR, you'll add the maven snapshot repo to your gradle build config, and then use io.opentelemetry.android:instrumentation-anr:0.7.0-SNAPSHOT.

Let us know how it works out, or check back in a few weeks.

AhmedMannai10 commented 5 days ago

Is there is any update on how to implement the ANR, or some of the other features ?

breedx-splk commented 1 day ago

Hi @AhmedMannai10. The top-level agent project includes the ANR instrumentation, so if you depend on it and create an instance of OpenTelemetryRum (like the demo-app does) you should get ANR instrumentation automatically. It will create a span with the name "ANR", although I'd expect that to change when we get semantic conventions defined for this.

We don't yet have the ability to simulate/cause an ANR in the demo app, so this would be a welcome contribution. I'll open an issue for that, so let me know if you'd like to work on it.