Skip to content

Commit 0925e1e

Browse files
authored
feat: add e2e tests for core distro (#364)
* feat: add e2e tests for core distro * chore: merge host config with core collector
1 parent d41e817 commit 0925e1e

File tree

8 files changed

+695
-7
lines changed

8 files changed

+695
-7
lines changed
Lines changed: 211 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,241 @@
1+
extensions:
2+
health_check:
3+
14
receivers:
25
otlp:
36
protocols:
47
grpc:
58
http:
69

10+
hostmetrics:
11+
# Default collection interval is 60s. Lower if you need finer granularity.
12+
collection_interval: 60s
13+
scrapers:
14+
cpu:
15+
metrics:
16+
system.cpu.time:
17+
enabled: false
18+
system.cpu.utilization:
19+
enabled: true
20+
load:
21+
memory:
22+
metrics:
23+
system.memory.utilization:
24+
enabled: true
25+
paging:
26+
metrics:
27+
system.paging.utilization:
28+
enabled: false
29+
system.paging.faults:
30+
enabled: false
31+
filesystem:
32+
metrics:
33+
system.filesystem.utilization:
34+
enabled: true
35+
disk:
36+
metrics:
37+
system.disk.merged:
38+
enabled: false
39+
system.disk.pending_operations:
40+
enabled: false
41+
system.disk.weighted_io_time:
42+
enabled: false
43+
network:
44+
metrics:
45+
system.network.connections:
46+
enabled: false
47+
# Uncomment to enable process metrics, which can be noisy but valuable.
48+
# processes:
49+
# process:
50+
# metrics:
51+
# process.cpu.utilization:
52+
# enabled: true
53+
# process.cpu.time:
54+
# enabled: false
55+
56+
filelog:
57+
include:
58+
- /var/log/alternatives.log
59+
- /var/log/cloud-init.log
60+
- /var/log/auth.log
61+
- /var/log/dpkg.log
62+
- /var/log/syslog
63+
- /var/log/messages
64+
- /var/log/secure
65+
- /var/log/yum.log
66+
767
processors:
68+
# group system.cpu metrics by cpu
69+
metricstransform:
70+
transforms:
71+
- include: system.cpu.utilization
72+
action: update
73+
operations:
74+
- action: aggregate_labels
75+
label_set: [ state ]
76+
aggregation_type: mean
77+
- include: system.paging.operations
78+
action: update
79+
operations:
80+
- action: aggregate_labels
81+
label_set: [ direction ]
82+
aggregation_type: sum
83+
# remove system.cpu metrics for states
84+
filter/exclude_cpu_utilization:
85+
metrics:
86+
datapoint:
87+
- 'metric.name == "system.cpu.utilization" and attributes["state"] == "interrupt"'
88+
- 'metric.name == "system.cpu.utilization" and attributes["state"] == "nice"'
89+
- 'metric.name == "system.cpu.utilization" and attributes["state"] == "softirq"'
90+
filter/exclude_memory_utilization:
91+
metrics:
92+
datapoint:
93+
- 'metric.name == "system.memory.utilization" and attributes["state"] == "slab_unreclaimable"'
94+
- 'metric.name == "system.memory.utilization" and attributes["state"] == "inactive"'
95+
- 'metric.name == "system.memory.utilization" and attributes["state"] == "cached"'
96+
- 'metric.name == "system.memory.utilization" and attributes["state"] == "buffered"'
97+
- 'metric.name == "system.memory.utilization" and attributes["state"] == "slab_reclaimable"'
98+
filter/exclude_memory_usage:
99+
metrics:
100+
datapoint:
101+
- 'metric.name == "system.memory.usage" and attributes["state"] == "slab_unreclaimable"'
102+
- 'metric.name == "system.memory.usage" and attributes["state"] == "inactive"'
103+
filter/exclude_filesystem_utilization:
104+
metrics:
105+
datapoint:
106+
- 'metric.name == "system.filesystem.utilization" and attributes["type"] == "squashfs"'
107+
filter/exclude_filesystem_usage:
108+
metrics:
109+
datapoint:
110+
- 'metric.name == "system.filesystem.usage" and attributes["type"] == "squashfs"'
111+
- 'metric.name == "system.filesystem.usage" and attributes["state"] == "reserved"'
112+
filter/exclude_filesystem_inodes_usage:
113+
metrics:
114+
datapoint:
115+
- 'metric.name == "system.filesystem.inodes.usage" and attributes["type"] == "squashfs"'
116+
- 'metric.name == "system.filesystem.inodes.usage" and attributes["state"] == "reserved"'
117+
filter/exclude_system_disk:
118+
metrics:
119+
datapoint:
120+
- 'metric.name == "system.disk.operations" and IsMatch(attributes["device"], "^loop.*") == true'
121+
- 'metric.name == "system.disk.merged" and IsMatch(attributes["device"], "^loop.*") == true'
122+
- 'metric.name == "system.disk.io" and IsMatch(attributes["device"], "^loop.*") == true'
123+
- 'metric.name == "system.disk.io_time" and IsMatch(attributes["device"], "^loop.*") == true'
124+
- 'metric.name == "system.disk.operation_time" and IsMatch(attributes["device"], "^loop.*") == true'
125+
filter/exclude_system_paging:
126+
metrics:
127+
datapoint:
128+
- 'metric.name == "system.paging.usage" and attributes["state"] == "cached"'
129+
- 'metric.name == "system.paging.operations" and attributes["type"] == "cached"'
130+
filter/exclude_network:
131+
metrics:
132+
datapoint:
133+
- 'IsMatch(metric.name, "^system.network.*") == true and attributes["device"] == "lo"'
134+
135+
attributes/exclude_system_paging:
136+
include:
137+
match_type: strict
138+
metric_names:
139+
- system.paging.operations
140+
actions:
141+
- key: type
142+
action: delete
143+
144+
cumulativetodelta:
145+
146+
transform/host:
147+
metric_statements:
148+
- context: metric
149+
statements:
150+
- set(description, "")
151+
- set(unit, "")
152+
153+
transform:
154+
trace_statements:
155+
- context: span
156+
statements:
157+
- truncate_all(attributes, 4095)
158+
- truncate_all(resource.attributes, 4095)
159+
log_statements:
160+
- context: log
161+
statements:
162+
- truncate_all(attributes, 4095)
163+
- truncate_all(resource.attributes, 4095)
164+
8165
# used to prevent out of memory situations on the collector
9166
memory_limiter:
10167
check_interval: 1s
11168
limit_mib: ${env:NEW_RELIC_MEMORY_LIMIT_MIB:-100}
169+
12170
batch:
13171

172+
resourcedetection:
173+
detectors: ["system"]
174+
system:
175+
hostname_sources: ["os"]
176+
resource_attributes:
177+
host.id:
178+
enabled: true
179+
180+
resourcedetection/cloud:
181+
detectors: ["gcp", "ec2", "azure"]
182+
timeout: 2s
183+
ec2:
184+
resource_attributes:
185+
host.name:
186+
enabled: false
187+
188+
# Gives OTEL_RESOURCE_ATTRIBUTES precedence over other sources.
189+
# host.id is set from env whenever the collector is orchestrated by NR Agents.
190+
resourcedetection/env:
191+
detectors: ["env"]
192+
timeout: 2s
193+
override: true
194+
14195
exporters:
15196
otlphttp:
16197
endpoint: ${env:OTEL_EXPORTER_OTLP_ENDPOINT:-https://otlp.nr-data.net}
17198
headers:
18199
api-key: ${env:NEW_RELIC_LICENSE_KEY}
19200

20-
extensions:
21-
health_check:
22-
23201
service:
24-
extensions: [health_check]
25202
pipelines:
203+
metrics/host:
204+
receivers: [hostmetrics]
205+
processors:
206+
- memory_limiter
207+
- metricstransform
208+
- filter/exclude_cpu_utilization
209+
- filter/exclude_memory_utilization
210+
- filter/exclude_memory_usage
211+
- filter/exclude_filesystem_utilization
212+
- filter/exclude_filesystem_usage
213+
- filter/exclude_filesystem_inodes_usage
214+
- filter/exclude_system_disk
215+
- filter/exclude_network
216+
- attributes/exclude_system_paging
217+
- transform/host
218+
- resourcedetection
219+
- resourcedetection/cloud
220+
- resourcedetection/env
221+
- cumulativetodelta
222+
- batch
223+
exporters: [otlphttp]
224+
logs/host:
225+
receivers: [filelog]
226+
processors: [memory_limiter, transform, resourcedetection, resourcedetection/cloud, resourcedetection/env, batch]
227+
exporters: [otlphttp]
26228
traces:
27229
receivers: [otlp]
28-
processors: [memory_limiter, batch]
230+
processors: [memory_limiter, transform, resourcedetection, resourcedetection/cloud, resourcedetection/env, batch]
29231
exporters: [otlphttp]
30232
metrics:
31233
receivers: [otlp]
32-
processors: [memory_limiter, batch]
234+
processors: [memory_limiter, transform, resourcedetection, resourcedetection/cloud, resourcedetection/env, batch]
33235
exporters: [otlphttp]
34236
logs:
35237
receivers: [otlp]
36-
processors: [memory_limiter, batch]
238+
processors: [memory_limiter, transform, resourcedetection, resourcedetection/cloud, resourcedetection/env, batch]
37239
exporters: [otlphttp]
240+
241+
extensions: [health_check]
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# standardized configmap filename expected by collector chart
2+
relay
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
additionalLabels:
2+
e2eTestLogSelector: nrdot-collector-e2e
3+
podLabels:
4+
e2eTestLogSelector: nrdot-collector-e2e
5+
6+
mode: daemonset
7+
8+
configMap:
9+
create: false
10+
11+
command:
12+
extraArgs:
13+
- --config=/etc/nrdot-collector/config.yaml
14+
# configure liveliness probe according to chart's expectations
15+
- '"--config=yaml:extensions::health_check::endpoint: ${env:MY_POD_IP}:13133"'
16+
17+
extraEnvs:
18+
- name: OTEL_EXPORTER_OTLP_ENDPOINT
19+
valueFrom:
20+
secretKeyRef:
21+
name: collector-secrets
22+
key: nrBackendUrl
23+
- name: NEW_RELIC_LICENSE_KEY
24+
valueFrom:
25+
secretKeyRef:
26+
name: collector-secrets
27+
key: nrIngestKey
28+
- name: SCENARIO_TAG
29+
valueFrom:
30+
secretKeyRef:
31+
name: collector-secrets
32+
key: scenarioTag
33+
- name: OTEL_RESOURCE_ATTRIBUTES
34+
value: "testKey=$(SCENARIO_TAG)"
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
entities:
2+
- entityType: EXT-SERVICE
3+
metrics:
4+
- name: system.cpu.load_average.15m
5+
- name: system.cpu.load_average.1m
6+
- name: system.cpu.load_average.5m
7+
- name: system.cpu.utilization
8+
- name: system.disk.io
9+
- name: system.disk.io_time
10+
- name: system.disk.operation_time
11+
- name: system.disk.operations
12+
- name: system.filesystem.inodes.usage
13+
- name: system.filesystem.usage
14+
- name: system.filesystem.utilization
15+
- name: system.memory.usage
16+
- name: system.memory.utilization
17+
- name: system.network.dropped
18+
- name: system.network.errors
19+
- name: system.network.io
20+
- name: system.network.packets
21+
- name: system.paging.operations

0 commit comments

Comments
 (0)