-
Notifications
You must be signed in to change notification settings - Fork 67
/
collector.yaml
89 lines (86 loc) · 2.73 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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
---
apiVersion: v1
kind: Namespace
metadata:
name: nr-redis
---
apiVersion: v1
kind: ConfigMap
metadata:
name: collector-config
namespace: nr-redis
labels:
app.kubernetes.io/name: collector-config
data:
collector-config: |
receivers:
redis:
# Connect to redis pod defined in redis.yaml using service env vars set by k8s
endpoint: ${REDIS_SERVICE_HOST}:${REDIS_SERVICE_PORT}
metrics:
# Enable redis.maxmemory optional metric
redis.maxmemory:
enabled: true
processors:
batch:
# Add identifying resource attributes, which is required for New Relic entity synthesis.
# The redis receiver does not currently include any identifying attributes on the metrics it produces.
# We manually assign values to server.address and server.port, since values for ${REDIS_SERVICE_HOST} and ${REDIS_SERVICE_PORT} are unstable.
attributes/redis_metrics:
include:
match_type: regexp
metric_names:
# Notice that if with single or without quotes just one backslash is needed 'redis\..*'
- "redis\\..*"
actions:
- action: upsert
key: server.address
value: "redis"
- action: upsert
key: server.port
value: "6379"
exporters:
otlphttp:
endpoint: ${NEW_RELIC_OTLP_ENDPOINT}
headers:
api-key: ${NEW_RELIC_API_KEY}
service:
pipelines:
metrics:
receivers: [redis]
processors: [attributes/redis_metrics, batch]
exporters: [otlphttp]
---
apiVersion: v1
kind: Pod
metadata:
name: collector
namespace: nr-redis
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-redis-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