-
Notifications
You must be signed in to change notification settings - Fork 67
/
collector.yaml
74 lines (71 loc) · 2.11 KB
/
collector.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
---
apiVersion: v1
kind: Namespace
metadata:
name: nr-prometheus
---
apiVersion: v1
kind: ConfigMap
metadata:
name: collector-config
namespace: nr-prometheus
labels:
app.kubernetes.io/name: collector-config
data:
collector-config: |
receivers:
prometheus:
config:
scrape_configs:
- job_name: prometheus_data_generator
static_configs:
# Connect to prometheus data generator pod defined in prometheus-data-generator.yaml using service env vars set by k8s
- targets: [ "${PROMETHEUS_DATA_GENERATOR_SERVICE_HOST}:${PROMETHEUS_DATA_GENERATOR_SERVICE_PORT}" ]
metrics_path: /metrics
processors:
batch:
exporters:
otlphttp:
endpoint: ${NEW_RELIC_OTLP_ENDPOINT}
headers:
api-key: ${NEW_RELIC_API_KEY}
service:
pipelines:
metrics:
receivers: [prometheus]
processors: [batch]
exporters: [otlphttp]
---
apiVersion: v1
kind: Pod
metadata:
name: collector
namespace: nr-prometheus
labels:
app.kubernetes.io/name: collector
spec:
containers:
- name: collector
image: otel/opentelemetry-collector-contrib:0.98.0
env:
# The default US endpoint is set here. You can change the endpoint and port based on your requirements if needed.
# docs: https://docs.newrelic.com/docs/more-integrations/open-source-telemetry-integrations/opentelemetry/best-practices/opentelemetry-otlp/#configure-endpoint-port-protocol
- name: NEW_RELIC_OTLP_ENDPOINT
value: https://otlp.nr-data.net/
# The New Relic API key used to authenticate export requests.
# Defined in secrets.yaml
- name: NEW_RELIC_API_KEY
valueFrom:
secretKeyRef:
name: nr-prometheus-secret
key: NEW_RELIC_API_KEY
volumeMounts:
- name: collector-config-vol
mountPath: /etc/otelcol-contrib
volumes:
- name: collector-config-vol
configMap:
name: collector-config
items:
- key: collector-config
path: config.yaml