This is possible to do using relabel_configs: scrape_configs: - job_name: 'job' static_configs: - targets: - 'example.com/a' - 'example.com/b' - 'example.com/c' - 'example.com/d' relabel_configs: - source_labels: [__address__] target_label: __metrics_path__ regex: '(.*)/(.*)' replacement: '/$2' - source_labels: [__address__] target_label: instance - source_labels: [__address__] regex: '(.*)/(.*)' replacement: '$1' target_label: __address__
On Monday, December 14, 2020 at 1:32:23 PM UTC-5 bjo...@rabenste.in wrote: > There is probably same nuance in arguing if and when this is a good > idea and when not. > > But in fact, the famous > https://github.com/kubernetes/kube-state-metrics is doing it. It's not > using different paths, but different ports, but that's kind of > similar. > > On the Prometheus side, however, you need separate scrape > targets. There is currently no way of "iterating" through multiple > ports or paths of a target. From the Prometheus side, a different > port, a different path, or a different host is just all the same thing > in defining a different target. (And that probably won't change > anytime soon.) > > -- > Björn Rabenstein > [PGP-ID] 0x851C3DA17D748D03 > [email] bjo...@rabenste.in > -- You received this message because you are subscribed to the Google Groups "Prometheus Developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-developers+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-developers/c604b921-828a-427b-8d10-471ad7ccdae9n%40googlegroups.com.