Skip to content

Commit

Permalink
feat(o11y): collect Postgres metrics from staging, and prod
Browse files Browse the repository at this point in the history
Referenced `Secret`s have not been committed, because we don't yet use a secret encryption tool like `sops`, or `git-crypt`.

Signed-off-by: Siddhesh Mhadnak <[email protected]>
  • Loading branch information
sid-maddy committed Aug 31, 2024
1 parent e4f6d7b commit f305719
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 0 deletions.
50 changes: 50 additions & 0 deletions kubernetes/chart/values/o11y/vipyrsec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,24 @@ alloy:
prometheus.exporter.cadvisor "local" { }
remote.kubernetes.secret "postgres_staging" {
namespace = "postgres"
name = "staging"
}
prometheus.exporter.postgres "staging" {
data_source_names = [remote.kubernetes.secret.postgres_staging.data.dsn]
}
remote.kubernetes.secret "postgres_prod" {
namespace = "postgres"
name = "prod"
}
prometheus.exporter.postgres "prod" {
data_source_names = [remote.kubernetes.secret.postgres_prod.data.dsn]
}
prometheus.scrape "self" {
targets = prometheus.exporter.self.local.targets
forward_to = [prometheus.relabel.tagged.receiver]
Expand All @@ -100,6 +118,16 @@ alloy:
forward_to = [prometheus.relabel.tagged.receiver]
}
prometheus.scrape "postgres_staging" {
targets = prometheus.exporter.postgres.staging.targets
forward_to = [prometheus.relabel.tagged_staging.receiver]
}
prometheus.scrape "postgres_prod" {
targets = prometheus.exporter.postgres.prod.targets
forward_to = [prometheus.relabel.tagged_prod.receiver]
}
prometheus.relabel "tagged" {
rule {
source_labels = ["__address__"]
Expand All @@ -111,6 +139,28 @@ alloy:
forward_to = [prometheus.remote_write.o11y.receiver]
}
prometheus.relabel "tagged_staging" {
rule {
source_labels = ["__address__"]
regex = ".*"
replacement = "staging"
target_label = "cluster"
}
forward_to = [prometheus.remote_write.o11y.receiver]
}
prometheus.relabel "tagged_prod" {
rule {
source_labels = ["__address__"]
regex = ".*"
replacement = "prod"
target_label = "cluster"
}
forward_to = [prometheus.remote_write.o11y.receiver]
}
prometheus.remote_write "o11y" {
endpoint {
url = "http://prometheus.prometheus.svc.cluster.local:9090/api/v1/write"
Expand Down
Empty file.
6 changes: 6 additions & 0 deletions kubernetes/manifests/postgres/namespace.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
apiVersion: v1
kind: Namespace

metadata:
name: postgres

0 comments on commit f305719

Please sign in to comment.