Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FormatQuery ¶
FormatQuery formats the given query.
func GetMatchExpr ¶
GetMatchExpr returns the string representation of the given matchers in the form of a Prometheus match expression.
Types ¶
type Proxy ¶
type Proxy struct {
// contains filtered or unexported fields
}
Proxy is an HTTP handler that proxies requests to a Prometheus instance.
func NewProxy ¶
func NewProxy(upstreamEndpoint string, upstreamClient *http.Client, keys []string, labelMatchers []*labels.Matcher) *Proxy
NewProxy creates a new Proxy. Arguments explained:
- The upstreamEndpoint is the URL of the upstream Prometheus instance.
- The upstreamClient is used to proxy requests to the upstream Prometheus instance.
- The keys are used to provide virtual sub-routes for the proxy. For example, if the keys are ["namespace", "pod"], and the request path is "/{namespace}/{pod}/api/v1/query", the key-values will be ["{namespace}", "{pod}"]. The key-values are then converted to label matchers and appended to the label matchers provided in the configuration. In this example, the label matchers will be {namespace="{namespace}", pod="{pod}"}. If the keys are empty, no virtual sub-routes are provided. The proxy will only handle the root path, e.g., "/api/v1/query".
- The labelMatchers are the label matchers to apply to all queries.
Click to show internal directories.
Click to hide internal directories.