Documentation
¶
Overview ¶
Package metrics provides an HTTP handler for proxying metrics requests to specific upstream endpoints using net/http/httputil.ReverseProxy.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func StartServer ¶
func StartServer(ctx context.Context, port int, handler *ProxyHandler) error
StartServer starts an HTTP server on the specified port with the given ProxyHandler.
Types ¶
type ProxyHandler ¶
type ProxyHandler struct {
// contains filtered or unexported fields
}
ProxyHandler is an HTTP handler that proxies requests to specific upstream endpoints.
func NewProxyHandler ¶
func NewProxyHandler(upstreams map[string]string) *ProxyHandler
NewProxyHandler creates a new ProxyHandler with the given upstreams configuration. The upstreams map keys are request paths and values are upstream URLs. For example: {"/metrics": "127.0.0.1:8000/metrics", "/stats/prometheus": "127.0.0.1:19000/stats/prometheus"}
func (*ProxyHandler) ServeHTTP ¶
func (h *ProxyHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP implements the http.Handler interface.
Click to show internal directories.
Click to hide internal directories.