Skip to content

Commit

Permalink
[prometheus-postgres-exporter] Add support for queries in external co…
Browse files Browse the repository at this point in the history
…nfigmap (prometheus-community#1545)

* Add support for queries in external configmap

Signed-off-by: Olivier Tassetti <[email protected]>

* Add support for queries in external configmap

Signed-off-by: Olivier Tassetti <[email protected]>

* Set value as false by default

Signed-off-by: Olivier Tassetti <[email protected]>

* Bump version to 2.4.0 since new functionality

Signed-off-by: Olivier Tassetti <[email protected]>

* fix linting trailing space

Signed-off-by: Olivier Tassetti <[email protected]>
  • Loading branch information
otassetti-talend authored Dec 2, 2021
1 parent 2fce827 commit badaf96
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion charts/prometheus-postgres-exporter/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v2
appVersion: "0.10.0"
description: A Helm chart for prometheus postgres-exporter
name: prometheus-postgres-exporter
version: 2.3.7
version: 2.4.0
home: https://github.com/prometheus-community/postgres_exporter
sources:
- https://github.com/prometheus-community/postgres_exporter
Expand Down
4 changes: 3 additions & 1 deletion charts/prometheus-postgres-exporter/templates/configmap.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{- if not .Values.config.externalQueries.enabled }}
apiVersion: v1
kind: ConfigMap
metadata:
Expand All @@ -9,4 +10,5 @@ metadata:
heritage: {{ .Release.Service }}
data:
config.yaml: |
{{ printf .Values.config.queries | indent 4 }}
{{ printf .Values.config.queries | indent 4 }}
{{- end }}
4 changes: 4 additions & 0 deletions charts/prometheus-postgres-exporter/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,11 @@ spec:
volumes:
- configMap:
defaultMode: 420
{{- if not .Values.config.externalQueries.enabled }}
name: {{ template "prometheus-postgres-exporter.fullname" . }}
{{- else }}
name: {{ .Values.config.externalQueries.configmap }}
{{- end }}
name: queries
{{- with .Values.extraVolumes }}
{{ toYaml . | indent 6 }}
Expand Down
4 changes: 4 additions & 0 deletions charts/prometheus-postgres-exporter/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,10 @@ config:
constantLabels: {}
# possible values debug, info, warn, error, fatal
logLevel: ""
# Enable queries from an external configmap, enable it will disable inline queries below
externalQueries:
enabled: false
configmap: postgresql-common-exporter-queries
# These are the default queries that the exporter will run, extracted from: https://github.com/prometheus-community/postgres_exporter/blob/master/queries.yaml
queries: |-
pg_replication:
Expand Down

0 comments on commit badaf96

Please sign in to comment.