Skip to content

DSL vs imperative configuration and disk buffering DSL config #1821

Description

@bencehornak

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:

  1. Are you planning to make the DSL configuration be on par with the imperative configuration API (i.e. RumBuilder)?
  2. If not:
    1. 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)?
    2. The OpenTelemetryRumBuilder API must be officially part of the stable API (as opposed to the disclaimer, that it is internal), right?
    3. 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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthelp wantedExtra attention is needed

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions