Skip to content

fix(opentelemetry-collector): use valid regexp syntax in hostmetrics mount point excludes - #2217

Merged
TylerHelmuth merged 7 commits into
open-telemetry:mainfrom
Cloud-Architect-Emma:fix/hostmetrics-mount-point-regexp
Jun 4, 2026
Merged

fix(opentelemetry-collector): use valid regexp syntax in hostmetrics mount point excludes#2217
TylerHelmuth merged 7 commits into
open-telemetry:mainfrom
Cloud-Architect-Emma:fix/hostmetrics-mount-point-regexp

Conversation

@Cloud-Architect-Emma

@Cloud-Architect-Emma Cloud-Architect-Emma commented May 21, 2026

Copy link
Copy Markdown
Contributor

Related to #2216
The exclude_mount_points block in the hostMetrics preset was using glob-style patterns (e.g. /dev/*) with match_type: regexp. These are not valid regular expressions, they worked accidentally because regexp.MatchString does substring matching, so /dev/ would match any path containing that string.
Changes
Replace glob patterns with properly anchored regexp patterns in the opentelemetry-collector chart only:

/dev/* → ^/dev/
/proc/* → ^/proc/
/sys/* → ^/sys/
/run/k3s/containerd/* → ^/run/k3s/containerd/
/var/lib/docker/* → ^/var/lib/docker/
/var/lib/kubelet/* → ^/var/lib/kubelet/
/snap/* → ^/snap/

Files changed

charts/opentelemetry-collector/templates/_config.tpl
charts/opentelemetry-collector/examples/ (all rendered examples regenerated via make generate-examples)

@Cloud-Architect-Emma

Copy link
Copy Markdown
Contributor Author

Hi @ccmtaylor

I noticed issue #2216 and wanted to contribute a fix. The change is minimal,
only the 7 mount point patterns are updated to use valid regexp syntax in both
template files and the rendered examples.

Happy to make any adjustments if the approach needs tweaking

Thanks for reviewing!

@Cloud-Architect-Emma
Cloud-Architect-Emma force-pushed the fix/hostmetrics-mount-point-regexp branch from bc97a6d to 0b50009 Compare May 21, 2026 19:43
@Cloud-Architect-Emma

Copy link
Copy Markdown
Contributor Author

Hi maintainers,

The failing “Lint Charts / lint-test” check is due to a chart version bump requirement, not an issue with the regex fix in this PR.

The failure message shows:

chart version not ok. Needs a version bump!

This is triggered by the CI rule requiring version increments whenever chart files or rendered outputs change. I have now updated the chart versions accordingly and pushed the fix.

Please let me know if there is anything else required from my side for review approval.

Thanks.

@TylerHelmuth

Copy link
Copy Markdown
Member

@Cloud-Architect-Emma please only change 1 chart per PR

@Cloud-Architect-Emma
Cloud-Architect-Emma force-pushed the fix/hostmetrics-mount-point-regexp branch 2 times, most recently from 8c60d17 to 2202f32 Compare May 24, 2026 12:35
@Cloud-Architect-Emma

Copy link
Copy Markdown
Contributor Author

Hi @TylerHelmuth, I've squashed the changes down to the correct 3 files only (_config.tpl, configmap-agent.yaml, Chart.yaml). The diff is clean, old glob patterns fully removed, anchored regexp patterns in place.

I noticed the lint failure occurs after Chart.yaml validation succeeds, and only affects v3.14.4 and v4.0.3 but not v3.9.4. This looks like a pre-existing CI environment issue rather than something introduced by this PR. Happy to investigate further if you can point me in the right direction.

Thank you for your time reviewing this!

@Cloud-Architect-Emma

Copy link
Copy Markdown
Contributor Author

@TylerHelmuth, could you please review at your convenience?

Thanks

@povilasv

Copy link
Copy Markdown
Contributor

Please fix lints, generate examples change PR description so its only collector chart and then we can move forward

@Cloud-Architect-Emma
Cloud-Architect-Emma force-pushed the fix/hostmetrics-mount-point-regexp branch 3 times, most recently from 8f0c85f to e55ab3a Compare May 26, 2026 10:47
@Cloud-Architect-Emma
Cloud-Architect-Emma force-pushed the fix/hostmetrics-mount-point-regexp branch from e55ab3a to f1149bf Compare May 27, 2026 12:26
@Cloud-Architect-Emma

Copy link
Copy Markdown
Contributor Author

Hi @povilasv @TylerHelmuth, all checks passed . The branch has been rebased on latest main, examples regenerated, and the chart version bumped to 0.157.1.

Ready for review when you get a chance.

Thank you!

@Cloud-Architect-Emma
Cloud-Architect-Emma force-pushed the fix/hostmetrics-mount-point-regexp branch 6 times, most recently from 33f517f to 3252c19 Compare May 29, 2026 00:31
@Cloud-Architect-Emma

Copy link
Copy Markdown
Contributor Author

Hi @povilasv @TylerHelmuth , all 5 checks are now passing. Would appreciate a review when you get a chance.

Thanks!

@Cloud-Architect-Emma
Cloud-Architect-Emma force-pushed the fix/hostmetrics-mount-point-regexp branch 3 times, most recently from d523d28 to 9a67aea Compare May 29, 2026 01:42
@Cloud-Architect-Emma

Copy link
Copy Markdown
Contributor Author

Hi @dmitryax , thank you for the review! I've bumped the chart version to 0.157.3 and regenerated all examples. The commit is ready for another look when you get a chance.

Thanks!

@Cloud-Architect-Emma
Cloud-Architect-Emma force-pushed the fix/hostmetrics-mount-point-regexp branch from 9a67aea to d6893d5 Compare June 3, 2026 10:11
@linux-foundation-easycla

linux-foundation-easycla Bot commented Jun 3, 2026

Copy link
Copy Markdown

CLA Signed
The committers listed above are authorized under a signed CLA.

  • ✅ login: KyriosGN0 / name: AvivGuiser (01ac942)

@Cloud-Architect-Emma
Cloud-Architect-Emma force-pushed the fix/hostmetrics-mount-point-regexp branch 5 times, most recently from 244d18a to 0217078 Compare June 3, 2026 10:58
…mount point excludes

Updates hostMetrics preset regex anchors and bumps chart version to clear merge conflicts.

Signed-off-by: Emmanuela Opurum <emmanuela_prince@yahoo.com>
@Cloud-Architect-Emma
Cloud-Architect-Emma force-pushed the fix/hostmetrics-mount-point-regexp branch from 0217078 to 01ac942 Compare June 3, 2026 11:31
Signed-off-by: Emmanuela Opurum <emmanuela_prince@yahoo.com>
Signed-off-by: Emmanuela Opurum <emmanuela_prince@yahoo.com>
…tance names

Signed-off-by: Emmanuela Opurum <emmanuela_prince@yahoo.com>
@Cloud-Architect-Emma

Copy link
Copy Markdown
Contributor Author

Thanks, @TylerHelmuth, for approving! Hopefully, PR will be merged soon

Comment thread charts/opentelemetry-collector/templates/_config.tpl Outdated
@TylerHelmuth TylerHelmuth changed the title fix(opentelemetry-collector, opentelemetry-kube-stack): use valid regexp syntax in hostmetrics mount point excludes fix(opentelemetry-collector): use valid regexp syntax in hostmetrics mount point excludes Jun 4, 2026
@TylerHelmuth
TylerHelmuth merged commit 918205e into open-telemetry:main Jun 4, 2026
5 checks passed
@Cloud-Architect-Emma

Copy link
Copy Markdown
Contributor Author

Thanks @TylerHelmuth, for the review!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants