prober: export probe class and metrics from bandwidth prober
- Wrap each prober function into a probe class that allows associating metric labels and custom metrics with a given probe; - Make sure all existing probe classes set a `class` metric label; - Move bandwidth probe size from being a metric label to a separate gauge metric; this will make it possible to use it to calculate average used bandwidth using a PromQL query; - Also export transfer time for the bandwidth prober (more accurate than the total probe time, since it excludes connection establishment time). Updates tailscale/corp#17912 Signed-off-by: Anton Tolchanov <anton@tailscale.com>
This commit is contained in:
committed by
Anton Tolchanov
parent
21671ca374
commit
5336362e64
+8
-5
@@ -13,14 +13,17 @@ import (
|
||||
|
||||
const maxHTTPBody = 4 << 20 // MiB
|
||||
|
||||
// HTTP returns a Probe that healthchecks an HTTP URL.
|
||||
// HTTP returns a ProbeClass that healthchecks an HTTP URL.
|
||||
//
|
||||
// The ProbeFunc sends a GET request for url, expects an HTTP 200
|
||||
// The probe function sends a GET request for url, expects an HTTP 200
|
||||
// response, and verifies that want is present in the response
|
||||
// body.
|
||||
func HTTP(url, wantText string) ProbeFunc {
|
||||
return func(ctx context.Context) error {
|
||||
return probeHTTP(ctx, url, []byte(wantText))
|
||||
func HTTP(url, wantText string) ProbeClass {
|
||||
return ProbeClass{
|
||||
Probe: func(ctx context.Context) error {
|
||||
return probeHTTP(ctx, url, []byte(wantText))
|
||||
},
|
||||
Class: "http",
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user