akoutmos / prom_ex

An Elixir Prometheus metrics collection library built on top of Telemetry with accompanying Grafana dashboards
MIT License
577 stars 96 forks source link

Confusion over `PromEx.Plug`, because docs maybe contradict in their explaining about it? #215

Open gaggle opened 9 months ago

gaggle commented 9 months ago

This document: https://hexdocs.pm/prom_ex/running-multiple-agents.html#endpoints states: "You can configure each agent to scrape the same set of metrics", and then points to registering plug PromEx.Plug in endpoint.ex. But this leads me to think plug PromEx.Plug is about scraping, when I think it's actually about making the metrics endpoint available. Or am I wrong?

Perhaps this is a subtle point, but my confusion is I'm not sure which part of PromEx does the actual collecting and which part makes the endpoint available, and this document adds to the confusion because https://hexdocs.pm/prom_ex/PromEx.Plug.html states "Use this plug in your Endpoint file to expose your metrics", and so the two documents seem to be conflicting in their language.

Describe the solution you would like to see I think maybe multiple-agents page could specify using plug PromEx.Plug as an example of exposing the metrics via different paths?

Additional context I am not exposing metrics via /metrics, but instead using the metrics-server to expose metrics on a different port. For security reasons.

Anyway, I think this is probably a small consideration, feel free to just close this issue if it's not relevant. And thanks for making this great library available!