Skip to content

Commit

Permalink
feat: postgres metrics (#868)
Browse files Browse the repository at this point in the history
Signed-off-by: Kranium Gikos Mendoza <[email protected]>
  • Loading branch information
womfoo authored Jul 28, 2024
1 parent 0bb23aa commit 8a70e64
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 0 deletions.
14 changes: 14 additions & 0 deletions infrastructure/charts/node/templates/podmonitor-postgresql.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{{- if .Values.database.postgres.metrics.enabled }}
apiVersion: monitoring.coreos.com/v1
kind: PodMonitor
metadata:
name: postgres-metrics
namespace: {{ .Release.Namespace }}
spec:
podMetricsEndpoints:
- path: /metrics
port: exporter
selector:
matchLabels:
application: spilo
{{- end }}
25 changes: 25 additions & 0 deletions infrastructure/charts/node/templates/postgresql.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,28 @@ spec:
prism: prism-admin
postgresql:
version: "14"
{{- if .Values.database.postgres.metrics.enabled }}
sidecars:
- name: exporter
image: "{{ .Values.database.postgres.metrics.image.repository }}/{{ .Values.database.postgres.metrics.image.tag }}:{{ .Values.database.postgres.metrics.image.version }}"
args:
- --collector.stat_statements
ports:
- name: exporter
containerPort: 9187
protocol: TCP
resources:
limits:
cpu: 500m
memory: 256M
requests:
cpu: 100m
memory: 256M
env:
- name: DATA_SOURCE_URI
value: "127.0.0.1:5432"
- name: DATA_SOURCE_USER
value: "$(POSTGRES_USER)"
- name: DATA_SOURCE_PASS
value: "$(POSTGRES_PASSWORD)"
{{- end }}
6 changes: 6 additions & 0 deletions infrastructure/charts/node/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@ database:
managingTeam: atala
databaseSize: 4Gi
numberOfInstances: 2
metrics:
enabled: false
image:
repository: quay.io/prometheuscommunity
tag: postgres-exporter
version: v0.15.0

vdr:
externalResources:
Expand Down

0 comments on commit 8a70e64

Please sign in to comment.