go.mod,tsnet,tstest/natlab/vmtest: bump prometheus/common to v0.69.0
prometheus/common v0.66/v0.67 introduced a mandatory model.ValidationScheme on expfmt.TextParser as part of prepping for UTF-8 metric/label names in Prometheus 3.0. The zero value is intentionally UnsetValidation, which panics on the first call to IsValidMetricName / IsValidLabelName with Invalid name validation scheme requested: unset so the long-standing "var parser expfmt.TextParser" pattern crashes at runtime. Several big downstreams have hit the same sharp edge: https://github.com/thanos-io/thanos/issues/8823 https://github.com/grafana/loki/pull/21401 Switch our two callers (parseMetrics in tsnet's TestUserMetricsByteCounters and the client-metrics scraper in tstest/natlab/vmtest) to the new expfmt.NewTextParser constructor with model.LegacyValidation. LegacyValidation matches the classic ASCII metric/label naming rules that tailscaled's exporter uses today; if and when we ever emit a metric with a UTF-8 name, we can revisit. Goes to v0.69.0 (the latest at the time of writing) rather than v0.67.5 so we pick up the unrelated security fixes for cross-host redirects. Done in advance so a follow-up change can pull in github.com/tailscale/policybottest (which depends on palantir/policy-bot, which transitively requires prometheus/common at v0.67+) without dragging this debugging into that PR. Updates tailscale/corp#13972 Change-Id: I4b37db9ad3bebef1a32d9020bf6f8790bab25336 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
committed by
Brad Fitzpatrick
parent
b64209b248
commit
97e7ea8b0b
+6
-1
@@ -40,6 +40,7 @@ import (
|
||||
"github.com/google/go-cmp/cmp"
|
||||
dto "github.com/prometheus/client_model/go"
|
||||
"github.com/prometheus/common/expfmt"
|
||||
"github.com/prometheus/common/model"
|
||||
"github.com/tailscale/wireguard-go/tun"
|
||||
"golang.org/x/net/proxy"
|
||||
|
||||
@@ -2157,7 +2158,11 @@ func TestUDPConn(t *testing.T) {
|
||||
func parseMetrics(m []byte) (map[string]float64, error) {
|
||||
metrics := make(map[string]float64)
|
||||
|
||||
var parser expfmt.TextParser
|
||||
// prometheus/common v0.67 made the validation scheme mandatory;
|
||||
// the zero-value parser now panics. LegacyValidation matches the
|
||||
// classic ASCII metric/label name rules that the tailscaled exporter
|
||||
// uses (e.g. tailscaled_inbound_bytes_total).
|
||||
parser := expfmt.NewTextParser(model.LegacyValidation)
|
||||
mf, err := parser.TextToMetricFamilies(bytes.NewReader(m))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
||||
Reference in New Issue
Block a user