From 8351e23d4d653c6460b42b0447bc906e5cb3e7a0 Mon Sep 17 00:00:00 2001 From: Maxim Belyy Date: Wed, 11 Nov 2026 05:42:02 +0700 Subject: [PATCH] docs(observability-proxy): give the real reason for the prefix check The prefix is quoted before it reaches the regex, so a metacharacter or an upper case letter cannot widen the scope. Such a prefix matches no namespace at all and silently drops the exporter series, which is what the flag check guards against. Assisted-by: LLM Signed-off-by: Maxim Belyy --- cmd/observability-proxy/main.go | 4 ++-- cmd/observability-proxy/main_test.go | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/cmd/observability-proxy/main.go b/cmd/observability-proxy/main.go index c527f5061..e6652ad5f 100644 --- a/cmd/observability-proxy/main.go +++ b/cmd/observability-proxy/main.go @@ -113,8 +113,8 @@ func parseFlags(args []string) (options, error) { return o, fmt.Errorf("invalid metrics store name %q", store) } } - // Anything but namespace name characters would make the prefix match - // differently from the namespaces it is meant to name. + // The prefix is matched literally, so one no namespace name can start + // with would turn the exporter branch off without a word. if p := o.metrics.PlatformNamespacePrefix; p != "" && len(validation.IsDNS1123Label(p+"x")) > 0 { return o, fmt.Errorf("invalid metrics platform namespace prefix %q", p) } diff --git a/cmd/observability-proxy/main_test.go b/cmd/observability-proxy/main_test.go index 13e137dd2..a08f15d9e 100644 --- a/cmd/observability-proxy/main_test.go +++ b/cmd/observability-proxy/main_test.go @@ -112,8 +112,7 @@ func TestParseFlagsInvalid(t *testing.T) { {"--metrics-max-range=0s"}, {"--metrics-max-points=1"}, {"--metrics-max-timeout=0s"}, - // Only namespace name characters: a regex metacharacter or an upper - // case letter would widen or empty the scope. + // No namespace name starts with these, so they would match nothing. {"--metrics-platform-namespace-prefix=Cozy-"}, {"--metrics-platform-namespace-prefix=cozy.*"}, {"--metrics-platform-namespace-prefix=-"},