-
Notifications
You must be signed in to change notification settings - Fork 110
docs: add OTel Collector Config doc #2050
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
Merged
Merged
Changes from 2 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
63f2285
docs: add OTel Collector Config doc
crazyuploader f15aaa9
chore: Update OTel Collector Configuration doc
crazyuploader c934abd
docs: move and refine OpenTelemetry Collector config guide
crazyuploader becbe19
docs: Update OTel Collector Config doc location
crazyuploader b79258e
docs: Add illustration for OTel Collector Config doc
crazyuploader 53f6e7e
docs: fix spelling mistakes, and grammar
crazyuploader 44d8de7
Add tags
crazyuploader 0b0496e
docs: Addressed review comments in OpenTelemetry Collector Configuration
crazyuploader 6285d7a
Merge branch 'main' into docs/add-otel-config-doc
crazyuploader 614a917
docs: Fix SVG image size
crazyuploader 49092ca
docs: Update OpenTelemetry Collector Configuration
crazyuploader File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,346 @@ | ||
| --- | ||
| date: 2025-10-08 | ||
| id: otel-collector-config | ||
| title: OpenTelemetry Collector Configuration Explained in Detail | ||
| --- | ||
|
|
||
| import GetHelp from '@/components/shared/get-help.md' | ||
|
|
||
| ## Overview | ||
|
|
||
| The OpenTelemetry (OTel) Collector is a vendor-agnostic telemetry data pipeline that receives, processes, and exports traces, metrics and logs. This guide helps you understand the various concepts of OTel Collector and helps you configure it. | ||
|
|
||
| ## What is OpenTelemetry Collector? | ||
|
|
||
| The OpenTelemetry Collector acts as a central hub or agent for telemetry data with three key capabilities: | ||
|
|
||
| - **Receive:** Telemetry data in multiple formats (OTLP, Jaeger, Prometheus, Zipkin, etc.) | ||
| - **Process:** Data through transformation, filtering | ||
| - **Export:** To one or more observability backends | ||
|
|
||
| ## OTel Collector Configuration Structure | ||
|
|
||
| The collector uses a YAML configuration file with 5 main components: | ||
|
|
||
| 1. [Receivers](#1-receivers) - Defines how data enters the collector | ||
| 2. [Processors](#2-processors) - Transforms and filters data | ||
| 3. [Exporters](#3-exporters) - Send data to backends | ||
| 4. [Extensions](#4-extensions) - Offer additional capabilities | ||
| 5. [Service](#5-service) - Connect components with pipelines | ||
|
|
||
| ### Basic Configuration Example | ||
|
|
||
| ```yaml | ||
| receivers: | ||
| otlp: | ||
| protocols: | ||
| grpc: | ||
| endpoint: 0.0.0.0:4317 | ||
| http: | ||
| endpoint: 0.0.0.0:4318 | ||
| processors: | ||
| batch: | ||
|
|
||
| exporters: | ||
| otlp: | ||
| endpoint: otelcol:4317 | ||
|
|
||
| extensions: | ||
| health_check: | ||
| endpoint: 0.0.0.0:13133 | ||
| pprof: | ||
| endpoint: 0.0.0.0:1777 | ||
| zpages: | ||
| endpoint: 0.0.0.0:55679 | ||
|
|
||
| service: | ||
| extensions: [health_check, pprof, zpages] | ||
| pipelines: | ||
| traces: | ||
| receivers: [otlp] | ||
| processors: [batch] | ||
| exporters: [otlp] | ||
| metrics: | ||
| receivers: [otlp] | ||
| processors: [batch] | ||
| exporters: [otlp] | ||
| logs: | ||
| receivers: [otlp] | ||
| processors: [batch] | ||
| exporters: [otlp] | ||
| ``` | ||
|
|
||
| ## Core Components | ||
|
|
||
| ### 1. Receivers | ||
|
|
||
| Receivers define how telemetry data enters the OTel Collector. Receivers can collect telemetry data from one or more sources and they can be pull or push based. Each receiver listens on a network endpoint, or scrapes metrics from targets. | ||
|
|
||
| #### OTLP Receiver | ||
|
|
||
| The native OpenTelemetry protocol receiver which supports both gRCP and HTTP. | ||
|
|
||
| ```yaml | ||
| receivers: | ||
| otlp: | ||
| protocols: | ||
| grpc: | ||
| endpoint: '0.0.0.0:4317' | ||
| http: | ||
| endpoint: '0.0.0.0:4318' | ||
| ``` | ||
|
|
||
| #### Prometheus Receiver | ||
|
|
||
| This receiver scrapes metrics from endpoints which are Prometheus compatible. This is a **pull** based receiver, it actively scrapes metrics from targets instead of listening for incoming data. | ||
|
|
||
| ```yaml | ||
| receivers: | ||
| prometheus: | ||
| config: | ||
| scrape_configs: | ||
| - job_name: 'node-exporter' | ||
| scrape_interval: 30s | ||
| static_configs: | ||
| - targets: ['localhost:9100'] | ||
| ``` | ||
|
|
||
| #### Jaeger Receiver | ||
|
|
||
| This receiver accepts traces in Jaeger formats (Thrift, gRPC, HTTP). | ||
|
|
||
| ```yaml | ||
| receivers: | ||
| jaeger: | ||
| protocols: | ||
| grpc: | ||
| endpoint: 0.0.0.0:14250 | ||
| thrift_http: | ||
| endpoint: 0.0.0.0:14268 | ||
| ``` | ||
|
|
||
| #### Zipkin Receiver | ||
|
|
||
| This receiver accepts trace data in Zipkin format. | ||
|
|
||
| ```yaml | ||
| receivers: | ||
| zipkin: | ||
| endpoint: 0.0.0.0:9411 | ||
| ``` | ||
|
|
||
| A full list of receivers can be obtained from [opentelemetry-collector](https://github.com/open-telemetry/opentelemetry-collector/tree/main/receiver) and [opentelemetry-collector-contrib](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/receiver). | ||
|
|
||
| ### 2. Processors | ||
|
|
||
| Processors are used to transform, filter, or enrich telemetry data between receivers and exporters. | ||
|
|
||
| #### Batch Processor | ||
|
|
||
| This processor batches telemetry data to reduce network overhead and improve throughput. | ||
|
|
||
| ```yaml | ||
| processors: | ||
| batch: | ||
| timeout: 10s # Max time before sending batch | ||
| send_batch_size: 1024 # Send when batch reaches this size | ||
| send_batch_max_size: 2048 # Maximum batch size limit | ||
| ``` | ||
|
|
||
| #### Memory Limiter | ||
|
|
||
| This processor prevents out-of-memory (OOM) errors by checking memory usage of the collector. | ||
crazyuploader marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| ```yaml | ||
| processors: | ||
| memory_limiter: | ||
| check_interval: 5s # How often to check memory | ||
| limit_mib: 4000 # Hard memory limit | ||
| spike_limit_mib: 800 # Additional headroom for spikes | ||
| ``` | ||
|
|
||
| #### Resource Processor | ||
|
|
||
| This processor adds, updates or removes resource attributes on telemetry data. | ||
crazyuploader marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| ```yaml | ||
| processors: | ||
| resource: | ||
| attributes: | ||
| - key: environment | ||
| value: production | ||
| action: upsert # Always set environment=production | ||
| - key: team | ||
| value: backend | ||
| action: insert # Only add if not already present | ||
| - key: internal.debug | ||
| action: delete # Remove this attribute | ||
| - key: user.id | ||
| action: hash # Hash PII data | ||
| ``` | ||
|
|
||
| #### Attributes Processor | ||
|
|
||
| This processor modifies span, log, or metric attributes. | ||
crazyuploader marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| ```yaml | ||
| processors: | ||
| attributes: | ||
| actions: | ||
| - key: http.url | ||
| action: delete # Remove sensitive URLs | ||
| - key: db.statement | ||
| action: hash # Hash SQL queries | ||
| ``` | ||
|
|
||
| #### Filter Processor | ||
|
|
||
| This processor drops telemetry data based on conditions. | ||
crazyuploader marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| ```yaml | ||
| processors: | ||
| filter: | ||
| error_mode: ignore | ||
| traces: | ||
| span: | ||
| - attributes["http.status_code"] == 200 # Drop successful health checks | ||
| ``` | ||
|
|
||
| A full list of processors can be obtained from [opentelemetry-collector](https://github.com/open-telemetry/opentelemetry-collector/tree/main/processor) and [opentelemetry-collector-contrib](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/processor). | ||
|
|
||
| ### 3. Exporters | ||
|
|
||
| Exporters send processed telemetry data to observability backends. You can configure multiple exporters to send data to various backends. | ||
|
|
||
| #### OTLP gRPC Exporter | ||
|
|
||
| Exports data via gRPC using OpenTelemetry protocol. | ||
|
|
||
| ```yaml | ||
| exporters: | ||
| otlp: | ||
| endpoint: 'ingest.<region>.signoz.cloud:443' | ||
| tls: | ||
| insecure: false | ||
| headers: | ||
| 'signoz-ingestion-key': '<your-ingestion-key>' | ||
| ``` | ||
|
|
||
| #### OTLP/HTTP Exporter | ||
|
|
||
| Exports data via HTTP using OpenTelemetry protocol. | ||
|
|
||
| ```yaml | ||
| exporters: | ||
| otlphttp: | ||
| endpoint: 'https://ingest.<region>.signoz.cloud:443' | ||
| tls: | ||
| insecure: false | ||
| headers: | ||
| 'signoz-ingestion-key': '<your-ingestion-key>' | ||
| ``` | ||
|
|
||
| #### Debug Exporter | ||
|
|
||
| Logs telemetry data to console for debugging purposes. | ||
|
|
||
| ```yaml | ||
| exporters: | ||
| debug: | ||
| verbosity: detailed | ||
| ``` | ||
|
|
||
| #### Prometheus Exporter | ||
|
|
||
| Exposes metrics in Prometheus format which can be scraped at configured endpoints. | ||
|
|
||
| ```yaml | ||
| exporters: | ||
| prometheus: | ||
| endpoint: 0.0.0.0:8889 | ||
| namespace: otel | ||
| ``` | ||
|
|
||
| A full list of exporters can be obtained from [opentelemetry-collector](https://github.com/open-telemetry/opentelemetry-collector/tree/main/exporter) and [opentelemetry-collector-contrib](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/exporter). | ||
|
|
||
| ### 4. Extensions | ||
|
|
||
| Extensions are additional components which add capabilities to the collector without directly processing telemetry data. | ||
|
|
||
| #### Health Check Extension | ||
|
|
||
| Provides an HTTP endpoint for health checks. | ||
crazyuploader marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| ```yaml | ||
| extensions: | ||
| health_check: | ||
| endpoint: 0.0.0.0:13133 | ||
| path: /health | ||
| ``` | ||
|
|
||
| #### pprof Extension | ||
|
|
||
| Enables Go profiling for performance analysis. | ||
|
|
||
| ```yaml | ||
| extensions: | ||
| pprof: | ||
| endpoint: 0.0.0.0:1777 | ||
| ``` | ||
|
|
||
| #### zpages Extension | ||
|
|
||
| Provides live debugging pages showing pipeline activity. | ||
|
|
||
| ```yaml | ||
| extensions: | ||
| zpages: | ||
| endpoint: 0.0.0.0:55679 | ||
| ``` | ||
|
|
||
| Access the extension pages at `http://localhost:55679/debug/tracez` and `/debug/pipelinez` | ||
|
|
||
| A full list of extensions can be obtained from [opentelemetry-collector](https://github.com/open-telemetry/opentelemetry-collector/tree/main/extension) and [opentelemetry-collector-contrib](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/extension). | ||
|
|
||
| ### 5. Service | ||
crazyuploader marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| Service section defines pipelines that connect components with each other. Each pipeline defines the flow of data through receivers, processors, and exporters. | ||
|
|
||
| #### Pipeline Types | ||
|
|
||
| - traces | ||
| - metrics | ||
| - logs | ||
|
|
||
| #### Pipeline Structure | ||
|
|
||
| ```yaml | ||
| service: | ||
| extensions: [health_check, pprof, zpages] | ||
| pipelines: | ||
| traces: | ||
| receivers: [otlp] | ||
| processors: [memory_limiter, batch] | ||
| exporters: [otlp, debug] | ||
|
|
||
| metrics: | ||
| receivers: [otlp, prometheus] | ||
| processors: [memory_limiter, batch] | ||
| exporters: [otlp, debug, prometheus] | ||
|
|
||
| logs: | ||
| receivers: [otlp] | ||
| processors: [memory_limiter, batch] | ||
| exporters: [otlp, debug] | ||
| ``` | ||
|
|
||
| ## Best Practices | ||
crazyuploader marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| 1. **Always use batch processor:** Improves performance and reduces load on backend | ||
crazyuploader marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
crazyuploader marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| 2. **Place memory_limiter first:** Protects collector from OOM crashes | ||
| 3. **Monitor collector health:** Use `health_check` and `zpages` extensions | ||
crazyuploader marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| 4. **Test configuration:** Use `--dry-run` flag to validate configuration before deployment | ||
crazyuploader marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| ## Get Help | ||
|
|
||
| <GetHelp /> | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.