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/CAObpH5yXMzNNmDpLJ60eEZ7vWsnbk1GSKzG70C_V7KjAm6FTXQ%40mail.gmail.com.

Reply via email to