-
Notifications
You must be signed in to change notification settings - Fork 91
Description
Introduction
After going stable with our andrid-agent module, we've discussed plans to stabilize other modules as well, in a recent Android SIG meeting.
One of the modules that could be ideal as a next candidate to become stable is android-instrumentation, where the base abstraction for all of OTel Android instrumentations is defined (AndroidInstrumentation), which would open the possibilities of marking specific instrumentations as stable right after.
The problem
However, before we stabilize the instrumentation API, I think we should make sure that it's flexible enough so that it can be extended in the future without having to introduce breaking changes or having to resort to workarounds, as we currently do with our CrashReporterInstrumentation, where we cast an OpenTelemetry instance to OpenTelemetrySdk for it to work properly:
Lines 29 to 30 in e725d67
| // TODO avoid using OpenTelemetrySdk methods, only use the ones from OpenTelemetry api. | |
| crashReporter.install(ctx.openTelemetry as OpenTelemetrySdk) |
Proposals
I've put together a couple of proposals to make the instrumentation API more flexible, hoping it can be extended as needed in the future:
- Option 1 - Ensures that our
OpenTelemetryRumabstraction can support common use cases, such as flushing log records (needed for our crash instrumentation). - Option 2 - Creates separate/optional APIs that implementations of
OpenTelemetryRumwould have to opt-in to enable some use cases, such as flushing log records (needed for our crash instrumentation).
Both options extend our OpenTelemetryRum abstraction to make it provide common tools, such as the Clock instance used in our OpenTelemetry instance, needed by our ActivityLifecycleInstrumentation, and a SessionProvider instance, used by our SessionInstrumentation, as well as being a common RUM concept, so it sounds reasonable to make it available in our RUM abstraction.
I'm looking for some feedback on those, to see which one suits us all better, or to see extra alternatives that we can choose from as well.