I've recently faced the dilemma of using the new DSL configuration API (i.e. OpenTelemetryRumInitializer): I wanted to make use of the "reasonable defaults" that it comes with, however, there was just one thing I wanted to override: the disk buffering configuration by increasing the exporting interval. Since the related disk buffering properties (maxFileAgeForWriteMillis, minFileAgeForReadMillis, maxFileAgeForReadMillis) are not exposed (you can only enable or disable it currently, see below), this meant that I had no choice, but to fully ditch the DSL API and include all the boilerplate in my project that the android-agent module is supposed to hide.
|
* Type-safe config DSL that controls how disk buffering of exported telemetry should behave. |
|
*/ |
|
@OpenTelemetryDslMarker |
|
class DiskBufferingConfigurationSpec internal constructor( |
|
private val rumConfig: OtelRumConfig, |
|
) : CanBeEnabledAndDisabled { |
|
internal var enabled: Boolean = true |
|
set(value) { |
|
field = value |
|
rumConfig.setDiskBufferingConfig(DiskBufferingConfig.create(enabled = value)) |
|
} |
|
|
|
init { |
|
rumConfig.setDiskBufferingConfig(DiskBufferingConfig.create(enabled)) |
|
} |
|
|
|
override fun enabled(enabled: Boolean) { |
|
this.enabled = enabled |
|
} |
|
} |
So I have some questions related to my recent experiences:
- Are you planning to make the DSL configuration be on par with the imperative configuration API (i.e.
RumBuilder)?
- If not:
- Would it make sense to document both APIs as viable alternatives with pros and cons in the
README (currently the usage of RumBuilder requires a lot of reverse-engineering due to the absence of docs)?
- The
OpenTelemetryRumBuilder API must be officially part of the stable API (as opposed to the disclaimer, that it is internal), right?
- What do you think about exposing the
RumBuilder object of the OpenTelemetryRumInitializer DSL entry point class in some way to allow further customizations before the OpenTelemetryRum object is built?
Thanks for your feedback in advance!
I've recently faced the dilemma of using the new DSL configuration API (i.e.
OpenTelemetryRumInitializer): I wanted to make use of the "reasonable defaults" that it comes with, however, there was just one thing I wanted to override: the disk buffering configuration by increasing the exporting interval. Since the related disk buffering properties (maxFileAgeForWriteMillis,minFileAgeForReadMillis,maxFileAgeForReadMillis) are not exposed (you can only enable or disable it currently, see below), this meant that I had no choice, but to fully ditch the DSL API and include all the boilerplate in my project that theandroid-agentmodule is supposed to hide.opentelemetry-android/android-agent/src/main/kotlin/io/opentelemetry/android/agent/dsl/DiskBufferingConfigurationSpec.kt
Lines 13 to 32 in ad76f89
So I have some questions related to my recent experiences:
RumBuilder)?README(currently the usage ofRumBuilderrequires a lot of reverse-engineering due to the absence of docs)?OpenTelemetryRumBuilderAPI must be officially part of the stable API (as opposed to the disclaimer, that it is internal), right?RumBuilderobject of theOpenTelemetryRumInitializerDSL entry point class in some way to allow further customizations before theOpenTelemetryRumobject is built?Thanks for your feedback in advance!