Hi Oleksandr, I'm a bit confused. The "promhttp_"-prefixed metrics are about the scrape requests themselves and they are still tracked fine when tying the promhttp.Handler() to another mux and server (because the scrape requests are now happening through that server, and the handler is also doing its tracking there now). Or are you talking about HTTP metrics for the rest of your application's HTTP handlers (not /metrics) that is running on the other server?
On Wed, Aug 17, 2022 at 12:00 PM Oleksandr Matsak < [email protected]> wrote: > Hi, Julius! > Thanks for quick reply. > > Yes, you are right, if I will use separate http.ServeMux on separate > server I will loose "promhttp_*" metrics for my application(because they > will be counted for separate server). > > > I have found the solution, but don't like it. > > > вторник, 16 августа 2022 г. в 21:05:14 UTC+3, [email protected]: > >> Hi Alex, >> >> both approaches are generally fine, based on your needs. With "losing >> instrumentation metrics", do you mean the "promhttp_*" metrics about the >> scrape itself? Those should still be present when just using >> "promhttp.Handler()" on a different http.ServeMux and starting a second >> server for that ServeMux. Could you share the relevant lines of your code >> and/or elaborate? >> >> Regards, >> Julius >> >> On Mon, Aug 15, 2022 at 11:34 PM Oleksandr Matsak <[email protected]> >> wrote: >> >>> Hi! >>> >>> I have REST API application and looking for solution for exposing >>> metrics endpoint for internal only access. >>> >>> I can see two options: >>> >>> 1. use same *http.Server* as application and protect endpoint with >>> supported auth flow (basic, token, etc) >>> 2. use different *http.Server* on internal port without any >>> authentication >>> >>> First has drawback of hardcoding auth credentials on both infrastructure >>> and application sides, I want to avoid it. >>> >>> While considering second, found that if just put *promhttp.Handler* to >>> separate server I will loose instrumentation metrics. >>> >>> So how do I see it: >>> >>> - put instrumentation metrics middleware to application server >>> - run another server on internal only port with metrics output >>> handler >>> >>> Any advise ? >>> >>> Thanks, >>> Alex >>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "Prometheus Users" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to [email protected]. >>> To view this discussion on the web visit >>> https://groups.google.com/d/msgid/prometheus-users/54038168-acda-40f2-97f7-7fc1212e926cn%40googlegroups.com >>> <https://groups.google.com/d/msgid/prometheus-users/54038168-acda-40f2-97f7-7fc1212e926cn%40googlegroups.com?utm_medium=email&utm_source=footer> >>> . >>> >> >> >> -- >> Julius Volz >> PromLabs - promlabs.com >> > -- > You received this message because you are subscribed to the Google Groups > "Prometheus Users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/prometheus-users/1766f79b-ab33-401c-8e0d-f2e7e935ff35n%40googlegroups.com > <https://groups.google.com/d/msgid/prometheus-users/1766f79b-ab33-401c-8e0d-f2e7e935ff35n%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- Julius Volz PromLabs - promlabs.com -- You received this message because you are subscribed to the Google Groups "Prometheus Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/CAObpH5we7yWVrzO1pCxeoPZ-HuOnyFZa7MbuycKj06525-ytkA%40mail.gmail.com.

