Skip to content

Commit

Permalink
[opentelemetry] add custom labeling for prometheus (#459)
Browse files Browse the repository at this point in the history
* [opentelemetry] add custom labeling for prometheus

* [opentelemetry] bump chart

* [opentelemetry] linting

* Update opentelemetry/chart/values.yaml

Co-authored-by: Richard Tief <[email protected]>

* Update opentelemetry/chart/templates/_helpers.tpl

Co-authored-by: Richard Tief <[email protected]>

* [opentelemetry] using additonalLabels instead

* [opentelemetry] lintign

* [opentelemetry] rm label from plugindefinition

* [opentelemetry] incorporate changes from code-review

* [opentelemetry] linting

---------

Co-authored-by: Richard Tief <[email protected]>
  • Loading branch information
timojohlo and richardtief authored Oct 22, 2024
1 parent c312681 commit 07c8f52
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 9 deletions.
2 changes: 1 addition & 1 deletion opentelemetry/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Contributors are welcome to provide additional collector configurations.
`openTelemetry.openSearchLogs.endpoint` | Endpoint URL for OpenSearch | secret | `false` |
`openTelemetry.region` | Region label for logging | string | `false` |
`openTelemetry.cluster` | Cluster label for logging | string | `false` |
`openTelemetry.prometheus` | Label for Prometheus Service Monitoring | string | `false` |
`openTelemetry.prometheus.additionalLabels` | Label for Prometheus Service Monitoring | map | `false` |
`openTelemetry.podMonitor.enabled` | Activates the pod-monitoring for the LogsCollector | bool | `false` |
`opentelemetry-operator.admissionWbhooks.certManager.enabled` | Activate to use the CertManager for generating self-signed certificates | bool | `false` |
`opentelemetry-operator.admissionWebhooks.autoGenerateCert.enabled` | Activate to use Helm to create self-signed certificates | bool | `false` |
Expand Down
2 changes: 1 addition & 1 deletion opentelemetry/chart/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
apiVersion: v2
appVersion: v0.110.0
name: opentelemetry-operator
version: 0.4.0
version: 0.4.1
description: OpenTelemetry Operator Helm chart for Kubernetes
icon: https://raw.githubusercontent.com/cncf/artwork/a718fa97fffec1b9fd14147682e9e3ac0c8817cb/projects/opentelemetry/icon/color/opentelemetry-icon-color.png
type: application
Expand Down
5 changes: 4 additions & 1 deletion opentelemetry/chart/ci/test-values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,10 @@ openTelemetry:
enabled: false
podMonitor:
enabled: false
prometheus: test
prometheus:
additionalLabels:
testkey1: test1
testkey2: test2
testFramework:
enabled: false
image:
Expand Down
9 changes: 7 additions & 2 deletions opentelemetry/chart/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,14 @@ Generic plugin name

{{/* Generate plugin specific labels */}}
{{- define "plugin.labels" -}}
plugindefinition: opentelemetry
plugin: {{ $.Release.Name }}
plugindefinition: opentelemetry
{{- if .Values.global.commonLabels }}
{{ tpl (toYaml .Values.global.commonLabels) . }}
{{- end }}
{{- end }}
{{/* Generate prometheus specific labels */}}
{{- define "plugin.prometheusLabels" -}}
{{- with $.Values.openTelemetry.prometheus.additionalLabels }}
{{- tpl (toYaml . ) $ }}
{{- end }}
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ metadata:
{{- if .Values.customLabels }}
{{ toYaml .Values.customLabels | nindent 4 }}
{{- end }}
{{- include "plugin.prometheusLabels" . | nindent 4 }}
spec:
podMetricsEndpoints:
- interval: 60s
Expand Down
1 change: 1 addition & 0 deletions opentelemetry/chart/templates/smon.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ metadata:
{{- if .Values.customLabels }}
{{ toYaml .Values.customLabels | nindent 4 }}
{{- end }}
{{- include "plugin.prometheusLabels" . | nindent 4 }}
spec:
endpoints:
- port: prometheus
Expand Down
4 changes: 4 additions & 0 deletions opentelemetry/chart/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ openTelemetry:
logsCollector:
enabled: true
prometheus:
## Label selectors for the Prometheus resources to be picked up by prometheus-operator.
additionalLabels:
# plugin: kube-monitoring
# prometheus: infra
testFramework:
enabled: true
image:
Expand Down
8 changes: 4 additions & 4 deletions opentelemetry/plugindefinition.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ kind: PluginDefinition
metadata:
name: opentelemetry
spec:
version: 0.4.0
version: 0.4.1
displayName: OpenTelemetry
description: Observability framework for instrumenting, generating, collecting, and exporting telemetry data such as traces, metrics, and logs.
icon: https://raw.githubusercontent.com/cloudoperators/greenhouse-extensions/main/opentelemetry/logo.png
helmChart:
name: opentelemetry-operator
repository: oci://ghcr.io/cloudoperators/greenhouse-extensions/charts
version: 0.4.0
version: 0.4.1
options:
- default: true
description: Activates the standard configuration for logs
Expand Down Expand Up @@ -46,9 +46,9 @@ spec:
required: false
type: string
- description: Label for Prometheus Service Monitoring
name: openTelemetry.prometheus
name: openTelemetry.prometheus.additionalLabels
required: false
type: string
type: map
- default: false
description: Activates the pod-monitoring for the Logs Collector
name: openTelemetry.podMonitor.enabled
Expand Down

0 comments on commit 07c8f52

Please sign in to comment.