에이전트 배포 패턴 (Agent deployment pattern)
신호를 Collector로 보낸 뒤 백엔드로 내보내요.
출처: 문서
본문
신호를 Collector로 보낸 뒤 백엔드로 내보내요.
에이전트 배포 패턴에서 텔레메트리 신호는 다음에서 발생할 수 있어요.
- OpenTelemetry 프로토콜(OTLP)을 사용하는 OpenTelemetry SDK로 계측된 애플리케이션
- OTLP 내보내기를 사용하는 Collector
신호는 애플리케이션과 함께 또는 같은 호스트에서 실행되는 Collector 인스턴스(사이드카나 데몬셋 등)로 보내져요.
각 클라이언트 측 SDK나 하위 Collector는 Collector 인스턴스의 주소로 구성되어요.
- 애플리케이션에서 SDK는 OTLP 데이터를 Collector로 보내도록 구성돼요.
- Collector는 텔레메트리 데이터를 하나 이상의 백엔드로 보내도록 구성돼요.
예시 (Example)
이 에이전트 배포 패턴 예시에서는 먼저 기본 OTEL_METRICS_EXPORTER 값인 otlp을 포함해 OpenTelemetry Java SDK로 Java 애플리케이션을 수동 계측하여 메트릭을 내보내는 것부터 시작해요. 다음으로 OTLP 내보내기를 내 Collector 주소로 구성해요. 예를 들면 다음과 같아요.
export OTEL_EXPORTER_OTLP_ENDPOINT=http://collector.example.com:4318
다음으로 collector.example.com:4318에서 실행되는 Collector를 다음과 같이 구성해요.
- Trace
- 메트릭
- 로그
receivers:
otlp: # the OTLP receiver the app is sending traces to
protocols:
http:
endpoint: 0.0.0.0:4318
exporters:
otlp/jaeger: # Jaeger supports OTLP directly
endpoint: https://jaeger.example.com:4317
sending_queue:
batch:
service:
pipelines:
traces/dev:
receivers: [otlp]
exporters: [otlp/jaeger]
receivers:
otlp: # the OTLP receiver the app is sending metrics to
protocols:
http:
endpoint: 0.0.0.0:4318
exporters:
prometheus_remote_write: # the PRW exporter, to ingest metrics to backend
endpoint: https://prw.example.com/v1/api/remote_write
sending_queue:
batch:
service:
pipelines:
metrics/prod:
receivers: [otlp]
exporters: [prometheus_remote_write]
receivers:
otlp: # the OTLP receiver the app is sending logs to
protocols:
http:
endpoint: 0.0.0.0:4318
exporters:
file: # the File Exporter, to ingest logs to local file
path: ./app42_example.log
rotation:
service:
pipelines:
logs/dev:
receivers: [otlp]
exporters: [file]
이 패턴을 처음부터 끝까지 살펴보려면 Java 또는 Python 예시를 참고하세요.
장단점 (Trade-offs)
에이전트 Collector를 사용할 때의 주요 장단점은 다음과 같아요.
장점:
- 시작하기가 간단해요
- 애플리케이션과 Collector 사이에 명확한 일대일 대응이 있어요
단점:
- 팀과 인프라 리소스에 대한 확장성이 제한돼요
- 복잡하거나 진화하는 배포에 유연하지 않아요