Go to file
Stefan Reimer 979e58cdbc
All checks were successful
ZeroDownTime/tty-prometheus-exporter-merger/pipeline/head This commit looks good
Merge latest ci-tools-lib
2024-06-25 17:15:39 +00:00
.ci Merge latest ci-tools-lib 2024-06-25 17:15:39 +00:00
cmd add env variables 2020-05-17 18:34:32 +03:00
merger fix http client error handling 2022-11-21 09:21:12 +09:00
.gitignore Cleanup 2023-05-20 12:05:30 +00:00
Dockerfile Clean up Dockerfile 2023-09-28 13:18:15 +00:00
example.yaml add env variables 2020-05-17 18:34:32 +03:00
go.mod fix(deps): update module gopkg.in/yaml.v2 to v2.4.0 2023-09-28 03:12:39 +00:00
go.sum fix(deps): update module gopkg.in/yaml.v2 to v2.4.0 2023-09-28 03:12:39 +00:00
Jenkinsfile Integrate ZDT ci 2023-05-20 12:03:02 +00:00
LICENSE add LICENSE 2020-05-19 22:40:42 +03:00
main.go fix build 2020-05-17 16:37:00 +03:00
Makefile Integrate ZDT ci 2023-05-20 12:03:02 +00:00
README.md update readme 2020-05-17 18:50:32 +03:00
renovate.json chore(deps): add renovate.json 2023-08-07 13:41:55 +00:00

prometheus-exporter-merger

Merges Prometheus metrics from multiple sources.

But Why?!

Sometimes you need to scrape Prometheus metrics from multiple containers in a single pod, but you can't do this using annotations: prometheus/prometheus#3756.

To start the exporter:

prometheus-exporter-merger --config /config/prometheus-exporter-merger.yaml

Config example:

listen: :8080
scrap_timeout: 20s
sources:
  - url: http://127.0.0.1:8081/metrics
    labels:
      keyX: valueX
      keyY: Y
  - url: http://127.0.0.1:8082/metrics
    labels:
      key2: Z

Another way to pass configuration by setting environment variables:

export LISTEN=":8080"
export SCRAPE_TIMEOUT="20s"
export URL_1=http://127.0.0.1:801/api/v1/metrics/prometheus,keyX:valueX,keyY:Y
export URL_2=http://0.0.0.0:7070/api/v1/metrics/prometheus,key2:Z

Kubernetes

The prometheus-exporter-merger is supposed to run as a sidecar.

...
  template:
    metadata:
      annotations:
        prometheus.io/scrape: "true"
        prometheus.io/port: "8080"
...
    spec:
      containers:
...
      - name: prometheus-exporter-merger
        image: vadv/prometheus-exporter-merger
        env:
        - name: LISTEN
          value: :8080
        - name: SCRAPE_TIMEOUT
          value: 20s
        - name: URL_COMMON
          value: http://127.0.0.1:8081/api/v1/metrics/prometheus,type:common
        - name: URL_AUDIT
          value: http://127.0.0.1:8082/api/v1/metrics/prometheus,type:audit
...