Skip to content

Configuration

obs-gh-alexlew edited this page May 31, 2024 · 1 revision

Structure

The agent is designed for all user-provided configuration to live in the observe-agent.yaml file. The agent will process this file when it starts and based on the values set will produce a final otel-collector configuration. The default configs for otel-collector reside in the connections folder and are organized by connection type. Within each connection type folder are various otel-collector config fragments.

Connection-Specific OTEL Collector Configs

These configuration fragments are generally tied to a specific feature that can either be enabled or disabled. For example, in the host_monitoring connection type we have the fragments logs.yaml and metrics.yaml. Each of these is tied to a boolean field in the observe-agent.yaml file and will be included or omitted based on the value there. Since there's no guarantee that any given feature will be enabled or disabled, these fragments must be independent of each other and cannot reference anything defined in other fragments.

Adding custom OTEL Collector Config

The top level observe-agent.yaml includes a section that allows for providing additional OTEL collector config, otel_config_overrides. If for example you wanted to add a new exporter and a new pipeline that utilizes this receiver, you could define both in this section as follows

otel_config_overrides:
  exporters:
    debug:
      verbosity: detailed
      sampling_initial: 5
      sampling_thereafter: 200
  service:
    pipelines:
      metrics/debug:
        receivers: [hostmetrics/host-monitoring]
        processors: [memory_limiter]
        exporters: [debug]

When the agent starts, it takes the contents of this section and writes them to a separate temporary file which is then included in the configs the agent loads.

Overriding existing OTEL Collector Config

You can also override existing components that are defined in the default fragments. To do so, you would need to find the name of the component you're trying to override and then redefine it in the otel_config_overrides section of the config. Since the temporary file based on the overrides will always be loaded last, it will override any existing definitions of components with the same name.

otel_config_overrides:
  exporters:
    debug:
      verbosity: detailed
      sampling_initial: 5
      sampling_thereafter: 200
  service:
    pipelines:
      # This will override the existing metrics/host_monitoring pipeline and output to stdout debug instead
      metrics/host_monitoring:
        receivers: [hostmetrics/host-monitoring]
        processors: [memory_limiter]
        exporters: [debug]