如何在 ingress-nginx 中为舞会指标添加标头标签

问题描述 投票:0回答:1

团队我想从 ingress nginx 添加为 Mertic http_requests_total 中的标签标头,有没有可能的方法?

kubernetes prometheus kubernetes-ingress ingress-nginx
1个回答
0
投票

如果您使用 helm 部署,您可以从可用的 helm 值中检查 ServiceMonitor


prometheus-windows-exporter:
  ## Enable ServiceMonitor and set Kubernetes label to use as a job label
  ##
  prometheus:
    monitor:
      enabled: true
      jobLabel: jobLabel

  releaseLabel: true

  ## Set job label to 'windows-exporter' as required by the default Prometheus rules and Grafana dashboards
  ##
  podLabels:
    jobLabel: windows-exporter

  ## Enable memory and container metrics as required by the default Prometheus rules and Grafana dashboards
  ##
  config: |-
    collectors:
      enabled: '[defaults],memory,container'

## Configuration for alertmanager
## ref: https://prometheus.io/docs/alerting/alertmanager/
##

您还可以为要监控的端点配置ServiceMonitor,如下所示:

apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
  name: example-app
  labels:
    team: frontend
spec:
  selector:
    matchLabels:
      app: example-app
  endpoints:
  - port: web
最新问题
© www.soinside.com 2019 - 2025. All rights reserved.