Skip to content

Commit 329a219

Browse files
authored
chore: rename NRDOT agent type (#1745)
* chore: rename NRDOT agent type Remaining places: - [ ] `helm-charts` repo - [ ] `docs-website` - [ ] `beta-docs-site` * chore: maintain both identifiers for now context: https://newrelic.slack.com/archives/C05N7KZ5NQN/p1759419351614949?thread_ts=1759415744.333919&cid=C05N7KZ5NQN * fix: add duplicate agent type to tests * test: revert config in test * docs: comment why two NRDOT agents are kept Agent types `io.opentelemetry.collector` and `com.newrelic.opentelemetry.collector` should be the same except for the name
1 parent 8b00318 commit 329a219

File tree

15 files changed

+267
-26
lines changed

15 files changed

+267
-26
lines changed
Lines changed: 177 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,177 @@
1+
namespace: newrelic
2+
name: com.newrelic.opentelemetry.collector
3+
version: 0.1.0
4+
variables:
5+
on_host:
6+
config:
7+
description: "Newrelic otel collector configuration"
8+
type: yaml
9+
required: false
10+
default: {}
11+
backoff_delay:
12+
description: "seconds until next retry if agent fails to start"
13+
type: string
14+
required: false
15+
default: 20s
16+
health_check:
17+
# Note the configs added here must align with the health check extension being used on the collector config variable.
18+
# See https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/extension/healthcheckv2extension/README.md#configuration
19+
# For more details
20+
path:
21+
description: "path to health check endpoint"
22+
type: string
23+
required: false
24+
default: "/health/status" # Taken from example at: https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/extension/healthcheckv2extension/README.md#configuration
25+
port:
26+
description: "port to health check endpoint"
27+
type: number
28+
required: false
29+
default: 13133
30+
k8s:
31+
chart_values:
32+
nr-k8s-otel-collector:
33+
description: "Newrelic otel collector chart values"
34+
type: yaml
35+
required: false
36+
default: {}
37+
global:
38+
description: "Global values for the chart"
39+
type: yaml
40+
required: false
41+
default: {}
42+
chart_version:
43+
description: "Newrelic otel collector chart version"
44+
type: string
45+
required: true
46+
chart_name:
47+
description: "nr-k8s-otel-collector chart name"
48+
type: string
49+
required: false
50+
default: "nr-k8s-otel-collector"
51+
chart_repository:
52+
url:
53+
description: "chart repository url"
54+
type: string
55+
required: false
56+
default: "https://helm-charts.newrelic.com"
57+
variants:
58+
ac_config_field: "chart_repository_urls"
59+
values: ["https://helm-charts.newrelic.com"]
60+
secret_reference:
61+
description: "HelmRepository secret reference (secretRef)"
62+
type: yaml
63+
required: false
64+
default: null
65+
certificate_secret_reference:
66+
description: "HelmRepository certificate secret reference (certSecretRef)"
67+
type: yaml
68+
required: false
69+
default: null
70+
deployment:
71+
on_host:
72+
health:
73+
interval: 5s
74+
initial_delay: 5s
75+
timeout: 5s
76+
http:
77+
path: "${nr-var:health_check.path}"
78+
port: ${nr-var:health_check.port}
79+
version:
80+
path: /usr/bin/nrdot-collector-host
81+
args: -v
82+
regex: \d+\.\d+\.\d+
83+
filesystem:
84+
otel-config:
85+
config.yaml: |
86+
${nr-var:config}
87+
executables:
88+
- # Important to note the binary name is nrdot-collector-host matching the new nrdot binary
89+
id: nrdot-collector-host
90+
path: /usr/bin/nrdot-collector-host
91+
args: >-
92+
--config=${nr-sub:autogenerated_agent_dir}/otel-config/config.yaml
93+
--feature-gates=-pkg.translator.prometheus.NormalizeName
94+
env:
95+
# sets the otel-collector "env" source resource detector
96+
OTEL_RESOURCE_ATTRIBUTES: "host.id=${nr-ac:host_id}"
97+
restart_policy:
98+
backoff_strategy:
99+
type: fixed
100+
backoff_delay: ${nr-var:backoff_delay}
101+
# See com.newrelic.infrastructure Agent type for description of fields.
102+
k8s:
103+
health:
104+
interval: 30s
105+
initial_delay: 30s
106+
objects:
107+
repository:
108+
apiVersion: source.toolkit.fluxcd.io/v1
109+
kind: HelmRepository
110+
metadata:
111+
name: ${nr-sub:agent_id}
112+
namespace: ${nr-ac:namespace}
113+
spec:
114+
interval: 30m
115+
provider: generic
116+
url: ${nr-var:chart_repository.url}
117+
secretRef: ${nr-var:chart_repository.secret_reference}
118+
certSecretRef: ${nr-var:chart_repository.certificate_secret_reference}
119+
values:
120+
apiVersion: v1
121+
kind: Secret
122+
metadata:
123+
name: values-${nr-sub:agent_id}
124+
namespace: ${nr-ac:namespace}
125+
stringData:
126+
default.yaml: |
127+
global:
128+
licenseKey: ${nr-env:NR_LICENSE_KEY}
129+
cluster: ${nr-env:NR_CLUSTER_NAME}
130+
nrStaging: ${nr-env:NR_STAGING}
131+
lowDataMode: ${nr-env:NR_LOW_DATA_MODE}
132+
verboseLog: ${nr-env:NR_VERBOSE_LOG}
133+
values.yaml: |
134+
${nr-var:chart_values.nr-k8s-otel-collector}
135+
global.yaml: |
136+
global:
137+
${nr-var:chart_values.global | indent 2}
138+
release:
139+
apiVersion: helm.toolkit.fluxcd.io/v2
140+
kind: HelmRelease
141+
metadata:
142+
name: ${nr-sub:agent_id}
143+
namespace: ${nr-ac:namespace}
144+
spec:
145+
targetNamespace: ${nr-ac:namespace_agents}
146+
releaseName: ${nr-sub:agent_id}
147+
interval: 30s
148+
chart:
149+
spec:
150+
chart: ${nr-var:chart_name}
151+
version: ${nr-var:chart_version}
152+
reconcileStrategy: ChartVersion
153+
sourceRef:
154+
kind: HelmRepository
155+
name: ${nr-sub:agent_id}
156+
namespace: ${nr-ac:namespace}
157+
interval: 3m
158+
install:
159+
disableWait: true
160+
disableWaitForJobs: true
161+
disableTakeOwnership: true
162+
createNamespace: true
163+
upgrade:
164+
disableWait: true
165+
disableWaitForJobs: true
166+
disableTakeOwnership: true
167+
cleanupOnFail: true
168+
valuesFrom:
169+
- kind: Secret
170+
name: values-${nr-sub:agent_id}
171+
valuesKey: default.yaml
172+
- kind: Secret
173+
name: values-${nr-sub:agent_id}
174+
valuesKey: values.yaml
175+
- kind: Secret
176+
name: values-${nr-sub:agent_id}
177+
valuesKey: global.yaml

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# This is the same agent type as `com.newrelic.opentelemetry.collector`, kept in the repository
2+
# for compatibility with existing deployments and Fleet Control support.
3+
# It should not drift from the `com.newrelic.opentelemetry.collector` definition!
14
namespace: newrelic
25
name: io.opentelemetry.collector
36
version: 0.1.0

agent-control/src/agent_control/config.rs

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -679,13 +679,17 @@ k8s:
679679
AgentTypeID::try_from("newrelic/com.newrelic.infrastructure:0.0.1").unwrap(),
680680
},
681681
)));
682-
assert!(diff.contains(&(
683-
&AgentID::try_from("nrdot").unwrap(),
684-
&SubAgentConfig {
685-
agent_type:
686-
AgentTypeID::try_from("newrelic/io.opentelemetry.collector:0.0.1").unwrap(),
687-
},
688-
)));
682+
assert!(
683+
diff.contains(&(
684+
&AgentID::try_from("nrdot").unwrap(),
685+
&SubAgentConfig {
686+
agent_type: AgentTypeID::try_from(
687+
"newrelic/com.newrelic.opentelemetry.collector:0.0.1"
688+
)
689+
.unwrap(),
690+
},
691+
))
692+
);
689693
}
690694

691695
#[test]
@@ -723,7 +727,7 @@ k8s:
723727
pub fn nrdot_identity() -> AgentIdentity {
724728
let id = AgentID::try_from("nrdot").unwrap();
725729
let agent_type_id =
726-
AgentTypeID::try_from("newrelic/io.opentelemetry.collector:0.0.1").unwrap();
730+
AgentTypeID::try_from("newrelic/com.newrelic.opentelemetry.collector:0.0.1").unwrap();
727731
AgentIdentity { id, agent_type_id }
728732
}
729733

agent-control/src/agent_control/defaults.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ pub(crate) fn get_custom_capabilities(agent_type_id: &AgentTypeID) -> Option<Cus
8585
}
8686

8787
pub const AGENT_TYPE_NAME_INFRA_AGENT: &str = "com.newrelic.infrastructure";
88-
pub const AGENT_TYPE_NAME_NRDOT: &str = "io.opentelemetry.collector";
88+
pub const AGENT_TYPE_NAME_NRDOT: &str = "com.newrelic.opentelemetry.collector";
8989

9090
#[cfg(test)]
9191
pub(crate) mod tests {

agent-control/src/agent_type/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ The metadata section contains information about the agent type, such as its name
1010

1111
```yaml
1212
namespace: newrelic
13-
name: io.opentelemetry.collector
13+
name: com.newrelic.opentelemetry.collector
1414
version: 0.0.1
1515
```
1616

agent-control/src/agent_type/definition/agent_type_validation_tests.rs

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,65 @@ static AGENT_TYPE_FLUENTBIT: LazyLock<AgentTypeValuesTestCase> =
353353
});
354354

355355
static AGENT_TYPE_OTEL_COLLECTOR: LazyLock<AgentTypeValuesTestCase> =
356+
LazyLock::new(|| AgentTypeValuesTestCase {
357+
agent_type: "newrelic/com.newrelic.opentelemetry.collector:0.1.0",
358+
values_k8s: AgentTypeValues {
359+
cases: HashMap::from([
360+
("mandatory fields only", r#"chart_version: "some-version""#),
361+
(
362+
"check all value types are correct",
363+
r#"
364+
chart_version: "some-version"
365+
chart_values.nr-k8s-otel-collector:
366+
yaml: object
367+
chart_values.global:
368+
yaml: object
369+
"#,
370+
),
371+
]),
372+
additional_env: HashMap::from([
373+
(
374+
Namespace::EnvironmentVariable.namespaced_name("NR_LICENSE_KEY"),
375+
Variable::new_final_string_variable("abcd1234".to_string()),
376+
),
377+
(
378+
Namespace::EnvironmentVariable.namespaced_name("NR_CLUSTER_NAME"),
379+
Variable::new_final_string_variable("my-test-cluster".to_string()),
380+
),
381+
(
382+
Namespace::EnvironmentVariable.namespaced_name("NR_STAGING"),
383+
Variable::new_final_string_variable("true".to_string()),
384+
),
385+
(
386+
Namespace::EnvironmentVariable.namespaced_name("NR_LOW_DATA_MODE"),
387+
Variable::new_final_string_variable("true".to_string()),
388+
),
389+
(
390+
Namespace::EnvironmentVariable.namespaced_name("NR_VERBOSE_LOG"),
391+
Variable::new_final_string_variable("true".to_string()),
392+
),
393+
]),
394+
}
395+
.into(),
396+
values_onhost: AgentTypeValues {
397+
cases: HashMap::from([
398+
("mandatory fields only", ""),
399+
(
400+
"check all value types are correct",
401+
r#"
402+
config: "some file contents"
403+
backoff_delay: "10s"
404+
health_check.path: "/health"
405+
health_check.port: 12345
406+
"#,
407+
),
408+
]),
409+
..Default::default()
410+
}
411+
.into(),
412+
});
413+
414+
static AGENT_TYPE_OTEL_COLLECTOR_OLD: LazyLock<AgentTypeValuesTestCase> =
356415
LazyLock::new(|| AgentTypeValuesTestCase {
357416
agent_type: "newrelic/io.opentelemetry.collector:0.1.0",
358417
values_k8s: AgentTypeValues {
@@ -507,6 +566,7 @@ fn get_agent_type_test_cases() -> impl Iterator<Item = &'static AgentTypeValuesT
507566
&AGENT_TYPE_PROMETHEUS,
508567
&AGENT_TYPE_FLUENTBIT,
509568
&AGENT_TYPE_OTEL_COLLECTOR,
569+
&AGENT_TYPE_OTEL_COLLECTOR_OLD,
510570
&AGENT_TYPE_PIPELINE_CONTROL_GATEWAY,
511571
&AGENT_TYPE_EBPF,
512572
]

agent-control/src/agent_type/embedded_registry.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ pub mod tests {
135135
}
136136
}
137137

138-
const AGENT_TYPE_AMOUNT: usize = 12;
138+
const AGENT_TYPE_AMOUNT: usize = 13;
139139

140140
#[test]
141141
fn check_agent_type_amount_is_unchanged() {

agent-control/src/config_migrate/migration/agent_config_getter.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ agents:
130130
infra-agent-c:
131131
agent_type: "newrelic/com.newrelic.infrastructure:1.0.3"
132132
not-infra-agent:
133-
agent_type: "newrelic/io.opentelemetry.collector:0.0.1"
133+
agent_type: "newrelic/com.newrelic.opentelemetry.collector:0.0.1"
134134
"#,
135135
expected: AgentControlDynamicConfig {
136136
agents: HashMap::from([
@@ -171,7 +171,7 @@ agents:
171171
infra-agent-c:
172172
agent_type: "newrelic/com.newrelic.infrastructure:1.0.3"
173173
not-infra-agent:
174-
agent_type: "newrelic/io.opentelemetry.collector:0.0.1"
174+
agent_type: "newrelic/com.newrelic.opentelemetry.collector:0.0.1"
175175
"#,
176176
expected: AgentControlDynamicConfig {
177177
agents: HashMap::from([
@@ -249,7 +249,7 @@ agents:
249249
infra-agent-b:
250250
agent_type: "newrelic/com.newrelic.infrastructure:0.0.2"
251251
not-infra-agent:
252-
agent_type: "newrelic/io.opentelemetry.collector:0.0.1"
252+
agent_type: "newrelic/com.newrelic.opentelemetry.collector:0.0.1"
253253
"#,
254254
},
255255
TestCase {
@@ -268,7 +268,7 @@ agents:
268268
infra-agent-c:
269269
agent_type: "newrelic/com.newrelic.infrastructure:1.0.3"
270270
not-infra-agent:
271-
agent_type: "newrelic/io.opentelemetry.collector:0.0.1"
271+
agent_type: "newrelic/com.newrelic.opentelemetry.collector:0.0.1"
272272
"#,
273273
},
274274
];

agent-control/tests/k8s/self_update.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ fn k8s_self_update_bump_chart_version_with_new_config() {
162162
// This agent will not actually be deployed since misses the chart_version config.
163163
let agents_config = r#"agents:
164164
nrdot:
165-
agent_type: newrelic/io.opentelemetry.collector:0.1.0
165+
agent_type: newrelic/com.newrelic.opentelemetry.collector:0.1.0
166166
"#;
167167

168168
let ac_config = format!(

agent-control/tests/k8s/store.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ agents:
266266
infra-agent-b:
267267
agent_type: "newrelic/com.newrelic.infrastructure:0.0.2"
268268
not-infra-agent:
269-
agent_type: "newrelic/io.opentelemetry.collector:0.1.0"
269+
agent_type: "newrelic/com.newrelic.opentelemetry.collector:0.1.0"
270270
"#;
271271
let remote_values_agent = RemoteConfig {
272272
config: from_str::<YAMLConfig>(agents_cfg).unwrap(),

0 commit comments

Comments
 (0)