상위: OpenTelemetry
요약
OTel Collector는 텔레메트리 데이터를 수신(Receive) → 처리(Process) → 내보내기(Export) 하는 중앙 파이프라인이다. 애플리케이션과 관측성 백엔드 사이에 위치하며, 벤더 중립적으로 데이터를 라우팅한다. 선택 사항이지만, 프로덕션에서는 거의 필수로 사용한다.
파이프라인 구조
Receiver(s) → Processor(s) → Exporter(s)
하나의 Collector에 여러 파이프라인을 정의할 수 있고, 각 파이프라인은 traces/metrics/logs 중 하나의 신호 타입을 처리한다.
구성 요소
Receiver (수신기)
데이터가 Collector로 들어오는 입구. Push 또는 Pull 방식.
| Receiver | 설명 |
|---|---|
otlp | OTLP 프로토콜 (gRPC/HTTP). 가장 기본 |
prometheus | Prometheus 메트릭 스크래핑 |
jaeger | Jaeger 포맷 수신 |
filelog | 로그 파일 tail |
hostmetrics | 호스트 CPU, 메모리, 디스크 수집 |
Processor (처리기)
수신된 데이터를 변환·필터·보강한다.
| Processor | 설명 |
|---|---|
batch | 데이터를 배치로 묶어 전송 (성능 최적화) |
filter | 조건에 맞지 않는 데이터 제거 |
attributes | 속성 추가/삭제/변환 |
resource | 리소스 속성 추가 (서비스명, 환경 등) |
tail_sampling | 트레이스 완료 후 샘플링 결정 |
memory_limiter | 메모리 사용량 제한 (OOM 방지) |
Exporter (내보내기)
처리된 데이터를 외부 백엔드로 전송한다.
| Exporter | 설명 |
|---|---|
otlp | OTLP 호환 백엔드로 전송 |
prometheus | Prometheus가 스크래핑할 엔드포인트 노출 |
jaeger | Jaeger로 트레이스 전송 |
elasticsearch | Elasticsearch로 로그 전송 |
debug | 디버깅용 콘솔 출력 |
설정 예시
# otel-collector-config.yaml
receivers:
otlp:
protocols:
grpc:
endpoint: 0.0.0.0:4317
http:
endpoint: 0.0.0.0:4318
prometheus:
config:
scrape_configs:
- job_name: 'my-app'
scrape_interval: 15s
static_configs:
- targets: ['app:8080']
processors:
batch:
timeout: 5s
send_batch_size: 1000
memory_limiter:
check_interval: 1s
limit_mib: 512
attributes:
actions:
- key: environment
value: production
action: upsert
exporters:
otlp:
endpoint: tempo:4317 # Traces → Grafana Tempo
tls:
insecure: true
prometheus:
endpoint: 0.0.0.0:8889 # Metrics → Prometheus scrape
elasticsearch:
endpoints: ["http://es:9200"] # Logs → Elasticsearch
service:
pipelines:
traces:
receivers: [otlp]
processors: [memory_limiter, batch]
exporters: [otlp]
metrics:
receivers: [otlp, prometheus]
processors: [memory_limiter, batch, attributes]
exporters: [prometheus]
logs:
receivers: [otlp]
processors: [memory_limiter, batch]
exporters: [elasticsearch]
배포 패턴
Agent 모드
각 호스트/Pod에 사이드카로 배포. 애플리케이션과 가까운 곳에서 데이터를 수집하고 가벼운 처리 후 중앙으로 전송.
[App] → [Collector Agent (사이드카)] → [중앙 Collector] → [Backend]
Gateway 모드
중앙 집중형. 여러 애플리케이션에서 하나의 Collector로 데이터를 보냄. 라우팅, 집계, 필터링 등 무거운 처리 담당.
[App 1] ─┐
[App 2] ─┼→ [Collector Gateway] → [Backend]
[App 3] ─┘
권장: Agent + Gateway 조합
[App] → [Agent] → [Gateway] → [Backend(s)]
로컬 배치 라우팅/필터링 저장/시각화
- Agent: 로컬 배치 처리, 메모리 제한, 기본 속성 추가
- Gateway: 라우팅, 샘플링, 집계, 멀티 백엔드 내보내기
Collector 배포판
| 배포판 | 설명 |
|---|---|
| Core | 최소 구성. 핵심 Receiver/Processor/Exporter만 포함 |
| Contrib | 커뮤니티 기여 컴포넌트 포함. 대부분의 벤더 통합 |
| Custom | OCB(OpenTelemetry Collector Builder)로 필요한 컴포넌트만 선택 빌드 |
프로덕션에서는 필요한 컴포넌트만 포함한 Custom 빌드를 권장한다. 공격 표면과 바이너리 크기를 줄일 수 있다.
관련 개념
- OTel Signals: Collector가 처리하는 세 가지 텔레메트리 신호
- OTel Instrumentation: Collector로 데이터를 보내는 계측 방법