WIP Adding service discovery endpoint for prometheus
Added a quick implementation of https://prometheus.io/docs/prometheus/latest/http_sd/ to scrape all known agents automatically via the endpoint http://localhost:8092/discover. The proxy-paths were prefixed with the value of discoverUrl, under which the prometheus instance could query the proxied agents.
Not sure, if the option/default/env-handling is consistent with the configuration-handling of the AdminService/AdminConfig. Should the endpoint /discover also configurable?
Hi Wolfgang,
I am sorry for taking so long to get to this. I cut a new release with the code from your PR (1.13.0). I did not directly merge your branch, but your code is in the release. I did not add the SD endpoint as part of the admin servlets. Instead, I added it as an endpoint to the proxy itself, i.e., along with the scrape endpoints.
- The SD endpoint functionality is enabled with --sd_enabled or proxy.service.discovery.enabled
- The SD endpoint path is specified with --sd_path or proxy.service.discovery.path
- The SD target prefix is specified with --sd_target_prefix or proxy.service.discovery.targetPrefix
One other thing, the Config.java file is automatically generated from a yaml file (etc/config/config.conf). I did not want you to think I created that monstrosity.
Please let me know if it works for you and, again, I apologize for my sluggish response.
Paul
Thanks for the quick integration, I'll test it next week. If everything works fine, I'll close the PR.