Regular Expressions 101

Community Patterns

Support metrics.agent.grafana.com/scheme or prometheus.io/scheme for Ingress

0

Regular Expression
PCRE2 (PHP >=7.3)

/
^(https?)(;.*;?(\b\1\b)(;.*)?|;;)$
/
gm

Description

relabel_configs:
  # allow targets to be filtered by a specific scheme, by default both http and https are included
  # specifying the annotation will limit the targets to that protocol exclusively
  #   metrics.agent.grafana.com/scheme: http
  #   prometheus.io/scheme: http
  - action: keep
    source_labels:
      - __meta_kubernetes_ingress_scheme
      - __meta_kubernetes_ingress_annotation_metrics_agent_grafana_com_scheme
      - __meta_kubernetes_ingress_annotation_prometheus_scheme
    separator: ;
    regex: ^(https?)(;.*;?(\b\1\b)(;.*)?|;;)$
Submitted by AaronB - a year ago