Skip to content

Instantly share code, notes, and snippets.

@owais
Last active March 8, 2021 19:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save owais/36a9f014ed321c50da52519cf95e5354 to your computer and use it in GitHub Desktop.
Save owais/36a9f014ed321c50da52519cf95e5354 to your computer and use it in GitHub Desktop.
Otel collector remote config example
remote_config_sources:
vault:
# vault connection config
zookeeper:
# zookeeper connection config
# any given config key for any component can be replaced with
# $load_from_remote and config loader/parser would replace it
# with whatever is loaded. Whatever is loaded could be a YAML
# sub-tree or any value. Any loaded sub-tree may not contain
# another $load_from_remote so nested $load_from_remotes are
# not allowed to simplify implementation.
# replace entire sub-tree with remote config
receivers:
$load_from_remote:
source: zookeeper
key: /receivers
# replace a single key with a value
extensions:
example_extension:
endpoint: https://some-beacon-endpoint/
access_token:
$load_from_remote:
source: vault
key: /tokens/example_extension/access_token
another_extension:
template: "tomcat.yaml"
int_param: 321
path:
$from_config_sources:
source: zookerper
key: /tomcat/log_file_path
@owais
Copy link
Author

owais commented Mar 8, 2021

I see we want to support env var substition as well. May be env vars can be seen as yet another remote source? How about something like:

remote_config_sources:
  vault:
    # vault connection config 

  environment:


  another_extension:
      template: "tomcat.yaml"
      int_param: 321
      path:
        $from_config_sources:
          source: environment
          key: TOMCAT_ACCESS_FILE

This would make environment just another pluggable config source and avoid core collector to implement support for env substition out of the box.

To reduce verbosity, may be we can dos something like the following:

remote_config_sources:
  vault:
    config_prefix: vault_

  environment:
    config_prefix: env_


receivers: $vault_/receivers
  # would be same as writing the following
  # $load_from_remote:
  #     source: zookeeper 
  #     key: /receivers

  another_extension:
      template: "tomcat.yaml"
      int_param: 321
      path: $env_TOMCAT_ACCESS_FIILE
      # same as writing the following
      #  path:
      #    $from_config_sources:
      #        source: environment
      #        key: TOMCAT_ACCESS_FILE

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment