-
Notifications
You must be signed in to change notification settings - Fork 32
Description
I'd like to propose a new configuration approach for OpenTelemetry configuration, specifically for the following components like detectors, propagators, and instrumentation.
Why
From experience with other ecosystems (notably OTel .NET Automatic Instrumentation and popular linters like golangci-lint), many users want to quickly enable a sane and practical default set of configuration values, or easily enable all, disable all, or fine-tune a subset. This pattern is especially useful for onboarding and simplifies configuration for both beginners and advanced users.
What
Add support for the following configuration values:
presets: Predefined, recommended sets of options (e.g., “default”, “all”, “stable”, "none", "fast", "common").enabled: Explicit list of items to enable.disabled: Explicit list of items to disable.
For example, a configuration could look like (simplified):
instrumentation:
preset: all # Enable all available instrumentation
disabled: [redis] # Exclude one specific instrumentation that causes issues
propagators:
preset: default # The OpenTelemetry recommended defaults
detectors:
preset: none # A fine-grained list of detectors
enabled: [gcp]Benefits:
- Simplifies configuration for most use cases, especially for new users.
- Allows fine-grained configuration.
- Aligns with user expectations from .NET auto instrumentation and other similar projects.
Considerations:
- Preset names and their actual contents should be documented.
- Define behavior if an item exists in both enabled and disabled lists.
- Option A: error
- Option B: disabled has higher priority (precedence)
- Define how to configure specific item (e.g. redis instrumentation)
- Option A: following configuration patterns used by golangci-lint for items, add separate settings node e.g.
instrumentation-settings
- Option A: following configuration patterns used by golangci-lint for items, add separate settings node e.g.
instrumentation:
preset: all # Enable all available instrumentation
instrumentation-settings:
redis:
metrics-enabled: false- Option B: the items in
enabledcan be (or are) objects (not just names)
instrumentation:
preset: all # Enable all available instrumentation
enabled:
- redis:
metrics-enabled: falseor maybe
instrumentation:
preset: all # Enable all available instrumentation
enabled:
redis:
metrics-enabled: falsebut then we would have different syntax for enabled and disabled which feels akward
Additional (optional) features:
- Allow users to easily extend or override presets for their specific needs
Side note: I think it may be worth checking configuration patterns used by golangci-lint. Similar patterns could be used for configuring instrumentation, propagators, detectors.
Drawbacks:
- Presets are "magic" that can cause different behavior between implementation versions. E.g.
stableinstrumentation preset may have more entries for OTel .NET Auto in v1.45.0 than v1.23.0. Moreover, people reading the config content would need to understand what is behind the preset. Without the presets everything is explicitly specified. - The config structure is more complex.
- Implementation is harder.
PS. Initially I was even against the environment variable substitution behavior.