Hi,

On 12/9/20 12:42 PM, rakshit gupta wrote:
How can (is it possible) I use multiple endpoints for metrics scraping in a job ?

# The HTTP resource path on which to fetch metrics from targets.
 [ metrics_path: <path> <https://prometheus.io/docs/prometheus/latest/configuration/configuration/#path> | default = /metrics ]

In my use case, a service( registered to consul) can expose metrics in any one of the endpoints - /metrics, /actuator/info, etc, and I need generic configuration in Prometheus to scrape data by probably iterating through the endpoints. I cannot hard code the endpoint there that /metrics is my endpoint.

I don't think this is possible or a good idea. You would need to decide which metrics path to use. If you have this information (e.g. during service discovery), then you can place those targets in different scrape jobs or even re-use the sample scrape job and relabel __metrics_path__ accordingly.

If SD doesn't provide this information, another option would be to provide it via your configuration management system (e.g. probe your targets regularly and see what endpoint is the right one; then record this information).

If this information is not available to you, then the only other option would be to create scrape jobs for all variants. Two of those three would always fail. I don' think it would be a good idea or simple to work with.

Kind regards,
Christian

--
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/e51af840-f9cf-e4c8-a511-e6eac7e4ec4e%40hoffmann-christian.info.

Reply via email to