Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a new label for scraping metrics #1190

Merged
merged 6 commits into from
Dec 1, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions deploy/helm/sumologic/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ Parameter | Description | Default
`metrics-server.args` | Arguments for metric server. | `["--kubelet-insecure-tls","--kubelet-preferred-address-types=InternalIP,ExternalIP,Hostname"]`
`fluent-bit.resources` | Resources for Fluent-bit daemonsets. | `{}`
`fluent-bit.enabled` | Flag to control deploying Fluent-bit Helm sub-chart. | `true`
`fluent-bit.service.labels` | Labels for fluent-bit service. | `{sumologic.com/scrape: "true"}`
`fluent-bit.podLabels` | Additional labels for fluent-bit pods. | `{}`
`fluent-bit.podAnnotations` | Additional annotations for fluent-bit pods. | `{}`
`fluent-bit.service.flush` | Frequency to flush fluent-bit buffer to fluentd. | `5`
Expand Down
24 changes: 24 additions & 0 deletions deploy/helm/sumologic/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,30 @@ sumologic.com/app: otelcol
sumologic.com/component: traces
{{- end -}}

{{- define "sumologic.label.scrape" -}}
sumologic.com/scrape: "true"
{{- end -}}

{{- define "sumologic.labels.scrape.logs" -}}
{{ template "sumologic.label.scrape" . }}
{{ template "sumologic.labels.logs" . }}
{{- end -}}

{{- define "sumologic.labels.scrape.metrics" -}}
{{ template "sumologic.label.scrape" . }}
{{ template "sumologic.labels.metrics" . }}
{{- end -}}

{{- define "sumologic.labels.scrape.events" -}}
{{ template "sumologic.label.scrape" . }}
{{ template "sumologic.labels.events" . }}
{{- end -}}

{{- define "sumologic.labels.scrape.traces" -}}
{{ template "sumologic.label.scrape" . }}
{{ template "sumologic.labels.traces" . }}
{{- end -}}

{{/*
Create common labels used throughout the chart.
If dryRun=true, we do not create any chart labels.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ metadata:
name: {{ template "sumologic.metadata.name.events.service-headless" . }}
labels:
app: {{ template "sumologic.labels.app.events.service-headless" . }}
{{- include "sumologic.labels.common" . | nindent 4 }}
{{- include "sumologic.labels.events" . | nindent 4 }}
spec:
selector:
app: {{ template "sumologic.labels.app.events.pod" . }}
Expand Down
2 changes: 1 addition & 1 deletion deploy/helm/sumologic/templates/events-service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ metadata:
name: {{ template "sumologic.metadata.name.events.service" . }}
labels:
app: {{ template "sumologic.labels.app.events.service" . }}
{{- include "sumologic.labels.events" . | nindent 4 }}
{{- include "sumologic.labels.scrape.events" . | nindent 4 }}
{{- include "sumologic.labels.common" . | nindent 4 }}
spec:
selector:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ metadata:
name: {{ template "sumologic.metadata.name.metrics.service-headless" . }}
labels:
app: {{ template "sumologic.labels.app.metrics.service-headless" . }}
{{- include "sumologic.labels.common" . | nindent 4 }}
{{- include "sumologic.labels.metrics" . | nindent 4 }}
spec:
selector:
app: {{ template "sumologic.labels.app.metrics.pod" . }}
Expand Down
2 changes: 1 addition & 1 deletion deploy/helm/sumologic/templates/metrics-service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ metadata:
name: {{ template "sumologic.metadata.name.metrics.service" . }}
labels:
app: {{ template "sumologic.labels.app.metrics.service" . }}
{{- include "sumologic.labels.metrics" . | nindent 4 }}
{{- include "sumologic.labels.scrape.metrics" . | nindent 4 }}
{{- include "sumologic.labels.common" . | nindent 4 }}
spec:
selector:
Expand Down
2 changes: 1 addition & 1 deletion deploy/helm/sumologic/templates/otelcol-service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ metadata:
name: {{ template "sumologic.metadata.name.otelcol.service" . }}
labels:
app: {{ template "sumologic.labels.app.otelcol.service" . }}
{{- include "sumologic.labels.traces" . | nindent 4 }}
{{- include "sumologic.labels.scrape.traces" . | nindent 4 }}
{{- include "sumologic.labels.common" . | nindent 4 }}
spec:
selector:
Expand Down
2 changes: 1 addition & 1 deletion deploy/helm/sumologic/templates/service-headless.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ metadata:
name: {{ template "sumologic.metadata.name.logs.service-headless" . }}
labels:
app: {{ template "sumologic.labels.app.logs.service-headless" . }}
{{- include "sumologic.labels.common" . | nindent 4 }}
{{- include "sumologic.labels.logs" . | nindent 4 }}
spec:
selector:
app: {{ template "sumologic.labels.app.logs.pod" . }}
Expand Down
2 changes: 1 addition & 1 deletion deploy/helm/sumologic/templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ metadata:
name: {{ template "sumologic.metadata.name.logs.service" . }}
labels:
app: {{ template "sumologic.labels.app.logs.service" . }}
{{- include "sumologic.labels.logs" . | nindent 4 }}
{{- include "sumologic.labels.scrape.logs" . | nindent 4 }}
{{- include "sumologic.labels.common" . | nindent 4 }}
spec:
selector:
Expand Down
11 changes: 11 additions & 0 deletions deploy/helm/sumologic/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -772,6 +772,12 @@ fluent-bit:
## Setting the flag to true instead of commenting out will break other functionality.
# enabled: false

## Configuration for fluent-bit service
service:
## Add custom labels to fluent-bit service
labels:
sumologic.com/scrape: "true" # label used by fluent-bit service monitor

## Add custom pod labels to fluent-bit daemonset pods
podLabels: {}

Expand Down Expand Up @@ -1225,6 +1231,7 @@ kube-prometheus-stack:
selector:
matchLabels:
sumologic.com/app: fluentd-logs
sumologic.com/scrape: "true"
- name: collection-sumologic-fluentd-metrics
additionalLabels:
sumologic.com/app: fluentd-metrics
Expand All @@ -1236,6 +1243,7 @@ kube-prometheus-stack:
selector:
matchLabels:
sumologic.com/app: fluentd-metrics
sumologic.com/scrape: "true"
- name: collection-sumologic-fluentd-events
additionalLabels:
sumologic.com/app: fluentd-events
Expand All @@ -1247,6 +1255,7 @@ kube-prometheus-stack:
selector:
matchLabels:
sumologic.com/app: fluentd-events
sumologic.com/scrape: "true"
- name: collection-fluent-bit
additionalLabels:
app: collection-fluent-bit
Expand All @@ -1259,6 +1268,7 @@ kube-prometheus-stack:
selector:
matchLabels:
app.kubernetes.io/name: fluent-bit
sumologic.com/scrape: "true"
- name: collection-sumologic-otelcol
additionalLabels:
sumologic.com/app: otelcol
Expand All @@ -1270,6 +1280,7 @@ kube-prometheus-stack:
selector:
matchLabels:
sumologic.com/app: otelcol
sumologic.com/scrape: "true"
prometheusSpec:
## Prometheus default scrape interval, default from upstream Kube Prometheus Stack Helm chart
## NOTE changing the scrape interval to be >1m can result in metrics
Expand Down