Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exclude system services (self-instrumentation) by default #1536

Merged
merged 6 commits into from
Jan 16, 2025

Conversation

marevers
Copy link
Collaborator

@marevers marevers commented Jan 16, 2025

Closes #1454

This replaces the existing attribute allow_self_instrumentation with a new attribute called system_exclude_services. If it is set (it is by default) the exclusion of Beyla, Alloy and OTel Collector executables is automatically added to the ExcludeServices configuration. It must be explicitly set to an empty value (or some other value than the default .*alloy.*|.*otelcol.*|.*beyla.*) to allow self-instrumentation either through the config file or an environment variable.

It also removes the need for the warning in the Helm chart as modifying the exclude_services configuration can no longer lead to users accidentally enabling self-instrumentation when they don't mean to.

Copy link

codecov bot commented Jan 16, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 64.35%. Comparing base (b9eaba8) to head (3f949a1).
Report is 5 commits behind head on main.

❗ There is a different number of reports uploaded between BASE (b9eaba8) and HEAD (3f949a1). Click for more details.

HEAD has 1 upload less than BASE
Flag BASE (b9eaba8) HEAD (3f949a1)
unittests 1 0
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1536      +/-   ##
==========================================
- Coverage   71.72%   64.35%   -7.37%     
==========================================
  Files         195      195              
  Lines       19471    19567      +96     
==========================================
- Hits        13965    12593    -1372     
- Misses       4830     6171    +1341     
- Partials      676      803     +127     
Flag Coverage Δ
integration-test 53.72% <100.00%> (-0.04%) ⬇️
k8s-integration-test 54.70% <100.00%> (-0.04%) ⬇️
oats-test 32.65% <100.00%> (+0.07%) ⬆️
unittests ?

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@marctc
Copy link
Contributor

marctc commented Jan 16, 2025

We have already a field discovery -> allow_self_instrumentation to enable Beyla instrument itself. Could we consolidate this field with your proposed changes?

@mariomac mariomac marked this pull request as ready for review January 16, 2025 10:38
@mariomac mariomac requested a review from a team as a code owner January 16, 2025 10:38
@marevers
Copy link
Collaborator Author

We have already a field discovery -> allow_self_instrumentation to enable Beyla instrument itself. Could we consolidate this field with your proposed changes?

Good point! I will remove the new config property and instead integrate my changes into that existing property.

Copy link
Contributor

@mariomac mariomac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly LGTM!! I wonder if there is a way to do this same functionality exclusively in Helm.


| YAML | Environment variable | Type | Default |
| ------------------------- | ------------------------------- | ------- | ------- |
| `exclude_system_services` | `BEYLA_EXCLUDE_SYSTEM_SERVICES` | boolean | true |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To make this less dependent to our context, and more expandable, could this be a string instead of a boolean? Then default it to .*alloy.*|.*otelcol.*|.*beyla.*, allowing users to unset it (or empty it), or directly changing it to other regexp.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly LGTM!! I wonder if there is a way to do this same functionality exclusively in Helm.

I've tried exactly that in #1473 but it turned into a mess trying to prevent users from accidentally removing those default excludes if they supplied something else in exclude_services, so it works in a more robust way here.

To make this less dependent to our context, and more expandable, could this be a string instead of a boolean? Then default it to .*alloy.*|.*otelcol.*|.*beyla.*, allowing users to unset it (or empty it), or directly changing it to other regexp.

That sounds good. Seeing as this is probably a 2.0 feature, I would remove allow_self_instrumentation and instead just implement exclude_system_services as a string containing the regex, that should harmonize it a bit.

@marevers marevers force-pushed the discovery-def-exclude-cfg branch from a5e9ca8 to 3f949a1 Compare January 16, 2025 16:03
@marevers marevers requested a review from mariomac January 16, 2025 16:14
Copy link
Contributor

@grcevski grcevski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks again @marevers!

@grcevski grcevski merged commit 7c0b922 into grafana:main Jan 16, 2025
16 checks passed
@marevers marevers deleted the discovery-def-exclude-cfg branch January 17, 2025 06:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Helm chart: do not override excluded services unless explicitly set
4 participants