Grafana 系列-统一展示-2-Prometheus 数据源

2023-05-06  本文已影响0人  东风微鸣

系列文章

Grafana Prometheus 数据源

Grafana 提供了对 Prometheus 的内置支持。本文会介绍 Grafana Prometheus(也包括 Prometheus 的兼容实现,如 Thanos, Mimir 等) 数据源的部分选项、变量 (Variable)、查询 (Query) 和其他针对 Prometheus 数据源的功能。

配置 Prometheus 数据源

这里选择几项重要的部分进行说明:

配置 Exemplars

📝Note:

在 Prometheus v2.26 及以上版本与 Grafana v7.4 及以上版本中可用。
前文 所述,Exemplars 用途是用于在 Metric -> Traces 无缝跳转。

Grafana 7.4 及更高版本可以在 "Explore" 和 "Dashboards" 中显示 Exemplars 数据与指标。Exemplars 数据将来自特定事件的 higher-cardinality metadata 与传统的时间序列数据联系起来。

Exemplars 细节截图

Prometheus YAML 配置示例

典型示例如下:(基于 Grafana 9)

apiVersion: 1

datasources:
  - name: Prometheus
    type: prometheus
    # Access mode - proxy (server in the UI) or direct (browser in the UI).
    access: proxy
    url: http://localhost:9090
    jsonData:
      httpMethod: POST
      manageAlerts: true
      prometheusType: Prometheus
      prometheusVersion: 2.37.0
      cacheLevel: 'High'
      exemplarTraceIdDestinations:
        # Field with internal link pointing to data source in Grafana.
        # datasourceUid value can be anything, but it should be unique across all defined data source uids.
        - datasourceUid: my_jaeger_uid
          name: traceID

        # Field with external link.
        - name: traceID
          url: 'http://localhost:3000/explore?orgId=1&left=%5B%22now-1h%22,%22now%22,%22Jaeger%22,%7B%22query%22:%22$${__value.raw}%22%7D%5D'

EOF

三人行, 必有我师; 知识共享, 天下为公. 本文由东风微鸣技术博客 EWhisper.cn 编写.

上一篇 下一篇

猜你喜欢

热点阅读