Skip to content

Configuring the OpenTelemetry Collector: OTCA practice questions

A Collector configuration is a YAML document built from a few top-level sections. Receivers, processors, exporters and connectors are the pipeline components that touch telemetry, while extensions add capabilities such as health checks or authentication without handling the data itself. Defining a component in its section only describes it.

By Ibrahim Yesilay · Published · Updated

Independent community practice, not affiliated with or endorsed by CNCF or The Linux Foundation.

What Configuring the OpenTelemetry Collector covers in OTCA

A Collector configuration is a YAML document built from a few top-level sections. Receivers, processors, exporters and connectors are the pipeline components that touch telemetry, while extensions add capabilities such as health checks or authentication without handling the data itself. Defining a component in its section only describes it. Nothing runs until the service section references it, either inside a pipeline or in the service extensions list, so a component that is configured but never referenced is simply not enabled.

Every component is named with an identifier of the form type[/name]. The type selects the implementation, for example otlp or batch, and the optional name lets you declare several instances of one type, such as otlp and otlp/2 listening on different ports. Pipelines use the same pattern, so traces and traces/2 can coexist. Identifiers only have to be unique; the type before the slash is what decides behaviour.

The Collector reads its configuration through providers. The --config flag accepts a plain path or a URI with a scheme, and the documented schemes are file, env, yaml, http and https. You can repeat --config to pass several sources, and they are merged into one in-memory configuration. Each source may be partial and may reference components defined in another, but the merged result must be complete, because the Collector does not add missing components for you. Values passed with --set are applied after all --config sources are merged, and nested keys in --set and yaml: values are separated with two colons.

Inside the YAML, environment variables are expanded with the ${env:NAME} syntax, and a fallback can be given with ${env:NAME:-default}. A doubled dollar sign produces a literal dollar sign. A provider can also be embedded in a value, so a line like exporters: ${file:exporters.yaml} pulls that file into the merged configuration.

Network-facing components default to binding localhost, which has been the default host since Collector v0.110.0. The OTLP receiver therefore listens on localhost:4317 for gRPC and localhost:4318 for HTTP unless you set an endpoint. In containers and Kubernetes this is a frequent reason why other workloads cannot connect, and the security guidance recommends binding to a specific interface such as the pod IP rather than 0.0.0.0.

Which components exist depends on the distribution. The project publishes core, contrib, Kubernetes, OTLP-only and eBPF profiling distributions, and the contrib README advises limiting production builds to the components you need. The OpenTelemetry Collector Builder, ocb, compiles such a custom distribution with Go from a YAML manifest that has a dist section plus lists of component Go modules.

Key points

  • A configured component is only enabled when the service section references it.
  • Component and pipeline identifiers use the type[/name] format, such as otlp/2.
  • Repeated --config sources are merged, and --set overrides are applied after that merge.
  • Environment variables expand with ${env:NAME}, defaults use ${env:NAME:-value}, and $$ is a literal dollar.
  • Server endpoints default to localhost, so the OTLP receiver listens on localhost:4317 and localhost:4318.
  • ocb builds a custom distribution from a manifest with a dist section and Go module lists.

Three sample questions

17 OTCA questions on Configuring the OpenTelemetry Collector, 17 with explanations. How practice works

Question 1

Which component in the OpenTelemetry Collector can be used to enable authentication and authorization mechanisms for telemetry data?
  1. A.Processors
  2. B.Receivers
  3. C.Extensions
  4. D.Exporters

Correct answer: C

The Collector configuration page says the authentication mechanism "uses the extensions mechanism, allowing for custom authenticators to be plugged into Collector distributions". Each authentication extension acts as a server authenticator for receivers or as a client authenticator for exporters. Why the other options are wrong. "Processors": processors change data in a pipeline; they do not authenticate connections. "Receivers": receivers reference an authenticator, but the authenticator itself is an extension. "Exporters": exporters also only reference an authenticator extension; they do not provide the mechanism.

Sources: OpenTelemetry docs: Collector configuration, OpenTelemetry docs: Collector

Question 2

A Collector configuration contains the line exporters: ${file:exporters.yaml} and a separate exporters.yaml file defines one exporter. What does the Collector do with this reference when it loads the configuration?
  1. A.It ignores the line, because file references are only valid in the service section
  2. B.It merges the contents of exporters.yaml into a single in-memory configuration
  3. C.It starts a second Collector process that only runs the exporters from that file
  4. D.It treats the string as a literal exporter name and fails because no such type exists

Correct answer: B

The Collector configuration docs show exporters: ${file:exporters.yaml} as a way to include other files: the Collector merges them into a single in-memory representation of the YAML configuration, and the example prints the final merged result with the exporter from exporters.yaml in place. The same page describes this as one configuration provider (file) being embedded in another. Why the other options are wrong. "It ignores the line, because file references are o…": file references are shown used for the exporters section itself, not restricted to the service section. "It starts a second Collector process that only run…": there is a single Collector and a single merged configuration; no extra process is started. "It treats the string as a literal exporter name an…": the ${file:...} syntax is expanded by the file provider, so it is not interpreted as a literal component type.

Sources: OpenTelemetry docs: Collector configuration, OpenTelemetry docs: Collector architecture

Question 3

You need a second OTLP receiver listening on a different port in the same Collector configuration. Which component identifier follows the documented format for an additional instance of the same type?
  1. A.otlpsecondary
  2. B.secondary/otlp
  3. C.receivers.otlp.2
  4. D.otlp/secondary

Correct answer: D

Receivers, processors, exporters and pipelines are identified with the type[/name] format, for example otlp or otlp/2. You may define a type more than once as long as each identifier is unique, so otlp/secondary is a second OTLP receiver whose type is still otlp. Why the other options are wrong. "otlpsecondary": without the slash this is read as a single, unknown component type named otlpsecondary. "secondary/otlp": the type must come first; this would declare a component of an unknown type "secondary". "receivers.otlp.2": a dotted path is not a component identifier; components are keyed by type[/name] inside their section.

Sources: OpenTelemetry docs: Collector configuration, OpenTelemetry docs: Collector architecture

Practice this topic

Focus mode keeps every question on Configuring the OpenTelemetry Collector until you leave it. 10 free guest answers, then a free account; no credit card.

Or open OTCA practice across all topics.

Sources

The explanation above was checked against these official documents.

Frequently asked questions

Does the Collector fill in a default receiver if my merged configuration has none?

No. The configuration docs say required components are not added by default, so an incomplete merged configuration produces an error.

Why can other pods not reach my OTLP receiver?

If no endpoint is set, the receiver binds localhost. Set the endpoint to an address reachable by clients, such as the pod IP.