Skip to content

Commit 13be99d

Browse files
send sidecar metrics to observe directly
1 parent 9a8b9dc commit 13be99d

File tree

7 files changed

+37
-486
lines changed

7 files changed

+37
-486
lines changed

charts/agent/templates/_config-receivers.tpl

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -137,26 +137,3 @@ prometheus/cadvisor:
137137
replacement: /api/v1/nodes/$$1/proxy/metrics/cadvisor
138138
{{ end }}
139139
{{ end }}
140-
141-
{{- define "config.receivers.prometheus.kubeletstats" -}}
142-
prometheus/kubeletstats:
143-
config:
144-
scrape_configs:
145-
- job_name: 'kubernetes-nodes-kubeletstats'
146-
scheme: https
147-
tls_config:
148-
ca_file: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt
149-
insecure_skip_verify: true
150-
bearer_token_file: /var/run/secrets/kubernetes.io/serviceaccount/token
151-
152-
kubernetes_sd_configs:
153-
- role: node
154-
155-
relabel_configs:
156-
- target_label: __address__
157-
replacement: kubernetes.default.svc:443
158-
- source_labels: [__meta_kubernetes_node_name]
159-
regex: (.+)
160-
target_label: __metrics_path__
161-
replacement: /api/v1/nodes/$$1/proxy/stats/summary
162-
{{- end -}}

charts/agent/templates/_kubeletstats-sidecar.tpl

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
{{- define "observe.sidecar.fargateSidecarMetrics.config" -}}
22

3-
{{- $kubeletstatsExporters := (list "otlphttp" "debug") -}}
4-
53
receivers:
64
kubeletstats:
75
collection_interval: {{.Values.node.containers.metrics.interval}}
@@ -57,17 +55,41 @@ receivers:
5755
extra_metadata_labels:
5856
- container.id
5957

58+
processors:
59+
60+
{{- include "config.processors.memory_limiter" . | nindent 2 }}
61+
{{- include "config.processors.batch" . | nindent 2 }}
62+
{{- include "config.processors.resource_detection.cloud" . | nindent 2 }}
63+
{{- include "config.processors.attributes.k8sattributes" . | nindent 2 }}
64+
{{- include "config.processors.resource.observe_common" . | nindent 2 }}
65+
{{- include "config.processors.deltatocumulative" . | nindent 2 }}
66+
{{- include "config.processors.attributes.add_empty_service_attributes" . | nindent 2 }}
67+
{{- include "config.processors.metricstransform.duplicate_k8s_cpu_metrics" . | nindent 2 }}
68+
{{- include "config.processors.attributes.sidecar_kubeletstats_metrics" . | nindent 2 }}
69+
6070
exporters:
61-
otlphttp:
62-
endpoint: http://observe-agent-forwarder.observe.svc:4318
6371
debug:
6472
verbosity: detailed
73+
prometheusremotewrite/observe-sidecar:
74+
endpoint: "{{ .Values.observe.collectionEndpoint.value }}/v1/prometheus"
75+
headers:
76+
authorization: "Bearer {{ .Values.observe.token.value }}"
77+
remote_write_queue:
78+
num_consumers: 5
79+
max_batch_request_parallelism: 5
80+
resource_to_telemetry_conversion:
81+
enabled: true
82+
send_metadata: true
83+
timeout: 10s
84+
85+
{{ $kubeletstatsExporters := (list "debug" "prometheusremotewrite/observe-sidecar") -}}
6586

6687
service:
6788
pipelines:
6889
{{- if .Values.node.containers.metrics.enabled }}
6990
metrics/kubeletstats:
70-
receivers: [kubeletstats] # should add processors back eventually
91+
receivers: [kubeletstats]
92+
processors: [memory_limiter, metricstransform/duplicate_k8s_cpu_metrics, k8sattributes, deltatocumulative/observe, batch, resourcedetection/cloud, resource/observe_common, attributes/debug_source_sidecar_kubeletstats_metrics]
7193
exporters: [{{ join ", " $kubeletstatsExporters }}]
7294
{{- end -}}
7395
{{- end }}

charts/agent/templates/kubeletstats-sidecar.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,19 @@ metadata:
55
name: fargate-sidecar-metrics
66
spec:
77
mode: sidecar
8+
image: "ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector-contrib:latest"
89
env:
910
- name: K8S_NODE_NAME
1011
valueFrom:
1112
fieldRef:
1213
fieldPath: spec.nodeName
14+
- name: OBSERVE_CLUSTER_NAME
15+
value: "{{ .Values.cluster.name }}"
16+
- name: OBSERVE_CLUSTER_UID
17+
valueFrom:
18+
configMapKeyRef:
19+
name: cluster-info
20+
key: id
1321
config:
1422
{{- include "observe.sidecar.applyFargateSidecarMetricsConfig" . | nindent 4 }}
1523
initContainers:

charts/agent/values.yaml

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ node:
4747
# -- Enables the node-logs-metrics agent daemonset for collection of node logs and metrics.
4848
# The nodes on which metrics and logs are collected can be configured via `affinity` in the `node-logs-metrics` section below.
4949
# This should be set to false to disable the node-log-metrics daemonset when running in a serverless environment (ex: EKS Fargate).
50-
enabled: false
50+
enabled: true
5151
fargateMode: false
5252
# collects host level metrics from node
5353
metrics:
@@ -101,7 +101,6 @@ node:
101101
# this resolves issues similar to https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/26481#issuecomment-1720797914 for `no such host` or `connection refused`.
102102
useNodeIp: false
103103
forwarder:
104-
mode: deployment
105104
enabled: true
106105
traces:
107106
enabled: true
@@ -231,10 +230,6 @@ agent:
231230
# exporters:
232231
# - otlphttp/extra
233232
# - otlphttp/observe/forward/trace
234-
235-
# -- Additional OTel collector config for fargate-sidecar-metrics custom resource
236-
fargateSidecarMetrics:
237-
# Put any OTel config overrides here.
238233

239234
# -- Additional OTel collector config for gateway deployment
240235
gateway:
@@ -957,7 +952,7 @@ monitor:
957952
forwarder:
958953
# -- The forwarder is run as a daemonset by default, but can be run as a deployment by setting mode to "deployment". Deployment mode
959954
# must be used when running in a serverless environment (ex: EKS Fargate) where daemonsets are not supported.
960-
mode: deployment
955+
mode: daemonset
961956

962957
# -- The `replicaCount` is only used when `mode` is set to "deployment". It is ignored when `mode` is set to "daemonset".
963958
# In deployment mode, this sets the number of replicas (ie the number of forwarder pods to run).

cluster_role.yaml

Lines changed: 0 additions & 31 deletions
This file was deleted.

forwarder-deploy.yaml

Lines changed: 0 additions & 14 deletions
This file was deleted.

0 commit comments

Comments
 (0)