Deriving metrics from traces
출처: 문서
본문
트레이스에서 메트릭 추출하기
OpenTelemetry 트레이스에서 메트릭을 추출하려면 OpenSearch Data Prepper를 사용할 수 있어요. 다음 예제 파이프라인은 들어오는 트레이스를 받아서 durationInNanos라는 메트릭을 추출하는데, 이 메트릭은 30초 텀블링 윈도우 기준으로 집계돼요. 그런 다음 들어오는 트레이스로부터 히스토그램을 도출해요.
이 파이프라인은 다음과 같은 파이프라인들로 구성돼요:
-
entry-pipeline– OpenTelemetry 컬렉터로부터 트레이스 데이터를 받아서trace_to_metrics_pipeline파이프라인으로 전달해요. -
trace-to-metrics-pipeline-entry-pipeline파이프라인으로부터 트레이스 데이터를 받아서 집계하고,serviceName필드 값을 기준으로 트레이스에서durationInNanos히스토그램을 도출해요. 그런 다음 도출된 메트릭을metrics_for_traces라는 OpenSearch 인덱스로 보내요.
entry-pipeline:
source:
otel_trace_source:
# Provide the path for ingestion. ${pipelineName} will be replaced with pipeline name.
# In this case it would be "/entry-pipeline/v1/traces". This will be endpoint URI path in OpenTelemetry Exporter configuration.
path: "/${pipelineName}/v1/traces"
sink:
- pipeline:
name: "trace-to-metrics-pipeline"
trace-to-metrics-pipeline:
source:
pipeline:
name: "entry-pipeline"
processor:
- aggregate:
# Pick the required identification keys
identification_keys: ["serviceName"]
action:
histogram:
# Pick the appropriate values for each of the following fields
key: "durationInNanos"
record_minmax: true
units: "seconds"
buckets: [0, 10000000, 50000000, 100000000]
# Specify an aggregation period
group_duration: "30s"
sink:
- opensearch:
...
index: "metrics_for_traces"
{% include copy-curl.html %}