Link Search Menu Expand Document Documentation Menu

从追踪中派生指标

您可以使用 OpenSearch Data Prepper 从 OpenTelemetry 跟踪数据中派生指标。以下示例管道接收传入的跟踪数据,并提取一个名为 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"

剩余 350 字符

有问题?

想要贡献?