Regular Expressions 101

Community Patterns

1...56789...879

Support metrics.agent.grafana.com/module or prometheus.io/module for Ingresses with or without K/V pairs for multiple ports

0

Regular Expression
PCRE2 (PHP >=7.3)

/
^([^;,\n]*)(;.*\1=|;.*;|;)([^;,=\n]+)(,.*|;.*)?$
/
gm

Description

relabel_configs:
  # allow override of the blackbox probing module to use by default the module http_2xx is used,
  # if a single value is specified it will become the default for each target within the ingress
  # a comma-delimited list convention of /foo=http_2xx_post,/bar=http_2xx_put is supported as well,
  # this will allow overridding of the default module for the current path
  #
  #   prometheus.io/module: http_2xx_post
  #   metrics.agent.grafana.com/module: http_2xx_post
  #
  - action: replace
    source_labels:
      - __meta_kubernetes_ingress_path
      - __meta_kubernetes_ingress_annotation_metrics_agent_grafana_com_module
      - __meta_kubernetes_ingress_annotation_prometheus_io_module
      - __param_module
Submitted by AaronB - a year ago