- job_name: 'nginx-plus-ingress'
  kubernetes_sd_configs:
    - role: pod
  relabel_configs:
    - source_labels: [__meta_kubernetes_pod_label_nsm_nginx_com_enable_ingress, __meta_kubernetes_pod_label_nsm_nginx_com_enable_egress]
      action: keep
      regex: .*true.*
    - source_labels: [__meta_kubernetes_pod_annotation_prometheus_io_scrape]
      action: keep
      regex: true
    - source_labels: [__address__, __meta_kubernetes_pod_annotation_prometheus_io_port]
      action: replace
      target_label: __address__
      regex: (.+)(?::\d+);(\d+)
      replacement: $1:$2
    - source_labels: [__meta_kubernetes_namespace]
      action: replace
      target_label: namespace
    - source_labels: [__meta_kubernetes_pod_name]
      action: replace
      target_label: pod
    - action: labelmap
      regex: __meta_kubernetes_pod_label_nsm_nginx_com_(.+)
    - action: labeldrop
      regex: __meta_kubernetes_pod_label_nsm_nginx_com_(.+)
    - action: labelmap
      regex: __meta_kubernetes_pod_label_(.+)
    - action: labelmap
      regex: __meta_kubernetes_pod_annotation_nsm_nginx_com_enable_(.+)
  metric_relabel_configs:
    - source_labels: [__name__]
      regex: 'nginx_ingress_controller_upstream_server_response_latency_ms(.+)'
      target_label: __name__
      replacement: 'nginxplus_upstream_server_response_latency_ms$1'
    - source_labels: [__name__]
      regex: 'nginx_ingress_nginxplus(.+)'
      target_label: __name__
      replacement: 'nginxplus$1'
    - source_labels: [service]
      target_label: dst_service
    - source_labels: [resource_namespace]
      target_label: dst_namespace
    - source_labels: [pod_owner]
      regex: '(.+)\/(.+)'
      target_label: dst_$1
      replacement: $2
    - action: labeldrop
      regex: pod_owner
    - source_labels: [pod_name]
      target_label: dst_pod