Skip to content

Conversation

LikeTheSalad
Copy link
Contributor

@LikeTheSalad LikeTheSalad commented Sep 30, 2025

Related to #1257
Closes #991

@LikeTheSalad LikeTheSalad marked this pull request as ready for review September 30, 2025 12:39
@LikeTheSalad LikeTheSalad requested a review from a team as a code owner September 30, 2025 12:39
Copy link

codecov bot commented Sep 30, 2025

Codecov Report

❌ Patch coverage is 63.63636% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 63.57%. Comparing base (80924e2) to head (f27922a).

Files with missing lines Patch % Lines
...metry/android/agent/OpenTelemetryRumInitializer.kt 63.63% 2 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1272      +/-   ##
==========================================
- Coverage   63.59%   63.57%   -0.02%     
==========================================
  Files         142      142              
  Lines        3046     3056      +10     
  Branches      302      304       +2     
==========================================
+ Hits         1937     1943       +6     
- Misses       1032     1034       +2     
- Partials       77       79       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@fractalwrench
Copy link
Member

Does #1273 cover everything that was previously possible to configure via OtelRumConfig, or are there some APIs that we're happy to jettison as part of this change?

@LikeTheSalad
Copy link
Contributor Author

Does #1273 cover everything that was previously possible to configure via OtelRumConfig, or are there some APIs that we're happy to jettison as part of this change?

The latter. My goal with these changes is to make the initializer API as lean as possible so that we can add stuff later as needed, and to minimize deprecations in the near future, in case some of the APIs we expose right away don't hold up to real-world use cases that people can find later. OtelRumConfig includes several low-level config options that I don't think it would be wise to release upfront, though some of them are needed for basic usage afaik, such as providing global attributes, which I think we can add via the initializer's parameters. Right now, I just added globalAttributes (and enabled disk buffering by default), though I'm open to adding any other config option from OtelRumConfig right now that someone else deems necessary for basic usage.

InstrumentationConfiguration().configure()
}
val rumConfig = OtelRumConfig()
rumConfig.setDiskBufferingConfig(DiskBufferingConfig.create(enabled = true))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At minimum, I think we need to expose a way to disable disk buffering and a way to turn on/off debugging for it (although that could be tied to a broader debug setting if one existed).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair enough 👍

I was thinking that it might be nice to reuse the same enabling/disabling config mechanism proposed for instrumentations here for diskbuffering as well. If you agree, then I'd like to hold this PR until that other one is merged, to do a rebase here and use the same config interface.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I like that approach and think it would apply nicely here too. If you would like to do it as a follow-up PR, please open a tracking issue so that we don't lose this. Otherwise, this PR should be good. ❤️

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you. The changes aren't that much, so I've pushed them to this PR. I've added a DSL-like config for disk buffering that, for now, only allows enabling/disabling it, like so:

OpenTelemetryRumInitializer.initialize(
    diskBuffering = {
        enabled(false) // true by default
    }
)

Regarding the debug mode, in case we think it's helpful, I think it'd be better to have a broader debug setting. I was about to create an issue for it until I found this one, which I think is what we're looking for. FWIW, currently the debug mode for disk buffering means that some info level logs are only printed when debug = true, however, in my recent changes to disk buffering, I removed that flag and changed the log levels to a finer scope, which will make the logs only show up when the host app's JUL config is set to show those logs, which I guess will be when the app is running in "debug mode" in general, but it won't be the default. This change aligns disk buffering's logs with the rest of OTel Java related repos. If we wanted to provide a "debug mode", I think we need to decide what to do with all the OTel Java related repos' logs too, so it seems to me that this would require discussing it further, probably in a SIG meeting.

Copy link
Member

@fractalwrench fractalwrench left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Enabling disk-buffering in the agent by default
4 participants