Skip to content

Conversation

fractalwrench
Copy link
Member

Goal

Builds on #1291 by continuing to convert initialize to use a type-safe DSL. The last commit contains the changes for this PR specifically - the first commit contains code that can be reviewed separately in #1291.

I've converted everything apart from OtelRumConfig to use a type-safe DSL called OpenTelemetryConfiguration. OtelRumConfig will be converted in a future PR that I've yet to complete. An example of how this looks in practice can be found below:

fun exampleUsage(application: Application) {
    OpenTelemetryRumInitializer.initialize(application) {
        httpExport {
            baseUrl = "http://localhost:4317"
            baseHeaders = mapOf("key" to "value")
            spans {
                url = "http://localhost:4318"
                headers = mapOf("key" to "override")
            }
        }
        instrumentations {
            anrReporter {
                enabled(true)
                addAttributesExtractor { _, _ ->
                    Attributes.empty()
                }
            }
        }
        session {
            maxLifetime = 10.minutes
        }
    }
}

@fractalwrench fractalwrench requested a review from a team as a code owner October 7, 2025 10:33
Copy link

codecov bot commented Oct 7, 2025

Codecov Report

❌ Patch coverage is 74.54545% with 14 lines in your changes missing coverage. Please review.
✅ Project coverage is 63.97%. Comparing base (c0d65cf) to head (d99d6a6).
⚠️ Report is 5 commits behind head on main.

Files with missing lines Patch % Lines
...metry/android/agent/OpenTelemetryRumInitializer.kt 57.14% 6 Missing ⚠️
...metry/android/agent/dsl/HttpExportConfiguration.kt 80.00% 5 Missing ⚠️
...ry/android/agent/dsl/OpenTelemetryConfiguration.kt 66.66% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1292      +/-   ##
==========================================
+ Coverage   63.87%   63.97%   +0.09%     
==========================================
  Files         150      154       +4     
  Lines        3070     3103      +33     
  Branches      305      304       -1     
==========================================
+ Hits         1961     1985      +24     
- Misses       1028     1038      +10     
+ Partials       81       80       -1     

☔ 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 fractalwrench changed the title Fw/dsl params Begin altering initialize to use a type-safe DSL Oct 7, 2025
@fractalwrench fractalwrench force-pushed the fw/dsl-params branch 2 times, most recently from b82936c to 538097b Compare October 10, 2025 08:41
Copy link
Contributor

@LikeTheSalad LikeTheSalad left a comment

Choose a reason for hiding this comment

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

Looks great, cheers!

Comment on lines 39 to 40
globalAttributes: (() -> Attributes)? = null,
diskBuffering: (DiskBufferingConfigurationSpec.() -> Unit)? = null,
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe a discussion for another PR, though I'm curious about the decision process to decide which parameters are left on the initializer method's arguments, vs which ones are placed into the Configuration dsl?

Copy link
Member Author

Choose a reason for hiding this comment

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

@LikeTheSalad I'd like to move basically every parameter apart from Application onto the Configuration DSL. I wanted to keep the PR size small particularly as other folks had PRs in flight, and should be able to open another PR towards the end of the week that moves the rest.

Copy link
Contributor

Choose a reason for hiding this comment

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

Sounds good to me, thanks for the clarification.

Copy link
Member Author

Choose a reason for hiding this comment

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

I've moved the rest over in #1313

@LikeTheSalad LikeTheSalad merged commit 53a7c64 into open-telemetry:main Oct 16, 2025
8 checks passed
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.

3 participants