-
Notifications
You must be signed in to change notification settings - Fork 79
Move OpenTelemetryRum to a new API module #1387
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
base: main
Are you sure you want to change the base?
Conversation
d80e031 to
f854977
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1387 +/- ##
=======================================
Coverage 63.16% 63.17%
=======================================
Files 158 159 +1
Lines 3125 3123 -2
Branches 324 324
=======================================
- Hits 1974 1973 -1
+ Misses 1056 1055 -1
Partials 95 95 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| initializeOtelWithGrpc() | ||
| } | ||
|
|
||
| // This is not used but it's needed to verify that our consumer proguard rules cover this use case. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this still need verification?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel like this is a workaround for some classes that should really just have dontwarn entries in the proguard files. Regardless, it's not a problem anymore, at least in the building of the demo app, likely because core isn't exported by default and included in this app.
| api(project(":instrumentation:startup")) | ||
| api(project(":instrumentation:sessions")) | ||
| api(project(":instrumentation:screen-orientation")) | ||
| implementation(project(":instrumentation:activity")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How should folks configure individual instrumentation? For example, if someone wanted to configure AnrInstrumentation what would that look like, or is that something that should be answered further down the line?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If they are using the Initializer, then through the DSL via InstrumentationConfiguration.anrReporter { } 😅
All the instrumentation modules are pretty explicitly tied to the agent and the common instrumentation API, and until that changes, this will just work. To change that relationship, well, that will include changing this as well as other things.
| import io.opentelemetry.android.session.SessionProvider | ||
| import io.opentelemetry.sdk.OpenTelemetrySdk | ||
|
|
||
| object RumBuilder { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm a fan of breaking this out from the interface into a separate symbol, but preferred the name OpenTelemetryRum.builder compared to RumBuilder
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So like an extension function on the OpenTelemetryRum interface called builder() that returns an object? I kind of just stuck this here and am open to other ways of referencing this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The extension idea sounds good to me 👍
| @@ -0,0 +1,8 @@ | |||
| public abstract interface class io/opentelemetry/android/OpenTelemetryRum { | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How do folks construct instances of this interface? Ideally there should be some way of initializing from the API module IMO.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OpenTelemetryRumInitializer.initialize() and OpenTelemetryRumBuilder.build()
The agent-api module is basically just that - android-agent is effectively the public implementation that depends on core to do the hard work for agent-api, and it itself exposes some additional API like the OpenTelemetryRumInitializer. There could more work done in this area to consolidate the true public API to be in this module, and have android-agent just be an implementation, but that's for later.
1e97389 to
009d3bd
Compare
LikeTheSalad
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall, it looks good to me. Thanks!
Regarding the RumBuilder name, I agree we should try and keep the existing one somehow. I like the mentioned idea of using extensions.
| import io.opentelemetry.android.session.SessionProvider | ||
| import io.opentelemetry.sdk.OpenTelemetrySdk | ||
|
|
||
| object RumBuilder { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The extension idea sounds good to me 👍
Move the public interface
OpenTelemetryRumto a new module that all other modules can depend on, and movecoreas a dependency exported transitively via theandroid-agentmodule. That way, most folks won't be confused with having the choice of usingOpenTelemetryRumInitializer, which is the preferred, streamlined supported option vsOpenTelemetryRumBuilder, the supposedly internal object that we don't consider part of our API.Folks who need to figure that directly can still do so by directly including the
coremodule, but that should not be available by default.At the same time I changed all the module dependencies to
implementationas there is no reason to export public symbols of internal modules to the consuming app. Instead, the only transitive dependency that is exported viaandroid-agentis the new module,agent-api, soOpenTelemetryRumis still available. Internally, modules that depend onagent-apiwill pull it its dependencies too, which are the OTel ones.Note: this is technically an API change in that the static functions on
OpenTelemetryRumare now on a new object insidecorecalledRumBuilder, but since this was supposed to NOT be part of the public API, this should be OK.