You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The default Beyla discovery config generated by the k8s-monitoring Helm chart uses regex syntax for fields that Beyla interprets as glob patterns (gobwas/glob). This causes two problems:
discovery.instrument matches zero namespaces, so Beyla never discovers or instruments any services. Result: zero traces.
discovery.exclude_instrument matches zero executables, so the intended exclusion of Alloy, OTel Collector, and Beyla itself is silently ineffective.
Bug 1 — k8s_namespace: "." matches nothing
Location
_beyla-config.tpl, line 25:
{{- $services := list (dict "k8s_namespace" ".") }}
Rendered output
discovery:
instrument:
- k8s_namespace: .
Problem
The Beyla docs define k8s_namespace as string (glob). In glob syntax, . is a literal dot character. It does not mean "match any character" as it does in regex. No real Kubernetes namespace is named ., so this pattern matches nothing. Beyla discovers zero services and produces zero traces.
Fix
{{- $services := list (dict "k8s_namespace" "*") }}
This renders as k8s_namespace: "*", which is the glob wildcard for "match everything."
Bug 2 — exe_path uses regex alternation in a glob field
Location
_beyla-config.tpl, line 26:
{{- $excludeServices := list (dict "exe_path" ".*alloy.*|.*otelcol.*|.*beyla.*") }}
Starting from recent Beyla versions, Beyla ships a built-in default_exclude_instrument that already excludes *beyla, *alloy, *otelcol, *otelcol-contrib, and several Kubernetes system namespaces (kube-system, kube-node-lease, monitoring, GKE namespaces, etc.). So even with the chart's broken exclude_instrument, Beyla's own defaults provide coverage. Bug 2 is still incorrect and should be fixed, but its practical impact is lower than Bug 1.
Origin
The k8s_namespace: "." pattern has existed since the v1 chart:
When PR #2350 (commit 92cbe2119, authored by Pete Wall) updated the v4 chart to rename services/exclude_services to instrument/exclude_instrument to match Beyla's API change, the pattern values were carried forward without correcting the glob vs. regex mismatch.
Why it hasn't been caught
Tests assert the broken output. All rendered test snapshots (for example, tests/feature_beyla_config_test.yaml) contain the incorrect patterns, so tests pass.
Most real users override the discovery block. The buggy defaults only apply when preset: application is set and no custom discovery block is provided in values. Integration test examples like auto-instrumentation and split-destinations supply their own discovery config, which completely bypasses the defaults (guarded by not (hasKey $config "discovery") on line 24).
Beyla's built-in default_exclude_instrument masks Bug 2 silently in newer versions.
Regenerate all rendered test snapshots to match the corrected output.
Review the exclude-by-namespace example (docs/examples/exclude-by-namespace/values.yaml), which also uses k8s_namespace: . as a "match all" pattern in user-facing documentation. That example should be updated to k8s_namespace: "*".
Beyla discovery config uses regex syntax in glob fields
Chart:
k8s-monitoringv4.0.0 (feature-auto-instrumentation sub-chart)File:
charts/k8s-monitoring/charts/feature-auto-instrumentation/templates/_beyla-config.tplBeyla version: v3.1.2 (also affects earlier versions)
Status: Confirmed bug — no existing issue filed
Reported by: Prospect during POV (EKS, Bottlerocket, containerd, cgroup v2)
Summary
The default Beyla discovery config generated by the k8s-monitoring Helm chart uses regex syntax for fields that Beyla interprets as glob patterns (gobwas/glob). This causes two problems:
discovery.instrumentmatches zero namespaces, so Beyla never discovers or instruments any services. Result: zero traces.discovery.exclude_instrumentmatches zero executables, so the intended exclusion of Alloy, OTel Collector, and Beyla itself is silently ineffective.Bug 1 —
k8s_namespace: "."matches nothingLocation
_beyla-config.tpl, line 25:Rendered output
Problem
The Beyla docs define
k8s_namespaceasstring (glob). In glob syntax,.is a literal dot character. It does not mean "match any character" as it does in regex. No real Kubernetes namespace is named., so this pattern matches nothing. Beyla discovers zero services and produces zero traces.Fix
This renders as
k8s_namespace: "*", which is the glob wildcard for "match everything."Bug 2 —
exe_pathuses regex alternation in a glob fieldLocation
_beyla-config.tpl, line 26:Rendered output
Problem
exe_pathis also astring (glob)field. The pattern.*alloy.*|.*otelcol.*|.*beyla.*uses regex constructs:.*in glob means "literal dot followed by zero-or-more characters," not "zero-or-more of any character."|in glob is a literal pipe character, not alternation.The pattern effectively matches nothing (or only paths containing literal dots and pipes in those positions).
Fix (option A — glob alternation with braces)
Fix (option B — multiple entries)
Mitigating factor
Starting from recent Beyla versions, Beyla ships a built-in
default_exclude_instrumentthat already excludes*beyla,*alloy,*otelcol,*otelcol-contrib, and several Kubernetes system namespaces (kube-system,kube-node-lease,monitoring, GKE namespaces, etc.). So even with the chart's brokenexclude_instrument, Beyla's own defaults provide coverage. Bug 2 is still incorrect and should be fixed, but its practical impact is lower than Bug 1.Origin
The
k8s_namespace: "."pattern has existed since the v1 chart:When PR #2350 (commit
92cbe2119, authored by Pete Wall) updated the v4 chart to renameservices/exclude_servicestoinstrument/exclude_instrumentto match Beyla's API change, the pattern values were carried forward without correcting the glob vs. regex mismatch.Why it hasn't been caught
tests/feature_beyla_config_test.yaml) contain the incorrect patterns, so tests pass.preset: applicationis set and no customdiscoveryblock is provided in values. Integration test examples likeauto-instrumentationandsplit-destinationssupply their owndiscoveryconfig, which completely bypasses the defaults (guarded bynot (hasKey $config "discovery")on line 24).default_exclude_instrumentmasks Bug 2 silently in newer versions.Evidence from Beyla documentation
The Beyla service discovery docs define the field types in the
instrument/exclude_instrumentschema:exe_pathstring (glob)container_namestring (glob)k8s_namespacestring (glob)k8s_pod_namestring (glob)k8s_deployment_namestring (glob)k8s_replicaset_namestring (glob)k8s_statefulset_namestring (glob)k8s_daemonset_namestring (glob)k8s_owner_namestring (glob)All Kubernetes attribute selectors and
exe_pathare glob fields, not regex.Affected rendered outputs
The broken defaults appear in every rendered example and test snapshot that uses
preset: applicationwithout a custom discovery block:tests/feature_beyla_config_test.yamltests/platform/openshift/.rendered/output.yamltests/platform/grafana-cloud/k8s-monitoring/.rendered/output.yamldocs/examples/tolerations/output.yamldocs/examples/resource-requests-and-limits/output.yamldocs/examples/private-image-registries/individual/output.yamldocs/examples/images/images-by-digest/output.yamldocs/examples/features/auto-instrumentation/beyla-metrics/output.yamldocs/examples/features/auto-instrumentation/span-metrics-only/output.yamldocs/examples/exclude-by-namespace/output.yamlRecommendation
_beyla-config.tpl— two-line fix (lines 25–26).docs/examples/exclude-by-namespace/values.yaml), which also usesk8s_namespace: .as a "match all" pattern in user-facing documentation. That example should be updated tok8s_namespace: "*".instrument/exclude_instrument#2350 (Pete Wall) for review.Prospect workaround
The prospect resolved the issue by overriding the
discoveryblock in their Helm values:This is a valid workaround because the template only injects defaults when no
discoverykey exists in the user-provided config data.