Skip to content

Commit

Permalink
[nr-k8s-otel-collector] low data mode default to true, add host metri…
Browse files Browse the repository at this point in the history
…cs to ldm (#1429)

<!--
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

#### What this PR does / why we need it:

#### 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]`)
  • Loading branch information
csongnr authored Jul 19, 2024
1 parent a6ac6ed commit e2aad60
Show file tree
Hide file tree
Showing 5 changed files with 102 additions and 7 deletions.
2 changes: 1 addition & 1 deletion charts/nr-k8s-otel-collector/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.6.0
version: 0.7.0

dependencies:
- name: common-library
Expand Down
2 changes: 1 addition & 1 deletion charts/nr-k8s-otel-collector/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ daemonset:
| kube-state-metrics.prometheusScrape | bool | `false` | Disable prometheus from auto-discovering KSM and potentially scraping duplicated data |
| labels | object | `{}` | Additional labels for chart objects |
| licenseKey | string | `""` | This set this license key to use. Can be configured also with `global.licenseKey` |
| lowDataMode | bool | `false` | Send only the metrics required to light up the NR kubernetes UI |
| lowDataMode | bool | `false` | Send only the metrics required to light up the NR kubernetes UI, this agent defaults to setting lowDataMode true, but if this setting is unset, lowDataMode will be set to false |
| nodeSelector | object | `{}` | Sets all pods' node selector. Can be configured also with `global.nodeSelector` |
| nrStaging | bool | `false` | Send the metrics to the staging backend. Requires a valid staging license key. Can be configured also with `global.nrStaging` |
| podLabels | object | `{}` | Additional labels for chart pods |
Expand Down
85 changes: 83 additions & 2 deletions charts/nr-k8s-otel-collector/templates/daemonset-configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,55 @@ data:
- value: 'false'
new_value: 'true'
metricstransform/hostmetrics:
transforms:
- include: process\.(cpu\.utilization|disk\.io|memory\.(usage|virtual))
action: update
match_type: regexp
operations:
- action: update_label
label: low.data.mode
value_actions:
- value: 'false'
new_value: 'true'
- include: system\.cpu\.(utilization|load_average\.(15m|1m|5m))
action: update
match_type: regexp
operations:
- action: update_label
label: low.data.mode
value_actions:
- value: 'false'
new_value: 'true'
- include: system\.disk\.(io_time|operation_time|operations)
action: update
match_type: regexp
operations:
- action: update_label
label: low.data.mode
value_actions:
- value: 'false'
new_value: 'true'
- include: system\.(filesystem|memory)\.(usage|utilization)
action: update
match_type: regexp
operations:
- action: update_label
label: low.data.mode
value_actions:
- value: 'false'
new_value: 'true'
- include: system\.network\.(errors|io|packets)
action: update
match_type: regexp
operations:
- action: update_label
label: low.data.mode
value_actions:
- value: 'false'
new_value: 'true'
filter/exclude_metrics_low_data_mode:
metrics:
metric:
Expand All @@ -317,6 +366,22 @@ data:
- truncate_all(attributes, 4095)
- truncate_all(resource.attributes, 4095)
# group system.cpu metrics by cpu
metricstransform/hostmetrics_cpu:
transforms:
- include: system.cpu.utilization
action: update
operations:
- action: aggregate_labels
label_set: [ state ]
aggregation_type: mean
- include: system.paging.operations
action: update
operations:
- action: aggregate_labels
label_set: [ direction ]
aggregation_type: sum
# following system.% metrics reduce metrics reported by hostmetrics receiver
filter/exclude_cpu_utilization:
metrics:
Expand Down Expand Up @@ -378,10 +443,23 @@ data:
- key: type
action: delete
resourcedetection/env:
detectors: ["env", "system"]
override: false
system:
hostname_sources: ["os"]
resource_attributes:
host.id:
enabled: true
resourcedetection/cloudproviders:
detectors: [env, gcp, eks, azure, aks, ec2, ecs]
detectors: [gcp, eks, azure, aks, ec2, ecs]
timeout: 2s
override: false
ec2:
resource_attributes:
host.name:
enabled: false
resource:
attributes:
Expand Down Expand Up @@ -480,7 +558,7 @@ data:
{{- if or .Values.receivers.hostmetrics.enabled (or .Values.receivers.kubeletstats.enabled .Values.receivers.prometheus.enabled) }}
metrics:
receivers:
{{- if and .Values.receivers.hostmetrics.enabled (include "newrelic.common.privileged" .) (not (include "newrelic.common.lowDataMode" .)) }}
{{- if and .Values.receivers.hostmetrics.enabled (include "newrelic.common.privileged" .) }}
- hostmetrics
{{- end }}
{{- if .Values.receivers.kubeletstats.enabled }}
Expand All @@ -495,8 +573,10 @@ data:
- metricstransform/kubeletstats
- metricstransform/cadvisor
- metricstransform/kubelet
- metricstransform/hostmetrics
- filter/exclude_metrics_low_data_mode
{{- end }}
- metricstransform/hostmetrics_cpu
- transform/truncate
- filter/exclude_cpu_utilization
- filter/exclude_memory_utilization
Expand All @@ -508,6 +588,7 @@ data:
- filter/exclude_system_paging
- filter/exclude_network
- attributes/exclude_system_paging
- resourcedetection/env
- resourcedetection/cloudproviders
- resource
{{- if include "newrelic.common.lowDataMode" . }}
Expand Down
16 changes: 15 additions & 1 deletion charts/nr-k8s-otel-collector/templates/deployment-configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -389,10 +389,23 @@ data:
datapoint:
- metric.name == "kube_pod_container_status" and value_double == 0.0
resourcedetection/env:
detectors: ["env", "system"]
override: false
system:
hostname_sources: ["os"]
resource_attributes:
host.id:
enabled: true
resourcedetection/cloudproviders:
detectors: [env, gcp, eks, azure, aks, ec2, ecs]
detectors: [gcp, eks, azure, aks, ec2, ecs]
timeout: 2s
override: false
ec2:
resource_attributes:
host.name:
enabled: false
resource/metrics:
attributes:
Expand Down Expand Up @@ -519,6 +532,7 @@ data:
- resource/low_data_mode_inator
{{- end }}
- resource/metrics
- resourcedetection/env
- resourcedetection/cloudproviders
- batch
- groupbyattrs
Expand Down
4 changes: 2 additions & 2 deletions charts/nr-k8s-otel-collector/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,6 @@ receivers:
# @default -- `true`
enabled: true

# -- (bool) Send only the metrics required to light up the NR kubernetes UI
# -- (bool) Send only the metrics required to light up the NR kubernetes UI, this agent defaults to setting lowDataMode true, but if this setting is unset, lowDataMode will be set to false
# @default -- `false`
lowDataMode:
lowDataMode: true

0 comments on commit e2aad60

Please sign in to comment.