Skip to content

Commit 3982b8a

Browse files
authored
[nr-ebpf-agent] Update protocol enablement logic (#1624)
<!-- Thank you for contributing to New Relic's Helm charts. Before you submit this PR we'd like to make sure you are aware of our technical requirements: * https://github.com/newrelic-experimental/helm-charts/blob/master/CONTRIBUTING.md#technical-requirements For a quick overview across what we will look at reviewing your PR, please read our review guidelines: * https://github.com/newrelic-experimental/helm-charts/blob/master/REVIEW_GUIDELINES.md Following our best practices right from the start will accelerate the review process and help get your PR merged quicker. When updates to your PR are requested, please add new commits and do not squash the history. This will make it easier to identify new changes. The PR will be squashed anyways when it is merged. Thanks. For fast feedback, please @-mention maintainers that are listed in the Chart.yaml file. Please make sure you test your changes before you push them. Once pushed, a Github Action will run across your changes and do some initial checks and linting. These checks run very quickly. Please check the results. We would like these checks to pass before we even continue reviewing your changes. --> #### Is this a new chart No #### What this PR does / why we need it: Modifies the logic such that metrics are enabled by default when a protocol is on. #### Which issue this PR fixes *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)* - fixes # #### Special notes for your reviewer: #### Checklist [Place an '[x]' (no spaces) in all applicable fields. Please remove unrelated fields.] - [x] Chart Version bumped - [x] Variables are documented in the README.md - [x] Title of the PR starts with chart name (e.g. `[mychartname]`) Signed-off-by: kpattaswamy <[email protected]>
1 parent 8b12803 commit 3982b8a

File tree

3 files changed

+31
-33
lines changed

3 files changed

+31
-33
lines changed

charts/nr-ebpf-agent/Chart.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ type: application
1313
# This is the chart version. This version number should be incremented each time you make changes
1414
# to the chart and its templates, including the app version.
1515
# Versions are expected to follow Semantic Versioning (https://semver.org/)
16-
version: 0.1.20
16+
version: 0.1.21
1717

1818
dependencies:
1919
- name: common-library

charts/nr-ebpf-agent/templates/_helpers.tpl

+17-18
Original file line numberDiff line numberDiff line change
@@ -91,15 +91,11 @@ Pass environment variables to the agent container if tracing a specific protocol
9191
*/}}
9292
{{- define "generateTracingEnvVars" -}}
9393
{{- range $protocol, $config := .Values.protocols }}
94-
{{- $metricsEnabled := false }}
95-
{{- if (hasKey $config "metrics") }}
96-
{{- $metricsEnabled = eq $config.metrics.enabled true }}
94+
{{- $protocolEnabled := false }}
95+
{{- if (hasKey $config "enabled") }}
96+
{{- $protocolEnabled = eq $config.enabled true }}
9797
{{- end }}
98-
{{- $spansEnabled := false }}
99-
{{- if (hasKey $config "spans") }}
100-
{{- $spansEnabled = eq $config.spans.enabled true }}
101-
{{- end }}
102-
{{- if or (and (not $metricsEnabled) (not $spansEnabled)) (and (not (hasKey $config "metrics")) (not $spansEnabled)) }}
98+
{{- if eq $protocolEnabled false }}
10399
- name: PX_STIRLING_ENABLE_{{ upper $protocol }}_TRACING
104100
value: "0"
105101
{{- end }}
@@ -112,23 +108,26 @@ Generate environment variables for disabling protocols and setting sampling late
112108
{{- define "generateClientScriptEnvVars" -}}
113109
{{- if .Values.protocols }}
114110
{{- range $protocol, $config := .Values.protocols }}
115-
{{- if (hasKey $config "metrics") }}
116-
{{- if eq $config.metrics.enabled false }}
111+
{{- if (hasKey $config "enabled") }}
112+
{{- if eq $config.enabled false }}
117113
- name: NR_EBPF_ENABLE_{{ upper $protocol }}_METRICS
118114
value: "0"
119-
{{- end }}
120-
{{- end }}
121-
{{- if (hasKey $config "spans") }}
122-
{{- if (eq $config.spans.enabled false) }}
123115
- name: NR_EBPF_ENABLE_{{ upper $protocol }}_SPANS
124116
value: "0"
125-
{{- end }}
126-
{{- if (eq $config.spans.enabled true) }}
127-
{{- include "validate.samplingLatency" (dict "protocol" $protocol "latency" $config.spans.samplingLatency) }}
117+
{{- else if eq $config.enabled true }}
118+
{{- if (hasKey $config "spans") }}
119+
{{- if (eq $config.spans.enabled false) }}
120+
- name: NR_EBPF_ENABLE_{{ upper $protocol }}_SPANS
121+
value: "0"
122+
{{- end }}
123+
{{- if (eq $config.spans.enabled true) }}
124+
{{- include "validate.samplingLatency" (dict "protocol" $protocol "latency" $config.spans.samplingLatency) }}
128125
- name: SAMPLE_{{ upper $protocol }}_LATENCY
129126
value: "{{ $config.spans.samplingLatency | regexMatch "p1|p10|p50|p90|p99" | ternary $config.spans.samplingLatency "" }}"
127+
{{- end }}
130128
{{- end }}
131-
{{- end }}
129+
{{- end }}
132130
{{- end }}
133131
{{- end }}
134132
{{- end }}
133+
{{- end }}

charts/nr-ebpf-agent/values.yaml

+13-14
Original file line numberDiff line numberDiff line change
@@ -33,58 +33,57 @@ tableStoreDataLimitMB: "250"
3333
# Note that socket_tracer tracks http, mysql, redis, mongodb, amqp, cassandra, dns, and postgresql
3434
# while tcp_stats tracks TCP metrics.
3535
stirlingSources: "socket_tracer,tcp_stats"
36-
# The protocols to enable for tracing in the socket_tracer.
36+
# The protocols to enable for tracing in the socket_tracer. There is an ability to configure span export if it is enabled.
37+
# Each protocol has the flexibility to selectively enable the type of OTLP data to export.
38+
# Metrics are sent by default when a protocol is enabled and it supports metrics. Note: AMQP, Kafka, DNS do not report metrics.
3739
# samplingLatency represents the sampling latency threshold for the spans to export.
3840
# Options: p1, p10, p50, p90, p99.
3941
protocols:
4042
http:
41-
metrics:
42-
enabled: true
43+
enabled: true
4344
spans:
4445
enabled: true
45-
samplingLatency: ""
46+
samplingLatency: "p50"
4647
# -- samplingErrorRate represents the error rate threshold for an HTTP route where surpassing it would mean the corresponds spans of the route are exported.
4748
# Options: 1-100
4849
samplingErrorRate: ""
4950
mysql:
50-
metrics:
51-
enabled: true
51+
enabled: true
5252
spans:
5353
enabled: false
5454
samplingLatency: ""
5555
pgsql:
56-
metrics:
57-
enabled: true
56+
enabled: true
5857
spans:
5958
enabled: false
6059
samplingLatency: ""
6160
cass:
62-
metrics:
63-
enabled: true
61+
enabled: true
6462
spans:
6563
enabled: false
6664
samplingLatency: ""
6765
redis:
68-
metrics:
69-
enabled: true
66+
enabled: true
7067
spans:
7168
enabled: false
7269
samplingLatency: ""
7370
mongodb:
74-
metrics:
75-
enabled: true
71+
enabled: true
7672
spans:
7773
enabled: false
7874
samplingLatency: ""
7975
kafka:
76+
enabled: false
8077
spans:
8178
enabled: false
8279
samplingLatency: ""
8380
amqp:
81+
enabled: false
8482
spans:
8583
enabled: false
8684
samplingLatency: ""
8785
dns:
86+
enabled: false
8887
spans:
8988
enabled: false
9089
samplingLatency: ""

0 commit comments

Comments
 (0)