You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Airflow 2.9.0 OTel集成:任务实例状态指标未显示在Prometheus

问题

我正在使用集成了OpenTelemetry指标的Airflow 2.9.0,尽管任务实例创建指标能正常显示,但ti.start这类任务实例状态指标却未出现在Prometheus中。

环境配置

我的组件包括:

  • 采用Celery执行器的Airflow 2.9.0
  • OpenTelemetry Collector
  • 用于存储指标的Prometheus
  • 用于可视化的Grafana

Docker Compose配置(相关部分)

services:
  webserver:
    environment:
      - AIRFLOW__METRICS__OTEL_ON=True
      - AIRFLOW__METRICS__STATSD_ON=False
      - AIRFLOW__METRICS__OTEL_HOST=otel-collector
      - AIRFLOW__METRICS__OTEL_PORT=4318
      - AIRFLOW__METRICS__OTEL_EXPORTER_OTLP_ENDPOINT=http://otel-collector:4318
      - AIRFLOW__METRICS__OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf
      - AIRFLOW__METRICS__OTEL_RESOURCE_ATTRIBUTES=service.name=airflow
      - AIRFLOW__METRICS__OTEL_METRICS_EXPORTER=otlp
      - AIRFLOW__METRICS__METRICS_USE_PATTERN_MATCH=True
      - AIRFLOW__METRICS__METRICS_OTEL_SSL_ACTIVE=False
      - AIRFLOW__METRICS__OTEL_DEBUGGING_ON=True
      - AIRFLOW__METRICS__METRICS_ALLOW_LIST=ti|task

  otel-collector:
    image: otel/opentelemetry-collector-contrib:latest
    command: ["--config=/etc/otel-collector-config.yaml", "--set=service.telemetry.logs.level=debug"]
    volumes:
      - ./otel-collector-config.yaml:/etc/otel-collector-config.yaml

OpenTelemetry Collector配置

receivers:
  otlp:
    protocols:
      http:
        endpoint: 0.0.0.0:4318

processors:
  batch:
  filter:
    metrics:
      include:
        match_type: regexp
        metric_names:
          - "task_instance.*"
          - "airflow.*task.*state.*"
          - "airflow.*task.*status.*"

exporters:
  prometheus:
    endpoint: 0.0.0.0:8889

service:
  pipelines:
    metrics:
      receivers: [otlp]
      processors: [filter, batch]
      exporters: [prometheus]

当前排查进展

我能在Prometheus中看到任务实例创建指标:

airflow_task_instance_created_pythonoperator_total
airflow_task_instance_created_dbtoperator_total
airflow_task_instance_created_total

已尝试操作

  • 在OTel Collector中启用debugging模式
  • 检查Airflow日志中与指标相关的错误
  • 验证METRICS_ALLOW_LIST已包含ti|task
  • 查看Collector日志中的指标数据

疑问

  1. 为何其他任务实例指标正常,而ti.start等状态及状态转换指标未出现在Prometheus?
  2. 哪些因素可能过滤了这些特定的状态相关指标?
  3. 捕获任务实例状态指标是否缺少特定配置?
  4. 如何验证这些指标是否已发送至Collector?

内容的提问来源于stack exchange,提问作者RSNboim

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.13 19:47:03