metrics

package
v0.21.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 30, 2026 License: AGPL-3.0 Imports: 8 Imported by: 0

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL