Distributed Trace Pipeline: Tail Sampling에서 Tempo Service Graph까지
Application OTLP 수신
섹션 제목: “Application OTLP 수신”otel-apps Deployment는 application이 보내는 OTLP trace/metric/log를 모두 받지만, 세 signal의 pipeline은 receiver 단계 이후 곧바로 분리된다. trace pipeline만 별도 processor chain을 거친다.
processor 순서
섹션 제목: “processor 순서”processors: tail_sampling: decision_wait: 10s policies: - name: latency-policy type: latency latency: { threshold_ms: 500 } - name: error-policy type: status_code status_code: { status_codes: [ERROR] } - name: probabilistic-policy type: probabilistic probabilistic: { sampling_percentage: 5 } memory_limiter: check_interval: 5s limit_percentage: 80 resource: attributes: - key: service.instance.id action: insert from_attribute: k8s.pod.uid batch: send_batch_size: 512 timeout: 5s순서는 tail_sampling → memory_limiter → resource/transform → batch다. tail sampling이 가장 먼저 오는 이유는, sampling 결정 이후의 나머지 processor가 실제로 보낼 span만 처리하도록 해서 불필요한 연산을 줄이기 위해서다.
실제 tail sampling policy
섹션 제목: “실제 tail sampling policy”| Policy | 조건 | 목적 | 보존 여부 |
|---|---|---|---|
| latency-policy | latency ≥ 500ms | 느린 요청 우선 확보 | 100% 보존 |
| error-policy | status = Error | 장애 원인 분석 | 100% 보존 |
| probabilistic-policy | 나머지 정상 요청 | baseline 성능 파악 | 5% 샘플링 |
policy는 OR 조건으로 평가된다. 세 조건 중 하나라도 만족하면 해당 trace는 Tempo로 전달된다.
기존 글 오류 수정
섹션 제목: “기존 글 오류 수정”기존 통합 Observability 글에는 “정상 10% 수집”이라는 서술이 있었다. 실제 배포된 otel-apps manifest의 probabilistic_policy.sampling_percentage 값은 5다. 이 글부터는 5%를 정확한 값으로 명시한다.
Tempo Distributed write/query path
섹션 제목: “Tempo Distributed write/query path”- distributor → ingester → Azure Blob 경로로 write되며, compactor가 168h retention을 기준으로 오래된 block을 정리한다.
- query-frontend/querier가 조회를 처리하고, gateway는 활성화돼 있지만 multitenancy는 비활성 상태다.
Trace에서 Metric으로: spanmetrics와 service graph
섹션 제목: “Trace에서 Metric으로: spanmetrics와 service graph”sampling된 trace만 Tempo에 저장되지만, metric 파생은 sampling 이전 시점의 모든 span을 대상으로 한다. otel-apps의 spanmetrics connector가 모든 수신 span에서 request count/latency/error rate 지표를 뽑아 Mimir로 remote write하고, 별도로 Tempo의 Metrics Generator가 service_graphs와 span_metrics, local blocks processor를 사용해 서비스 간 호출 관계를 metric으로 만든다.
# Tempo Metrics Generator 설정 (일반화)metrics_generator: processors: - service-graphs - span-metrics - local-blocks registry: external_labels: source: tempo storage: remote_write: - url: http://mimir-gateway.mimir.svc.cluster.local/api/v1/push이 구조 덕분에 sampling된 5%의 trace만 남아도, 서비스 전체의 request rate/error rate/서비스 맵은 100% span 기준으로 정확하게 유지된다.
Correlation
섹션 제목: “Correlation”Grafana의 Tempo datasource는 trace ID를 기준으로 logs/metrics/profile로 이동할 수 있는 correlation 설정을 갖고 있다. 이 부분은 5편 Dashboard 글에서 datasource 설정과 함께 자세히 다룬다. 여기서는 trace가 service map/node graph의 근거 데이터가 된다는 점만 짚는다.
failure/scale trade-off
섹션 제목: “failure/scale trade-off”- tail sampling은 stateful하다: 하나의 trace에 속한 모든 span이 같은 Collector instance에 도착해야 sampling 결정을 내릴 수 있다.
service.name또는traceID기준 hashing 없이otel-apps를 단순 horizontal scale-out하면 같은 trace의 span이 서로 다른 인스턴스로 흩어져 decision이 깨질 수 있다. - single-replica 개발환경의 제약: 현재
otel-apps가 단일 replica이기 때문에 이 문제가 아직 드러나지 않는다. replica를 늘리려면 trace affinity(동일 trace를 동일 인스턴스로 라우팅하는 load balancing exporter 등)를 먼저 도입해야 한다.
다음 글
섹션 제목: “다음 글”Dashboard와 correlation은 Grafana Dashboard 운영: Signal Correlation과 GitOps Boundary에서 이어진다.