Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow instantiating extensions in separate configs #8394

Open
evan-bradley opened this issue Sep 12, 2023 · 0 comments
Open

Allow instantiating extensions in separate configs #8394

evan-bradley opened this issue Sep 12, 2023 · 0 comments

Comments

@evan-bradley
Copy link
Contributor

Is your feature request related to a problem? Please describe.

There is currently no way to easily instantiate extensions across multiple configuration sources. The default behavior in koanf is to overwrite slices when merging multiple maps. This results in behavior where the service.extensions key will be overridden and take the value of the final source if it is set multiple times.

Take the following two configuration files:

extensions:
  health_check:
    endpoint: localhost:61234

service:
  extensions: [health_check]
extensions:
  zpages:

service:
  extensions: [zpages]

If I start the Collector with the following, only the zpages extension will be started.

otelcol --config=health_check.yaml --config=zpages.yaml

The effective config will look like:

extensions:
  health_check:
    endpoint: localhost:61234
  zpages:

service:
  extensions: [zpages]

Describe the solution you'd like
At a minimum, provide a naming scheme similar to what we provide for pipelines to allow config sources to instantiate extensions they define. This could look like:

service:
  extensions/health: [health_check]
  extensions/zpages: [zpages]

Describe alternatives you've considered

A more comprehensive solution could be to override the default koanf merging strategy to support merging slices. I would propose the following rules for merging slices:

  1. Slices values are not deduplicated
  2. Slices are merged by appending slices to previous values.

The caveat with changing this behavior is that it would be more difficult to set slice values to empty lists, which would now require setting to nil (or another primitive value) before setting them to an empty list.

We could also simply recommend that extensions are all instantiated in a single file, but in my view this is not a good solution.

Additional context

It's possible I've missed an existing mechanism for this, but I've looked through the code and docs and don't see an any way to accomplish this. If I've missed something we should make it more visible.

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

No branches or pull requests

1 participant