设置为 Prometheus 数据源以发出日志计数警报的 Loki 配置错误,出现 404 错误

Loki that is set up as Prometheus datasource in order to have alerts on log counts, is wrongly configured, getting 404 error

我们在 kube-prometheus-stack helm chart 中添加了两次 Loki 作为 grafana 的附加数据源,第一次是 loki 类型,第二次是 prometheus 类型,第二次是只有 hack 允许 grafana 收到来自 loki 的警报:

grafana:
  ## Configure additional grafana datasources (passed through tpl)
  ## ref: http://docs.grafana.org/administration/provisioning/#datasources
  additionalDataSources:
    - name: Loki
      type: loki
      access: proxy
      url: http://loki.monitoring.svc.cluster.local:3100
      jsonData:
        maxLines: 1000
    - name: LokiAsPrometheus
      type: prometheus
      access: proxy
      url: http://loki.monitoring.svc.cluster.local:3100
      jsonData:
        maxLines: 1000

但是当我创建一个新的仪表板并 select LokiAsPromtheus 作为数据源时,grafana http 响应响应错误,就像配置错误一样。

/loki 资源作为 loki-as-prometheus url 的一部分是至关重要的:

grafana:
  ## Configure additional grafana datasources (passed through tpl)
  ## ref: http://docs.grafana.org/administration/provisioning/#datasources
  additionalDataSources:
    - name: Loki
      type: loki
      access: proxy
      url: http://loki.monitoring.svc.cluster.local:3100
      jsonData:
        maxLines: 1000
    - name: LokiAsPrometheus
      type: prometheus
      access: proxy
      url: http://loki.monitoring.svc.cluster.local:3100/loki
      jsonData:
        maxLines: 1000