Skip to content

Commit

Permalink
chore(opentelemetry): revise prometheus monitoring (#460)
Browse files Browse the repository at this point in the history
* chore(opentelemetry): revise prometheus monitoring

- grouped the prometheus-related values into one directive
- PodMonitor and ServiceMonitor are enabled by default
- Added indication whether `monitoring.coreos.com/v1` is available on the cluster
- plugindefinition updated

* docs(opentelemetry): reword option value description

* fix(opentelemetry): invoke built-in object

* chore(opentelemetry) update README

* chore(opentelemetry) adjust threshold

---------

Co-authored-by: I504010 <[email protected]>
  • Loading branch information
richardtief and timojohlo authored Oct 24, 2024
1 parent 07c8f52 commit 73a4553
Show file tree
Hide file tree
Showing 9 changed files with 37 additions and 32 deletions.
8 changes: 4 additions & 4 deletions opentelemetry/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@ 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.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.prometheus.additionalLabels` | Label selector for Prometheus resources to be picked-up by the operator | map | `false` |
`openTelemetry.prometheus.serviceMonitor.enabled` | Activates the service-monitoring for the Logs Collector | bool | `false` |
`openTelemetry.prometheus.podMonitor.enabled` | Activates the pod-monitoring for the Logs Collector | bool | `false` |
`openTelemetry-operator.admissionWebhooks.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` |
`opentelemetry-operator.admissionWebhooks.autoGenerateCert.recreate` | Activate to recreate the cert after a defined period (certPeriodDays default is 365) | bool | `false` |
`opentelemetry-operator.kubeRBACProxy.enabled` | Activate to enable Kube-RBAC-Proxy for OpenTelemetry | bool | `false` |
`opentelemetry-operator.manager.prometheusRule.defaultRules.enabled` | Activate to enable default rules for monitoring the OpenTelemetry Manager | bool | `false` |
`opentelemetry-operator.manager.prometheusRule.enabled` | Activate to enable rules for monitoring the OpenTelemetry Manager | bool | `false` |
`opentelemetry-operator.manager.serviceMonitor.enabled` | Activate to enable the Service Monitor to ingest the metrics of the OpenTelemetry Collector in Prometheus | bool | `false` |

### Examples

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.1
version: 0.4.2
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
10 changes: 2 additions & 8 deletions opentelemetry/chart/ci/test-values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,10 @@ openTelemetry:
password: test
cluster: test
region: test
logsCollector:
enabled: true
metricsCollector:
enabled: false
podMonitor:
enabled: false
prometheus:
additionalLabels:
testkey1: test1
testkey2: test2
key1: value1
key2: value2
testFramework:
enabled: false
image:
Expand Down
8 changes: 4 additions & 4 deletions opentelemetry/chart/dashboards/otel-logs.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"gnetId": null,
"graphTooltip": 0,
"id": 291,
"iteration": 1729071061818,
"iteration": 1729766555603,
"links": [],
"panels": [
{
Expand Down Expand Up @@ -62,7 +62,7 @@
},
{
"color": "green",
"value": 11
"value": 1
}
]
}
Expand Down Expand Up @@ -2760,7 +2760,7 @@
{
"allValue": null,
"current": {
"selected": false,
"selected": true,
"text": "opensearch/logs",
"value": "opensearch/logs"
},
Expand Down Expand Up @@ -2827,7 +2827,7 @@
{
"allValue": null,
"current": {
"selected": false,
"selected": true,
"text": "_total",
"value": "_total"
},
Expand Down
10 changes: 5 additions & 5 deletions opentelemetry/chart/templates/logs-collector.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ spec:
envFrom:
- secretRef:
name: otel-basic-auth
{{- if .Values.openTelemetry.podMonitor.enabled }}
{{- if .Values.openTelemetry.prometheus.podMonitor.enabled }}
ports:
- name: prometheus
port: 9999
Expand Down Expand Up @@ -71,7 +71,7 @@ spec:
field: resource["container.runtime"]
value: "containerd"

{{- if .Values.openTelemetry.podMonitor.enabled }}
{{- if .Values.openTelemetry.prometheus.podMonitor.enabled }}
prometheus/internal:
config:
scrape_configs:
Expand All @@ -87,7 +87,7 @@ spec:
timeout: 5s
send_batch_size : 10

{{- if .Values.openTelemetry.podMonitor.enabled }}
{{- if .Values.openTelemetry.prometheus.podMonitor.enabled }}
attributes/prometheus:
actions:
- action: insert
Expand Down Expand Up @@ -353,7 +353,7 @@ spec:
service:
extensions:
- basicauth
{{- if .Values.openTelemetry.podMonitor.enabled }}
{{- if .Values.openTelemetry.prometheus.podMonitor.enabled }}
telemetry:
metrics:
address: 127.0.0.1:8888
Expand All @@ -372,7 +372,7 @@ spec:
receivers: [journald]
processors: [attributes/cluster,transform/journal,batch]
exporters: [opensearch/logs]
{{- if .Values.openTelemetry.podMonitor.enabled }}
{{- if .Values.openTelemetry.prometheus.podMonitor.enabled }}
metrics/prometheus:
receivers: [prometheus/internal]
processors: [attributes/prometheus]
Expand Down
2 changes: 1 addition & 1 deletion opentelemetry/chart/templates/pmon-filelog.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
SPDX-FileCopyrightText: 2024 SAP SE or an SAP affiliate company and Greenhouse contributors
SPDX-License-Identifier: Apache-2.0
*/}}
{{- if .Values.openTelemetry.podMonitor.enabled }}
{{- if and (.Capabilities.APIVersions.Has "monitoring.coreos.com/v1") .Values.openTelemetry.prometheus.podMonitor.enabled }}
apiVersion: monitoring.coreos.com/v1
kind: PodMonitor
metadata:
Expand Down
2 changes: 1 addition & 1 deletion opentelemetry/chart/templates/smon.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
SPDX-FileCopyrightText: 2024 SAP SE or an SAP affiliate company and Greenhouse contributors
SPDX-License-Identifier: Apache-2.0
*/}}
{{- if index .Values "opentelemetry-operator" "manager" "serviceMonitor" "enabled" }}
{{- if and (.Capabilities.APIVersions.Has "monitoring.coreos.com/v1") .Values.openTelemetry.prometheus.serviceMonitor.enabled }}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
Expand Down
8 changes: 7 additions & 1 deletion opentelemetry/chart/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,15 @@ openTelemetry:
region:
logsCollector:
enabled: true
metricsCollector:
enabled: false
prometheus:
serviceMonitor:
enabled: true
podMonitor:
enabled: true
## Label selectors for the Prometheus resources to be picked up by prometheus-operator.
additionalLabels:
additionalLabels: {}
# plugin: kube-monitoring
# prometheus: infra
testFramework:
Expand Down
19 changes: 12 additions & 7 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.1
version: 0.4.2
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.1
version: 0.4.2
options:
- default: true
description: Activates the standard configuration for logs
Expand Down Expand Up @@ -45,15 +45,20 @@ spec:
name: openTelemetry.cluster
required: false
type: string
- description: Label for Prometheus Service Monitoring
name: openTelemetry.prometheus.additionalLabels
required: false
type: map
- default: false
description: Activates the pod-monitoring for the Logs Collector
name: openTelemetry.podMonitor.enabled
name: openTelemetry.prometheus.podMonitor.enabled
required: false
type: bool
- default: false
description: Activates the service-monitoring for the Logs Collector
name: openTelemetry.prometheus.serviceMonitor.enabled
required: false
type: bool
- description: Label selector for Prometheus resources to be picked-up by the operator
name: openTelemetry.prometheus.additionalLabels
required: false
type: map
- default: false
description: Activate to use the CertManager for generating self-signed certificates
name: opentelemetry-operator.admissionWebhooks.certManager.enabled
Expand Down

0 comments on commit 73a4553

Please sign in to comment.