Skip to content

Commit

Permalink
feat(metrics): split metadata extraction from otel collector
Browse files Browse the repository at this point in the history
  • Loading branch information
swiatekm-sumo committed Jun 30, 2023
1 parent 2353304 commit 7096b20
Show file tree
Hide file tree
Showing 18 changed files with 90 additions and 750 deletions.
1 change: 1 addition & 0 deletions .changelog/3122.changed.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
feat(metrics): split metadata extraction from otel collector
22 changes: 11 additions & 11 deletions deploy/helm/sumologic/conf/metrics/collector/otelcol/config.yaml
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
exporters:
{{ tpl (.Files.Get "conf/metrics/otelcol/exporters.yaml") . | indent 2 }}
otlphttp:
endpoint: http://${METADATA_METRICS_SVC}.${NAMESPACE}.svc.cluster.local.:4318
sending_queue:
queue_size: 10000
num_consumers: 10
storage: file_storage

extensions:
health_check: {}
{{ if .Values.metadata.persistence.enabled }}
## Configuration for File Storage extension
pprof: {}
file_storage:
directory: /var/lib/storage/otc
timeout: 10s
compaction:
on_rebound: true
directory: /tmp
{{ end }}
pprof: {}

processors:
{{ tpl (.Files.Get "conf/metrics/otelcol/processors.yaml") . | indent 2 }}
processors: {}

receivers:
prometheus:
Expand Down Expand Up @@ -116,11 +117,10 @@ service:
address: 0.0.0.0:8888 # this is the default, but setting it explicitly lets the operator add it automatically
extensions:
- health_check
{{- if .Values.metadata.persistence.enabled }}
- file_storage
{{- end }}
- pprof
- file_storage
pipelines:
metrics:
{{ tpl (.Files.Get "conf/metrics/otelcol/pipeline.yaml") . | indent 6 }}
exporters: [otlphttp]
receivers: [prometheus]

4 changes: 4 additions & 0 deletions deploy/helm/sumologic/conf/metrics/otelcol/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ receivers:
paths = [
{{ include "metric.endpoints" . | indent 10 }}
]
otlp:
protocols:
http:
endpoint: 0.0.0.0:4318

service:
extensions:
Expand Down
5 changes: 1 addition & 4 deletions deploy/helm/sumologic/conf/metrics/otelcol/pipeline.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,5 @@ processors:
- batch
- routing
receivers:
{{- if not .Values.sumologic.metrics.collector.otelcol.enabled }}
- telegraf
{{- else }}
- prometheus
{{- end }}
- otlp
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ spec:
enabled: true
prometheusCR:
enabled: true
serviceMonitorSelector:
serviceMonitorSelector:
{{ .Values.sumologic.metrics.collector.otelcol.serviceMonitorSelector | toYaml | nindent 8 }}
podMonitorSelector:
podMonitorSelector:
{{ .Values.sumologic.metrics.collector.otelcol.podMonitorSelector | toYaml | nindent 8 }}
{{- if .Values.sumologic.metrics.collector.otelcol.nodeSelector }}
nodeSelector:
Expand All @@ -57,12 +57,12 @@ spec:
{{- end }}
{{- end }}
env:
{{- $ctx := .Values -}}
{{- include "kubernetes.sources.envs" (dict "Context" $ctx "Type" "metrics") | nindent 4 -}}
{{- include "proxy-env-variables" . | nindent 4 -}}
{{- if .Values.metadata.metrics.statefulset.extraEnvVars }}
{{ toYaml .Values.metadata.metrics.statefulset.extraEnvVars | nindent 4 }}
{{- end }}
- name: METADATA_METRICS_SVC
value: {{ template "sumologic.metadata.name.metrics.service" . }} # no need for remote write proxy here
- name: NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
podSecurityContext:
{{ .Values.sumologic.metrics.collector.otelcol.securityContext | toYaml | nindent 4 }}
ports:
Expand All @@ -73,28 +73,13 @@ spec:
volumes:
- name: tmp
emptyDir: {}
- name: file-storage
emptyDir: {}
volumeMounts:
- name: tmp
mountPath: /tmp
{{- if .Values.metadata.persistence.enabled }}
- name: file-storage
mountPath: /var/lib/storage/otc
{{- end }}
{{- if .Values.metadata.persistence.enabled }}
volumeClaimTemplates:
- metadata:
name: file-storage
{{- if .Values.metadata.persistence.pvcLabels }}
labels:
{{ toYaml .Values.metadata.persistence.pvcLabels | indent 8 }}
{{- end }}
spec:
accessModes: [{{ .Values.metadata.persistence.accessMode }}]
storageClassName: {{ .Values.metadata.persistence.storageClass }}
resources:
requests:
storage: {{ .Values.metadata.persistence.size }}
{{- end }}
config: |
{{- (tpl (.Files.Get "conf/metrics/collector/otelcol/config.yaml") .) | nindent 4 }}
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ spec:
app: {{ template "sumologic.labels.app.metrics.pod" . }}
clusterIP: None
ports:
- name: otlphttp
port: 4318
protocol: TCP
- name: prom-write
port: 9888
targetPort: 9888
Expand Down
3 changes: 3 additions & 0 deletions deploy/helm/sumologic/templates/metrics/common/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ spec:
selector:
app: {{ template "sumologic.labels.app.metrics.pod" . }}
ports:
- name: otlphttp
port: 4318
protocol: TCP
- name: prom-write
port: 9888
targetPort: 9888
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{ if and (eq (include "metrics.otelcol.enabled" .) "true") (not .Values.sumologic.metrics.collector.otelcol.enabled) }}
{{ if eq (include "metrics.otelcol.enabled" .) "true" }}
{{ $baseConfig := (tpl (.Files.Get "conf/metrics/otelcol/config.yaml") .) | fromYaml }}
{{ $mergeConfig := .Values.metadata.metrics.config.merge }}
{{ $overrideConfig := .Values.metadata.metrics.config.override }}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{ if and (eq (include "metrics.otelcol.enabled" .) "true") (not .Values.sumologic.metrics.collector.otelcol.enabled) }}
{{ if eq (include "metrics.otelcol.enabled" .) "true" }}
apiVersion: apps/v1
kind: StatefulSet
metadata:
Expand Down Expand Up @@ -93,6 +93,9 @@ spec:
{{- toYaml .Values.metadata.metrics.statefulset.containers.otelcol.securityContext | nindent 10 }}
{{- end }}
ports:
- name: otlphttp
containerPort: 4318
protocol: TCP
- name: prom-write
containerPort: 9888
protocol: TCP
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,10 @@ data:
sumologic_schema:
add_cloud_namespace: false
receivers:
otlp:
protocols:
http:
endpoint: 0.0.0.0:4318
telegraf:
agent_config: |
[agent]
Expand Down Expand Up @@ -303,6 +307,7 @@ data:
- routing
receivers:
- telegraf
- otlp
telemetry:
logs:
level: info
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,10 @@ data:
sumologic_schema:
add_cloud_namespace: false
receivers:
otlp:
protocols:
http:
endpoint: 0.0.0.0:4318
telegraf:
agent_config: |
[agent]
Expand Down Expand Up @@ -301,6 +305,7 @@ data:
- routing
receivers:
- telegraf
- otlp
telemetry:
logs:
level: info
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ spec:
cpu: 500m
memory: 768Mi
ports:
- name: otlphttp
containerPort: 4318
protocol: TCP
- name: prom-write
containerPort: 9888
protocol: TCP
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,9 @@ spec:
cpu: 100m
memory: 777Mi
ports:
- name: otlphttp
containerPort: 4318
protocol: TCP
- name: prom-write
containerPort: 9888
protocol: TCP
Expand Down

0 comments on commit 7096b20

Please sign in to comment.