diff --git a/bitnami/cassandra/Chart.yaml b/bitnami/cassandra/Chart.yaml index a457b71628..c03147a0ad 100644 --- a/bitnami/cassandra/Chart.yaml +++ b/bitnami/cassandra/Chart.yaml @@ -23,4 +23,4 @@ name: cassandra sources: - https://github.com/bitnami/containers/tree/main/bitnami/cassandra - http://cassandra.apache.org -version: 9.5.0 +version: 9.6.0 diff --git a/bitnami/cassandra/README.md b/bitnami/cassandra/README.md index cefe95881e..74f127a2cf 100644 --- a/bitnami/cassandra/README.md +++ b/bitnami/cassandra/README.md @@ -274,6 +274,7 @@ The command removes all the Kubernetes components associated with the chart and | `metrics.serviceMonitor.labels` | Used to pass Labels that are required by the installed Prometheus Operator | `{}` | | `metrics.containerPorts.http` | HTTP Port on the Host and Container | `8080` | | `metrics.containerPorts.jmx` | JMX Port on the Host and Container | `5555` | +| `metrics.configuration` | Configure Cassandra-exporter with a custom config.yml file | `""` | ### TLS/SSL parameters diff --git a/bitnami/cassandra/templates/_helpers.tpl b/bitnami/cassandra/templates/_helpers.tpl index 9fe73bf3eb..5c715383dc 100644 --- a/bitnami/cassandra/templates/_helpers.tpl +++ b/bitnami/cassandra/templates/_helpers.tpl @@ -252,3 +252,10 @@ otherwise it generates a new one. {{- printf "%s###%s###%s" $ca $crt $key -}} {{- end }} + +{{/* +Get the metrics config map name. +*/}} +{{- define "cassandra.metricsConfConfigMap" -}} + {{- printf "%s-metrics-conf" (include "common.names.fullname" . ) | trunc 63 | trimSuffix "-" -}} +{{- end -}} diff --git a/bitnami/cassandra/templates/metrics-configmap.yaml b/bitnami/cassandra/templates/metrics-configmap.yaml new file mode 100644 index 0000000000..9ab56852f6 --- /dev/null +++ b/bitnami/cassandra/templates/metrics-configmap.yaml @@ -0,0 +1,17 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ printf "%s-metrics-conf" (include "common.names.fullname" .) | trunc 63 | trimSuffix "-" }} + namespace: {{ .Release.Namespace | quote }} + labels: {{- include "common.labels.standard" . | nindent 4 }} + app.kubernetes.io/part-of: cassandra + app.kubernetes.io/component: cassandra-exporter + {{- if .Values.commonLabels }} + {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} + {{- end }} + {{- if .Values.commonAnnotations }} + annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} + {{- end }} +data: + config.yml: |- + {{- include "common.tplvalues.render" (dict "value" .Values.metrics.configuration "context" $) | nindent 4 }} diff --git a/bitnami/cassandra/templates/statefulset.yaml b/bitnami/cassandra/templates/statefulset.yaml index 286928925a..3d1c4038b8 100644 --- a/bitnami/cassandra/templates/statefulset.yaml +++ b/bitnami/cassandra/templates/statefulset.yaml @@ -490,8 +490,11 @@ spec: failureThreshold: {{ .Values.metrics.readinessProbe.failureThreshold }} successThreshold: {{ .Values.metrics.readinessProbe.successThreshold }} {{- end }} - {{- if .Values.metrics.extraVolumeMounts }} volumeMounts: + - name: metrics-conf + mountPath: /opt/bitnami/cassandra-exporter/config.yml + subPath: config.yml + {{- if .Values.metrics.extraVolumeMounts }} {{- include "common.tplvalues.render" (dict "value" .Values.metrics.extraVolumeMounts "context" $) | nindent 12 }} {{- end }} {{- end }} @@ -499,6 +502,9 @@ spec: {{- include "common.tplvalues.render" (dict "value" .Values.sidecars "context" $) | nindent 8 }} {{- end }} volumes: + - name: metrics-conf + configMap: + name: {{ include "cassandra.metricsConfConfigMap" . }} {{- if (include "cassandra.tlsEncryption" . ) }} - name: certs secret: diff --git a/bitnami/cassandra/values.yaml b/bitnami/cassandra/values.yaml index b6356efd1c..1b0a0aa707 100644 --- a/bitnami/cassandra/values.yaml +++ b/bitnami/cassandra/values.yaml @@ -770,6 +770,67 @@ metrics: http: 8080 jmx: 5555 + ## @param metrics.configuration [string] Configure Cassandra-exporter with a custom config.yml file + ## ref: https://github.com/criteo/cassandra_exporter/blob/master/config.yml + ## + configuration: | + host: localhost:{{ .Values.metrics.containerPorts.jmx }} + ssl: False + user: + password: + listenPort: {{ .Values.metrics.containerPorts.http }} + blacklist: + # To profile the duration of jmx call you can start the program with the following options + # > java -Dorg.slf4j.simpleLogger.defaultLogLevel=trace -jar cassandra_exporter.jar config.yml --oneshot + # + # To get intuition of what is done by cassandra when something is called you can look in cassandra + # https://github.com/apache/cassandra/tree/trunk/src/java/org/apache/cassandra/metrics + # Please avoid to scrape frequently those calls that are iterating over all sstables + + # Unaccessible metrics (not enough privilege) + - java:lang:memorypool:.*usagethreshold.* + + # Leaf attributes not interesting for us but that are presents in many path + - .*:999thpercentile + - .*:95thpercentile + - .*:fifteenminuterate + - .*:fiveminuterate + - .*:durationunit + - .*:rateunit + - .*:stddev + - .*:meanrate + - .*:mean + - .*:min + + # Path present in many metrics but uninterresting + - .*:viewlockacquiretime:.* + - .*:viewreadtime:.* + - .*:cas[a-z]+latency:.* + - .*:colupdatetimedeltahistogram:.* + + # Mostly for RPC, do not scrap them + - org:apache:cassandra:db:.* + + # columnfamily is an alias for Table metrics + # https://github.com/apache/cassandra/blob/8b3a60b9a7dbefeecc06bace617279612ec7092d/src/java/org/apache/cassandra/metrics/TableMetrics.java#L162 + - org:apache:cassandra:metrics:columnfamily:.* + + # Should we export metrics for system keyspaces/tables ? + - org:apache:cassandra:metrics:[^:]+:system[^:]*:.* + + # Don't scrap us + - com:criteo:nosql:cassandra:exporter:.* + + maxScrapFrequencyInSec: + 50: + - .* + + # Refresh those metrics only every hour as it is costly for cassandra to retrieve them + 3600: + - .*:snapshotssize:.* + - .*:estimated.* + - .*:totaldiskspaceused:.* + ## @section TLS/SSL parameters ##