1

I have many instances located at two different cities (İstanbul and Ankara) I want to add the city location attribute automatically into all metrics coming from these instances by indicating host in prometheus configuration. I have posted an example prometheus configuration. Is there a way of adding such custom attribute?

--Actual --

- job_name: 'my-app'
    scrape_interval: 60s
    metrics_path: /actuator/prometheus
    static_configs:
      - targets:
                 - 172.18.11.33:8081
                 - 172.18.11.34:8080

-- my expection added geolocation indicator--

job_name: 'my-app'
scrape_interval: 60s
metrics_path: /actuator/prometheus
static_configs:
- targets:
- 172.18.11.33:8081;geo='istanbul’
- 172.18.11.34:8080;"geo='ankara'
Ahmet Karakaya
  • 9,899
  • 23
  • 86
  • 141

1 Answers1

1

Similar to Prometheus - add target specific label in static_configs

You can define multiple targets:

static_configs:
  - targets: ['172.18.11.33:8081']
    labels:  {geo: 'istanbul'}
  - targets: ['172.18.11.34:8080']
    labels:  {geo: 'ankara'}