Skip to content

Commit

Permalink
feat: collect metrics from otelcol event collector
Browse files Browse the repository at this point in the history
  • Loading branch information
swiatekm-sumo committed Jan 4, 2023
1 parent a1f7ab1 commit 859472f
Show file tree
Hide file tree
Showing 7 changed files with 50 additions and 1 deletion.
4 changes: 4 additions & 0 deletions deploy/helm/sumologic/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -675,7 +675,11 @@ sumologic.com/component: metrics
{{- end -}}

{{- define "sumologic.labels.events" -}}
{{- if eq .Values.sumologic.events.provider "fluentd" -}}
sumologic.com/app: fluentd-events
{{- else -}}
sumologic.com/app: otelcol-events
{{- end }}
sumologic.com/component: events
{{- end -}}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ spec:
{{- end }}
labels:
app: {{ template "sumologic.labels.app.events.pod" . }}
{{- include "sumologic.labels.scrape.events" . | nindent 8 }}
{{- include "sumologic.labels.common" . | nindent 8 }}
{{- if .Values.sumologic.podLabels }}
{{ toYaml .Values.sumologic.podLabels | indent 8 }}
Expand Down
12 changes: 12 additions & 0 deletions deploy/helm/sumologic/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -520,6 +520,18 @@ sumologic:
matchLabels:
sumologic.com/app: otelcol-logs-collector
sumologic.com/scrape: "true"
- name: collection-sumologic-otelcol-events
additionalLabels:
sumologic.com/app: otelcol-events
endpoints:
- port: otelcol-metrics
namespaceSelector:
matchNames:
- $(NAMESPACE)
selector:
matchLabels:
sumologic.com/app: otelcol-events
sumologic.com/scrape: "true"
- name: collection-sumologic-otelcol-traces
additionalLabels:
sumologic.com/app: otelcol
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ spec:
release: "RELEASE-NAME"
heritage: "Helm"
sumoLabel: sumoValue
sumologic.com/app: otelcol-events
sumologic.com/component: events
statefulsetLabel: statefulsetValue
spec:
serviceAccountName: RELEASE-NAME-sumologic
Expand Down
2 changes: 2 additions & 0 deletions tests/helm/events_otc_statefulset/static/basic.output.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ spec:
release: "RELEASE-NAME"
heritage: "Helm"
someLabel: someValue
sumologic.com/app: otelcol-events
sumologic.com/component: events
spec:
serviceAccountName: RELEASE-NAME-sumologic
nodeSelector:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,32 @@ items:
matchLabels:
sumologic.com/app: otelcol-logs-collector
sumologic.com/scrape: "true"
- apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: collection-sumologic-otelcol-events
namespace: sumologic
labels:
app: sumologic-prometheus

app.kubernetes.io/managed-by: Helm
app.kubernetes.io/instance: RELEASE-NAME
app.kubernetes.io/version: "%CURRENT_CHART_VERSION%"
app.kubernetes.io/part-of: sumologic
chart: sumologic-%CURRENT_CHART_VERSION%
release: "RELEASE-NAME"
heritage: "Helm"
sumologic.com/app: otelcol-events
spec:
endpoints:
- port: metrics
namespaceSelector:
matchNames:
- $(NAMESPACE)
selector:
matchLabels:
sumologic.com/app: otelcol-events
sumologic.com/scrape: "true"
- apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
Expand Down
4 changes: 3 additions & 1 deletion tests/helm/prometheus_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ kube-prometheus-stack:
"collection-sumologic-fluentd-events",
"collection-fluent-bit",
"collection-sumologic-otelcol-logs-collector",
"collection-sumologic-otelcol-events",
"collection-sumologic-otelcol-traces",
"collection-sumologic-prometheus",
"collection-sumologic-fluentd-logs-test",
Expand Down Expand Up @@ -80,7 +81,7 @@ sumologic:
TemplatePaths: allTemplatePaths,
},
{
Name: "default",
Name: "default",
ValuesYaml: "",
ExpectedNames: []string{
"collection-sumologic-fluentd-logs",
Expand All @@ -90,6 +91,7 @@ sumologic:
"collection-sumologic-fluentd-events",
"collection-fluent-bit",
"collection-sumologic-otelcol-logs-collector",
"collection-sumologic-otelcol-events",
"collection-sumologic-otelcol-traces",
"collection-sumologic-prometheus",
},
Expand Down

0 comments on commit 859472f

Please sign in to comment.