# Prometheus scrape configuration for the shop namespace.
global:
  scrape_interval: 15s
  scrape_timeout: 10s
  evaluation_interval: 30s
  external_labels:
    cluster: shop-staging
    region: eu-west-1

rule_files:
  - /etc/prometheus/rules/*.yaml

scrape_configs:
  - job_name: shop-services
    metrics_path: /metrics
    scheme: http
    static_configs:
      - targets:
          - 192.0.2.11:9090
          - 192.0.2.12:9090
          - 192.0.2.21:9090
          - 192.0.2.22:9090
          - 192.0.2.31:9090
        labels:
          env: staging
    relabel_configs:
      - source_labels: [__address__]
        regex: '192\.0\.2\.(\d+):\d+'
        target_label: host_octet
        replacement: node-${1}
    metric_relabel_configs:
      # Drop the two unbounded labels that produced the cardinality fixture.
      - source_labels: [__name__]
        regex: api_request_duration_seconds_count
        action: labeldrop
      - regex: '(customer_id|session_id)'
        action: labeldrop
      - source_labels: [__name__]
        regex: 'go_memstats_.*'
        action: drop

  - job_name: node-exporter-textfile
    metrics_path: /metrics
    honor_timestamps: true
    static_configs:
      - targets: [192.0.2.11:9100]

  - job_name: federated
    honor_labels: true
    metrics_path: /federate
    params:
      'match[]':
        - '{__name__=~"service:.*"}'
    static_configs:
      - targets: [192.0.2.11:9090]
