Skip to content

Commit b32291c

Browse files
fix: nrdot onhost agent
1 parent 29a08a7 commit b32291c

File tree

7 files changed

+81
-9
lines changed

7 files changed

+81
-9
lines changed

agent-control/agent-type-registry/newrelic/com.newrelic.opentelemetry.collector-0.1.0.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,6 @@ deployment:
9090
path: /usr/bin/nrdot-collector-host
9191
args: >-
9292
--config=${nr-sub:autogenerated_agent_dir}/otel-config/config.yaml
93-
--feature-gates=-pkg.translator.prometheus.NormalizeName
9493
env:
9594
# sets the otel-collector "env" source resource detector
9695
OTEL_RESOURCE_ATTRIBUTES: "host.id=${nr-ac:host_id}"

agent-control/agent-type-registry/newrelic/io.opentelemetry.collector-0.1.0.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,6 @@ deployment:
9393
path: /usr/bin/nrdot-collector-host
9494
args: >-
9595
--config=${nr-sub:autogenerated_agent_dir}/otel-config/config.yaml
96-
--feature-gates=-pkg.translator.prometheus.NormalizeName
9796
env:
9897
# sets the otel-collector "env" source resource detector
9998
OTEL_RESOURCE_ATTRIBUTES: "host.id=${nr-ac:host_id}"

agent-control/src/cli/on_host/host_monitoring_gen/otel_config_gen.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ impl Default for OtelConfigGen {
1212
fn default() -> Self {
1313
Self {
1414
otel_agent_values_path: PathBuf::from(
15-
"/etc/newrelic-agent-control/fleet/agents.d/nr-otel-collector/values",
15+
"/etc/newrelic-agent-control/fleet/agents.d/nrdot/values",
1616
),
1717
otel_config_source_path: PathBuf::from(
1818
"/etc/newrelic-agent-control/examples/values-nr-otel-collector-agent-linux.yaml",
@@ -83,9 +83,7 @@ mod tests {
8383
#[test]
8484
fn test_generate_otel_config_creates_directories_and_copies_file() {
8585
let temp_dir = tempdir().unwrap();
86-
let temp_values_dir = temp_dir
87-
.path()
88-
.join("fleet/agents.d/nr-otel-collector/values");
86+
let temp_values_dir = temp_dir.path().join("fleet/agents.d/nrdot/values");
8987
let temp_example_file = temp_dir
9088
.path()
9189
.join("values-nr-otel-collector-agent-linux.yaml");
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
config: |
1+
config:
22
{{ OTEL_COLLECTOR_CONFIG }}

test/onhost-e2e/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
include ../Ansible.common
33

44
LOCAL_PACKAGE_PATH ?= $(CURDIR)/../../dist
5-
RECIPE_BRANCH ?= main
5+
RECIPE_BRANCH ?= NR_483970_use_cli_host_monitoring
66

77
# Variables dependent on the New Relic platform region.
88
OPAMP_ENDPOINT = "https://opamp.staging-service.newrelic.com/v1/opamp"

test/onhost-e2e/Readme.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,17 @@ The Vagrant VM can be launched using `vagrant up` from the same folder where the
3131

3232
## Execution
3333
```sh
34+
# In case you want to execute the e2e using the current commit AC, run the package creation with a tag
35+
# that doesn't match with any in the prod repo.
36+
GORELEASER_CURRENT_TAG=9.0.0 NR_RELEASE_TAG=9.0.0 goreleaser release --skip sign --skip publish --skip validate --clean
37+
3438
make test/onhost-e2e \
39+
PACKAGE_VERSION="<9.0.0(build from current branch) or upstream prod version>"\
3540
NR_LICENSE_KEY=$LICENSE_KEY \
3641
NEW_RELIC_ACCOUNT_ID=$ACCOUNT_ID \
3742
NEW_RELIC_API_KEY=$API_REST_KEY \
3843
NR_ORGANIZATION_ID=$ORGANIZATION_ID \
3944
NR_SYSTEM_IDENTITY_CLIENT_ID=$SYSTEM_IDENTITY_CLIENT_ID \
4045
NR_SYSTEM_IDENTITY_PRIVATE_KEY=$SYSTEM_IDENTITY_PRIVATE_KEY \
41-
REPOSITORY_ENDPOINT="http://nr-downloads-ohai-staging.s3.amazonaws.com/" \
4246
ANSIBLE_PLAYBOOK=<test playbook>.yaml
4347
```
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
---
2+
- name: Test nrdot
3+
hosts: 127.0.0.1
4+
connection: local
5+
become: true
6+
gather_facts: yes
7+
8+
tasks:
9+
- name: Test nrdot
10+
block:
11+
- name: Cleanup
12+
include_tasks: ./tasks/clean_all.yaml
13+
14+
- name: Install Agent Control
15+
include_role:
16+
name: install_ac_recipe
17+
vars:
18+
recipe_list: "agent-control"
19+
monitoring_source: "otel"
20+
fleet_enabled: "false"
21+
22+
- name: Set test identifier
23+
set_fact:
24+
test_id: "onhost-e2e-nrdot_{{ lookup('pipe', 'date +%Y-%m-%d_%H-%M-%S') }}"
25+
26+
- name: Setup AC config
27+
include_role:
28+
name: edit_yaml_config
29+
vars:
30+
config_path: "/etc/newrelic-agent-control/config.yaml"
31+
update_config:
32+
# fixing the host id to identify the test instance. The approach here is different than other
33+
# test because is less complex and intrusive that adding the attribute to the processor in nrdot.
34+
host_id: "{{ test_id }}"
35+
log:
36+
format:
37+
formatter: pretty
38+
target: true
39+
level: debug
40+
41+
- name: Restart Agent Control
42+
include_role:
43+
name: caos.ansible_roles.service_status
44+
vars:
45+
service_name: "newrelic-agent-control"
46+
action: "restart"
47+
48+
- name: Assert that nrdot is reporting
49+
include_role:
50+
name: nrql_api_request
51+
apply:
52+
become: false
53+
vars:
54+
nrql_query: >-
55+
SELECT `system.memory.utilization`
56+
FROM Metric
57+
WHERE `host.id` = '{{ test_id }}'
58+
LIMIT 1
59+
retries: 120
60+
delay: 10
61+
62+
always:
63+
- name: AC logs
64+
shell: journalctl -u newrelic-agent-control --no-pager
65+
register: ac_logs
66+
67+
- name: Debug AC logs
68+
debug:
69+
var: ac_logs.stdout_lines
70+
71+
- name: Cleanup
72+
include_tasks: ./tasks/clean_all.yaml

0 commit comments

Comments
 (0)