mirror of
https://github.com/cozystack/cozystack.git
synced 2026-11-21 12:13:55 +09:00
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 <maximbel2003@gmail.com>
This commit is contained in:
1 parent
0e4711b17c
commit
8351e23d4d
2 files changed
+3
-4
No files matched your search
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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=-"},
|
||||
|
||||
Reference in new issue
Block a user