Skip to content

Commit 94958b9

Browse files
committed
feat: add nrdot host for host instrumentation
1 parent 747bec0 commit 94958b9

File tree

2 files changed

+54
-6
lines changed

2 files changed

+54
-6
lines changed

other-examples/collector/internal-telemetry-infra-relationships/README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ flowchart LR
3030

3131
## Requirements
3232

33-
- Your infrastructure must be instrumented which means container and/or host entities show up in NR. We recommend using the [nr-k8s-otel-collector](https://github.com/newrelic/helm-charts/tree/master/charts/nr-k8s-otel-collector) helm chart.
3433
- You need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. This example was tested on [AWS EKS](https://aws.amazon.com/eks/) with Amazon Linux nodes. The steps for achieving a container relationship should be universal for all k8s clusters - they also work on local clusters like `kind` or `minikube`.
34+
- Your infrastructure must be instrumented with one of our OTel infrastructure agents. We recommend using the [nr-k8s-otel-collector](https://github.com/newrelic/helm-charts/tree/master/charts/nr-k8s-otel-collector) helm chart for containers and [nrdot-collector-host](https://github.com/newrelic/nrdot-collector-releases/blob/main/distributions/nrdot-collector-host/README.md) for hosts, see instructions below. Please note that we're actively working on `nr-k8s-otel-collector` emitting host entities compatible with relationship synthesis which will eliminate the need for `nrdot-collector-host` but until that is done, there will be some overlap in the host telemetry these solutions scrape. If you are only interested in container relationships, you can follow the instructions below to skip installing it.
3535
- The host relationship is synthesized based on the `host.id` attribute matching up on the host and collector telemetry. The determination of this attribute heavily depends on your environment and is driven by the `resourcedetectionprocessor` which does not support local clusters out-of-the-box. You might be able to make it work by tweaking the processor configuration, but we won't cover this here as there are too many variables involved.
3636
- [A New Relic account](https://one.newrelic.com/)
3737
- [A New Relic license key](https://docs.newrelic.com/docs/apis/intro-apis/new-relic-api-keys/#license-key)
@@ -55,33 +55,33 @@ We'll use [otelcol-contrib](https://github.com/open-telemetry/opentelemetry-coll
5555

5656
## Running the example
5757

58-
1. Instrument your infrastructure, e.g. install [nr-k8s-otel-collector](https://github.com/newrelic/helm-charts/tree/master/charts/nr-k8s-otel-collector)
58+
1. Instrument your containers with [nr-k8s-otel-collector](https://github.com/newrelic/helm-charts/tree/master/charts/nr-k8s-otel-collector).
5959
```shell
6060
# Cluster name is hard coded as the downward API does not expose it
6161
license_key='INSERT_API_KEY'
6262
cluster_name='INSERT_CLUSTER_NAME'
6363
helm repo add newrelic https://helm-charts.newrelic.com
6464
helm upgrade 'nr-k8s-otel-collector-release' newrelic/nr-k8s-otel-collector \
6565
--install \
66-
--create-namespace --namespace 'nr-k8s-otel-collector' \
66+
--create-namespace --namespace 'newrelic' \
6767
--dependency-update \
6868
--set "cluster=${cluster_name}" \
6969
--set "licenseKey=${license_key}"
7070
```
7171
1. Update the values in [secrets.yaml](./k8s/secrets.yaml) based on the comments and your setup.
7272
* Note, be careful to avoid inadvertent secret sharing when modifying `secrets.yaml`. To ignore changes to this file from git, run `git update-index --skip-worktree k8s/secrets.yaml`.
7373

74-
1. Run the application with the following command.
74+
1. Deploy the collector (see `collector.yaml` - we're using [contrib](https://github.com/open-telemetry/opentelemetry-collector-releases/tree/main/distributions/otelcol-contrib) as an example) and `nrdot-collector-host` (for host instrumentation) with the following command. If you wish to skip installing `nrdot-collector-host`, you can just delete or comment out the file `k8s/nrdot-host.yaml`
7575
7676
```shell
7777
kubectl apply -f k8s/
7878
```
7979
80-
* When finished, cleanup resources with the following command. This is also useful to reset if modifying configuration.
80+
1. When finished, cleanup resources with the following command. This is also useful to reset if modifying configuration.
8181
8282
```shell
8383
kubectl delete -f k8s/
84-
helm uninstall 'nr-k8s-otel-collector-release' --namespace 'nr-k8s-otel-collector'
84+
helm uninstall 'nr-k8s-otel-collector-release' --namespace 'newrelic'
8585
```
8686
8787
## Viewing your data
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
apiVersion: apps/v1
2+
kind: DaemonSet
3+
metadata:
4+
name: nrdot-host
5+
namespace: internal-telemetry-infra-relationship
6+
labels:
7+
app.kubernetes.io/name: nrdot-host
8+
spec:
9+
selector:
10+
matchLabels:
11+
name: nrdot-host
12+
template:
13+
metadata:
14+
labels:
15+
name: nrdot-host
16+
spec:
17+
containers:
18+
- name: nrdot-host
19+
image: newrelic/nrdot-collector-host:1.3.0
20+
args:
21+
- --config=/etc/nrdot-collector-host/config.yaml
22+
- "--config=yaml:receivers::hostmetrics::root_path: /hostfs"
23+
# remove once nrdot-collector-host does this by default
24+
- "--config=yaml:processors::resourcedetection/cloud::ec2::resource_attributes::host.name::enabled: true"
25+
env:
26+
# The New Relic API key used to authenticate export requests.
27+
# Defined in secrets.yaml
28+
- name: NEW_RELIC_LICENSE_KEY
29+
valueFrom:
30+
secretKeyRef:
31+
# reusing the internal telemtry key to ensure host telemetry is colocated in the same account
32+
name: collector-internal-telemetry-secret
33+
key: NEW_RELIC_API_KEY
34+
# New Relic OTLP endpoint
35+
- name: OTEL_EXPORTER_OTLP_ENDPOINT
36+
valueFrom:
37+
secretKeyRef:
38+
name: collector-internal-telemetry-secret
39+
key: NEW_RELIC_OTLP_ENDPOINT
40+
volumeMounts:
41+
- name: hostfs
42+
mountPath: /hostfs
43+
readOnly: true
44+
volumes:
45+
- name: hostfs
46+
hostPath:
47+
path: /
48+
type: Directory

0 commit comments

Comments
 (0)