# open-telemetry/opentelemetry-collector architecture

> Architecture diagram of the GitHub repository open-telemetry/opentelemetry-collector, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-06-24). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/open-telemetry/opentelemetry-collector
- Repository: https://github.com/open-telemetry/opentelemetry-collector

## Overview

1. This repository is the OpenTelemetry Collector core codebase: a Go multi-module workspace that provides the runtime, shared APIs, signal data model, component implementations, and code generators for collector distributions.

2. The main execution path is:
   config loading → service assembly → pipeline graph wiring → signal ingestion/processing/export.
   The `otelcol` package is the generic runtime/CLI, while `cmd/otelcorecol` is a concrete distribution binary built from a fixed component set.

3. `service/` is the orchestration layer. It turns a parsed configuration into running graphs of receivers, processors, connectors, exporters, and extensions. It also manages lifecycle, capability negotiation, component wiring, internal telemetry, and zPages/service diagnostics.

4. `pipeline/`, `receiver/`, `processor/`, `exporter/`, `connector/`, `scraper/`, and `extension/` define the component abstractions and helper utilities for each role in the data path. These packages split the collector into clear boundaries: input adapters, transformation stages, routing/fanout, output adapters, periodic scrapers, and out-of-band service extensions.

5. The data model layer lives in `pdata/`. It contains the in-memory representations and codecs for logs, metrics, traces, and profiles, plus OTLP/gRPC request/response types and JSON/protobuf support. Most runtime components depend on `pdata` rather than on raw protobuf messages.

6. `confmap/` is the configuration ingestion subsystem. It resolves config from multiple providers such as files, env vars, HTTP/HTTPS, and YAML, then expands, merges, validates, and unmarshals it into typed component configs. This is the boundary between external config sources and the service graph.

7. `component/`, `consumer/`, `producer-like` helpers, and `host`/`telemetry` packages define the shared runtime contracts: component identity, status, host capabilities, error semantics, and observability hooks. `internal/sharedcomponent`, `internal/statusutil`, and similar packages hold cross-cutting implementation details that should not leak into public APIs.

8. Many subdirectories are concrete component implementations:
   - `receiver/otlpreceiver` for OTLP ingest over gRPC/HTTP
   - `exporter/otlpexporter` and `exporter/otlphttpexporter` for OTLP emission
   - `processor/batchprocessor` and `processor/memorylimiterprocessor`
   - `extension/memorylimiterextension`, `extension/zpagesextension`, `extension/extensionauth`
   - `scraper/*` for metric/profile scraping
   These are assembled by the service graph according to configured pipelines.

9. Connectors are a distinct boundary in the graph. The `connector/` packages bridge pipelines by acting as both consumer and producer, enabling fanout, routing, and cross-signal joins without collapsing the pipeline abstraction.

10. The repository heavily uses generators and metadata files. `cmd/mdatagen`, `cmd/schemagen`, `internal/cmd/pdatagen`, and many `metadata.yaml` files generate configs, schemas, docs, status artifacts, and test fixtures. This means much of the repo’s “shape” is defined declaratively and materialized into code during build time.

11. `cmd/builder` is a distribution factory: it takes a component manifest and emits a tailor-made collector binary and supporting source. The `reports/` and `distributions.yaml` files capture curated component sets used to define official distributions like core, contrib, k8s, and otlp.

12. `internal/e2e`, `*_test` helper modules, and the `examples/` and `docs/` trees provide the integration boundary. They validate that configuration, service wiring, data-path behavior, and component contracts work together across signals and platforms.

13. In architecture-diagram terms, the repo is best drawn as layered:
   external config sources and telemetry inputs at the top/left; config resolution and service graph in the middle; signal model/runtime helpers beneath; concrete receivers/processors/connectors/exporters/extensions/scrapers around the graph; and `pdata` plus code generators as the foundational substrate underneath everything else.

Main entry points: [`pdata`](https://github.com/open-telemetry/opentelemetry-collector/tree/main/pdata) (pdata), [`service/internal/graph`](https://github.com/open-telemetry/opentelemetry-collector/tree/main/service/internal/graph) (graph), [`service`](https://github.com/open-telemetry/opentelemetry-collector/tree/main/service) (service), [`consumer`](https://github.com/open-telemetry/opentelemetry-collector/tree/main/consumer) (consumer)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Runtime"]
  node_otelcol["otelcol<br/>collector runtime"]
  node_otelcorecol["otelcorecol<br/>core binary"]
  node_service["service<br/>orchestration"]
  node_service_graph["graph<br/>wiring core"]
  node_service_pipelines["pipelines<br/>pipeline config"]
end

subgraph group_contracts["Contracts"]
  node_component["component<br/>runtime contracts"]
  node_consumer["consumer<br/>signal contract"]
  node_pipeline["pipeline<br/>signal graph"]
  node_receiver["receiver<br/>ingest boundary"]
  node_processor["processor<br/>transform stage"]
  node_exporter["exporter<br/>output boundary"]
  node_connector["connector<br/>bridge boundary"]
  node_scraper["scraper<br/>periodic ingest"]
  node_extension["extension<br/>out-of-band"]
end

subgraph group_model["Data Model"]
  node_pdata[("pdata<br/>signal model")]
  node_pcommon["pcommon<br/>common model"]
  node_plog["plog<br/>logs model"]
  node_pmetric["pmetric<br/>metrics model"]
  node_ptrace["ptrace<br/>traces model"]
  node_pprofile["pprofile<br/>profiles model"]
end

subgraph group_config["Config"]
  node_confmap["confmap<br/>config ingestion"]
  node_confmap_providers["providers<br/>config sources"]
end

subgraph group_generators["Generators"]
  node_internal_pdatagen["pdatagen<br/>codegen"]
  node_cmd_mdatagen["mdatagen<br/>metadata generator"]
  node_cmd_schemagen["schemagen<br/>schema generator"]
  node_cmd_builder["builder<br/>distribution factory"]
  node_distributions["distributions<br/>manifest set"]
end

subgraph group_impl["Components"]
  node_receiver_otlp["OTLP recv<br/>receiver impl"]
  node_processor_batch["batch proc<br/>processor impl"]
  node_processor_memory["mem limiter<br/>processor impl"]
  node_exporter_otlpgrpc["OTLP exp<br/>exporter impl"]
  node_exporter_otlphttp["OTLP HTTP<br/>exporter impl"]
  node_connector_forward["forward<br/>connector impl"]
  node_extension_mem["mem ext<br/>extension impl"]
end

node_confmap -->|"loads config"| node_otelcol
node_otelcol -->|"assembles"| node_service
node_otelcorecol -->|"ships"| node_service
node_service -->|"wires"| node_service_graph
node_service -->|"builds"| node_service_pipelines
node_service_graph -->|"uses"| node_receiver
node_service_graph -->|"uses"| node_processor
node_service_graph -->|"uses"| node_exporter
node_service_graph -->|"uses"| node_connector
node_service_graph -->|"uses"| node_extension
node_pipeline -->|"defines"| node_consumer
node_receiver -->|"pushes to"| node_consumer
node_processor -->|"accepts"| node_consumer
node_exporter -->|"implements"| node_consumer
node_connector -->|"bridges"| node_consumer
node_connector -->|"bridges"| node_pipeline
node_scraper -->|"emits"| node_pdata
node_pdata -->|"shares"| node_pcommon
node_pdata -->|"contains"| node_plog
node_pdata -->|"contains"| node_pmetric
node_pdata -->|"contains"| node_ptrace
node_pdata -->|"contains"| node_pprofile
node_receiver_otlp -->|"decodes to"| node_pdata
node_exporter_otlpgrpc -->|"encodes from"| node_pdata
node_exporter_otlphttp -->|"encodes from"| node_pdata
node_processor_batch -->|"rewrites"| node_pdata
node_processor_memory -->|"protects"| node_service_graph
node_extension_mem -->|"extends"| node_service
node_internal_pdatagen -->|"generates"| node_pdata
node_cmd_mdatagen -->|"generates metadata"| node_component
node_cmd_schemagen -->|"generates schemas"| node_confmap
node_cmd_builder -->|"builds from"| node_distributions
node_cmd_builder -->|"emits"| node_otelcorecol

click node_otelcol "https://github.com/open-telemetry/opentelemetry-collector/tree/main/otelcol"
click node_otelcorecol "https://github.com/open-telemetry/opentelemetry-collector/tree/main/cmd/otelcorecol"
click node_service "https://github.com/open-telemetry/opentelemetry-collector/tree/main/service"
click node_service_graph "https://github.com/open-telemetry/opentelemetry-collector/tree/main/service/internal/graph"
click node_service_pipelines "https://github.com/open-telemetry/opentelemetry-collector/tree/main/service/pipelines"
click node_confmap "https://github.com/open-telemetry/opentelemetry-collector/tree/main/confmap"
click node_confmap_providers "https://github.com/open-telemetry/opentelemetry-collector/tree/main/confmap/provider"
click node_component "https://github.com/open-telemetry/opentelemetry-collector/tree/main/component"
click node_consumer "https://github.com/open-telemetry/opentelemetry-collector/tree/main/consumer"
click node_pipeline "https://github.com/open-telemetry/opentelemetry-collector/tree/main/pipeline"
click node_receiver "https://github.com/open-telemetry/opentelemetry-collector/tree/main/receiver"
click node_processor "https://github.com/open-telemetry/opentelemetry-collector/tree/main/processor"
click node_exporter "https://github.com/open-telemetry/opentelemetry-collector/tree/main/exporter"
click node_connector "https://github.com/open-telemetry/opentelemetry-collector/tree/main/connector"
click node_scraper "https://github.com/open-telemetry/opentelemetry-collector/tree/main/scraper"
click node_extension "https://github.com/open-telemetry/opentelemetry-collector/tree/main/extension"
click node_pdata "https://github.com/open-telemetry/opentelemetry-collector/tree/main/pdata"
click node_pcommon "https://github.com/open-telemetry/opentelemetry-collector/tree/main/pdata/pcommon"
click node_plog "https://github.com/open-telemetry/opentelemetry-collector/tree/main/pdata/plog"
click node_pmetric "https://github.com/open-telemetry/opentelemetry-collector/tree/main/pdata/pmetric"
click node_ptrace "https://github.com/open-telemetry/opentelemetry-collector/tree/main/pdata/ptrace"
click node_pprofile "https://github.com/open-telemetry/opentelemetry-collector/tree/main/pdata/pprofile"
click node_internal_pdatagen "https://github.com/open-telemetry/opentelemetry-collector/tree/main/internal/cmd/pdatagen"
click node_cmd_mdatagen "https://github.com/open-telemetry/opentelemetry-collector/tree/main/cmd/mdatagen"
click node_cmd_schemagen "https://github.com/open-telemetry/opentelemetry-collector/tree/main/cmd/schemagen"
click node_cmd_builder "https://github.com/open-telemetry/opentelemetry-collector/tree/main/cmd/builder"
click node_distributions "https://github.com/open-telemetry/opentelemetry-collector/tree/main/reports/distributions"
click node_receiver_otlp "https://github.com/open-telemetry/opentelemetry-collector/tree/main/receiver/otlpreceiver"
click node_processor_batch "https://github.com/open-telemetry/opentelemetry-collector/tree/main/processor/batchprocessor"
click node_processor_memory "https://github.com/open-telemetry/opentelemetry-collector/tree/main/processor/memorylimiterprocessor"
click node_exporter_otlpgrpc "https://github.com/open-telemetry/opentelemetry-collector/tree/main/exporter/otlpexporter"
click node_exporter_otlphttp "https://github.com/open-telemetry/opentelemetry-collector/tree/main/exporter/otlphttpexporter"
click node_connector_forward "https://github.com/open-telemetry/opentelemetry-collector/tree/main/connector/forwardconnector"
click node_extension_mem "https://github.com/open-telemetry/opentelemetry-collector/tree/main/extension/memorylimiterextension"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_otelcol,node_otelcorecol,node_service,node_service_graph,node_service_pipelines toneBlue
class node_component,node_consumer,node_pipeline,node_receiver,node_processor,node_exporter,node_connector,node_scraper,node_extension toneAmber
class node_pdata,node_pcommon,node_plog,node_pmetric,node_ptrace,node_pprofile toneMint
class node_confmap,node_confmap_providers toneRose
class node_internal_pdatagen,node_cmd_mdatagen,node_cmd_schemagen,node_cmd_builder,node_distributions toneIndigo
class node_receiver_otlp,node_processor_batch,node_processor_memory,node_exporter_otlpgrpc,node_exporter_otlphttp,node_connector_forward,node_extension_mem toneTeal
```

## Components

### Runtime

Collector execution, service assembly, and distribution binaries.

- [otelcol](https://github.com/open-telemetry/opentelemetry-collector/tree/main/otelcol): collector runtime · Generic CLI/runtime that loads config and runs collector services. · `otelcol`
- [otelcorecol](https://github.com/open-telemetry/opentelemetry-collector/tree/main/cmd/otelcorecol): core binary · Concrete collector distribution built from a fixed component set. · `cmd/otelcorecol`
- [service](https://github.com/open-telemetry/opentelemetry-collector/tree/main/service): orchestration · Turns configuration into running pipelines, extensions, and lifecycle-managed graphs. · `service`
- [graph](https://github.com/open-telemetry/opentelemetry-collector/tree/main/service/internal/graph): wiring core · Builds component graphs, capabilities, fanout, host plumbing, and zPages wiring. · `service/internal/graph`
- [pipelines](https://github.com/open-telemetry/opentelemetry-collector/tree/main/service/pipelines): pipeline config · Assembles signal pipelines from configured receivers, processors, connectors, and exporters. · `service/pipelines`

### Contracts

Shared component interfaces and helper boundaries for the data path.

- [component](https://github.com/open-telemetry/opentelemetry-collector/tree/main/component): runtime contracts · Core component identity, host, telemetry, and status contracts shared across the repo. · `component`
- [consumer](https://github.com/open-telemetry/opentelemetry-collector/tree/main/consumer): signal contract · Signal consumer interfaces and error semantics for downstream delivery. · `consumer`
- [pipeline](https://github.com/open-telemetry/opentelemetry-collector/tree/main/pipeline): signal graph · Shared pipeline abstractions and signal boundary definitions. · `pipeline`
- [receiver](https://github.com/open-telemetry/opentelemetry-collector/tree/main/receiver): ingest boundary · Receiver interfaces and reusable receiver helper contracts. · `receiver`
- [processor](https://github.com/open-telemetry/opentelemetry-collector/tree/main/processor): transform stage · Processor interfaces and helper patterns for in-flight signal transformation. · `processor`
- [exporter](https://github.com/open-telemetry/opentelemetry-collector/tree/main/exporter): output boundary · Exporter interfaces plus helper patterns for delivering signals outward. · `exporter`
- [connector](https://github.com/open-telemetry/opentelemetry-collector/tree/main/connector): bridge boundary · Connectors bridge pipelines by acting as both consumers and producers. · `connector`
- [scraper](https://github.com/open-telemetry/opentelemetry-collector/tree/main/scraper): periodic ingest · Scraper interfaces for periodically collecting metrics and profiles. · `scraper`
- [extension](https://github.com/open-telemetry/opentelemetry-collector/tree/main/extension): out-of-band · Extensions that add service-side capabilities without participating in pipelines. · `extension`

### Data Model

In-memory signal representations and OTLP codecs.

- [pdata](https://github.com/open-telemetry/opentelemetry-collector/tree/main/pdata): signal model · In-memory logs, metrics, traces, and profiles plus OTLP request/response codecs. · `pdata`
- [pcommon](https://github.com/open-telemetry/opentelemetry-collector/tree/main/pdata/pcommon): common model · Shared primitives, resources, IDs, timestamps, and value types. · `pdata/pcommon`
- [plog](https://github.com/open-telemetry/opentelemetry-collector/tree/main/pdata/plog): logs model · Logs data structures, JSON/proto support, and OTLP request wrappers. · `pdata/plog`
- [pmetric](https://github.com/open-telemetry/opentelemetry-collector/tree/main/pdata/pmetric): metrics model · Metrics data structures, aggregation types, and OTLP request wrappers. · `pdata/pmetric`
- [ptrace](https://github.com/open-telemetry/opentelemetry-collector/tree/main/pdata/ptrace): traces model · Trace/span data structures, status types, and OTLP request wrappers. · `pdata/ptrace`
- [pprofile](https://github.com/open-telemetry/opentelemetry-collector/tree/main/pdata/pprofile): profiles model · Profile data structures, dictionaries, and OTLP request wrappers. · `pdata/pprofile`

### Config

Configuration resolution, validation, and typed unmarshaling.

- [confmap](https://github.com/open-telemetry/opentelemetry-collector/tree/main/confmap): config ingestion · Resolves external config sources, merges and validates them, then unmarshals into typed config. · `confmap`
- [providers](https://github.com/open-telemetry/opentelemetry-collector/tree/main/confmap/provider): config sources · File, env, HTTP/HTTPS, and YAML providers for config materialization. · `confmap/provider`

### Generators

Build-time tools and metadata-driven code generation.

- [pdatagen](https://github.com/open-telemetry/opentelemetry-collector/tree/main/internal/cmd/pdatagen): codegen · Generates pdata wrappers, request types, and proto/json helpers from metadata and templates. · `internal/cmd/pdatagen`
- [mdatagen](https://github.com/open-telemetry/opentelemetry-collector/tree/main/cmd/mdatagen): metadata generator · Generates configs, docs, status artifacts, and fixtures from component metadata. · `cmd/mdatagen`
- [schemagen](https://github.com/open-telemetry/opentelemetry-collector/tree/main/cmd/schemagen): schema generator · Builds configuration schemas from Go structs and overlays. · `cmd/schemagen`
- [builder](https://github.com/open-telemetry/opentelemetry-collector/tree/main/cmd/builder): distribution factory · Emits tailored collector binaries from a manifest of selected components. · `cmd/builder`
- [distributions](https://github.com/open-telemetry/opentelemetry-collector/tree/main/reports/distributions): manifest set · Curated distribution definitions for core, contrib, k8s, and otlp builds. · `reports/distributions`

### Components

Concrete receivers, processors, exporters, connectors, extensions, and scrapers.

- [OTLP recv](https://github.com/open-telemetry/opentelemetry-collector/tree/main/receiver/otlpreceiver): receiver impl · OTLP ingest over gRPC/HTTP for logs, metrics, traces, and profiles. · `receiver/otlpreceiver`
- [batch proc](https://github.com/open-telemetry/opentelemetry-collector/tree/main/processor/batchprocessor): processor impl · Batches and splits signals before forwarding downstream. · `processor/batchprocessor`
- [mem limiter](https://github.com/open-telemetry/opentelemetry-collector/tree/main/processor/memorylimiterprocessor): processor impl · Enforces memory pressure limits and sheds load when needed. · `processor/memorylimiterprocessor`
- [OTLP exp](https://github.com/open-telemetry/opentelemetry-collector/tree/main/exporter/otlpexporter): exporter impl · OTLP exporter implementation, primarily gRPC-based. · `exporter/otlpexporter`
- [OTLP HTTP](https://github.com/open-telemetry/opentelemetry-collector/tree/main/exporter/otlphttpexporter): exporter impl · OTLP exporter over HTTP for signal emission. · `exporter/otlphttpexporter`
- [forward](https://github.com/open-telemetry/opentelemetry-collector/tree/main/connector/forwardconnector): connector impl · Forwarding connector for pipeline bridging and fanout flows. · `connector/forwardconnector`
- [mem ext](https://github.com/open-telemetry/opentelemetry-collector/tree/main/extension/memorylimiterextension): extension impl · Memory limiter extension for service-side protection and coordination. · `extension/memorylimiterextension`

## Connections

- confmap → otelcol: loads config · Config resolution feeds the runtime CLI.
- otelcol → service: assembles · The runtime creates services from resolved configuration.
- otelcorecol → service: ships · Concrete distribution binary is built on the same service layer.
- service → graph: wires · Service turns configs into component graphs.
- service → pipelines: builds · Pipeline definitions are instantiated into running data paths.
- graph → receiver: uses · Graph wiring depends on receiver contracts.
- graph → processor: uses · Graph wiring depends on processor contracts.
- graph → exporter: uses · Graph wiring depends on exporter contracts.
- graph → connector: uses · Graph wiring depends on connector contracts.
- graph → extension: uses · Graph wiring includes extensions and host capabilities.
- pipeline → consumer: defines · Pipeline boundaries are built around consumers.
- receiver → consumer: pushes to · Receivers deliver data into consumers.
- processor → consumer: accepts · Processors consume and forward signals.
- exporter → consumer: implements · Exporters present consumer-facing send paths.
- connector → consumer: bridges · Connectors act as consumers on one side of a pipeline.
- connector → pipeline: bridges · Connectors bridge pipelines without flattening the graph.
- scraper → pdata: emits · Scrapers populate pdata-native signal structures.
- pdata → pcommon: shares · Signal types reuse common resource and value primitives.
- pdata → plog: contains · Logs model is a first-class pdata subsystem.
- pdata → pmetric: contains · Metrics model is a first-class pdata subsystem.
- pdata → ptrace: contains · Traces model is a first-class pdata subsystem.
- pdata → pprofile: contains · Profiles model is a first-class pdata subsystem.
- OTLP recv → pdata: decodes to · OTLP receiver converts wire payloads into pdata.
- OTLP exp → pdata: encodes from · OTLP exporter serializes pdata to wire payloads.
- OTLP HTTP → pdata: encodes from · HTTP exporter serializes pdata to wire payloads.
- batch proc → pdata: rewrites · Batch processor groups pdata before downstream delivery.
- mem limiter → graph: protects · Memory limiter participates in service-level protection.
- mem ext → service: extends · Extension augments service behavior outside pipelines.
- pdatagen → pdata: generates · Generator materializes pdata types and codecs.
- mdatagen → component: generates metadata · Metadata generator produces component docs, configs, and status artifacts.
- schemagen → confmap: generates schemas · Schema generator supports typed config ingestion.
- builder → distributions: builds from · Distribution builder consumes curated component manifests.
- builder → otelcorecol: emits · Builder produces tailored binaries such as the core collector.
