Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

monitoring: postgres metrics #51

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions deploy-postgres-exporter.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/env bash
set -e

# Description: Export Prometheus metrics from associated Postgres instance
#
# Disk: none
# Network: 100mbps
# Liveness probe: n/a
# Ports exposed to other Sourcegraph services (Prometheus target): 9187/TCP
# Ports exposed to the public internet: none
#
docker run --detach \
--name=postgres-exporter \
--network=sourcegraph \
--restart=always \
--cpus=1 \
--memory=1g \
-e DATA_SOURCE_NAME="postgresql://sourcegraph:sourcegraphd@pgsql:5432/postgres?sslmode=disable" \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@uwedeportivo Can a user specify PG* variables here individually instead of a DSN? Composing the DSN requires hard-coding the password or some weird trickery if it contains values that need to be URL-encoded

I imagine the same would be true in deploy-sourcegraph; we should probably just use the PG* variables mirroring the frontend

wrouesnel/postgres_exporter:v0.7.0@sha256:785c919627c06f540d515aac88b7966f352403f73e931e70dc2cbf783146a98b

echo "Deployed postgres-exporter service"
2 changes: 2 additions & 0 deletions prometheus/prometheus_targets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,5 @@
- gitserver-0:6060
- searcher-0:6060
- symbols-0:6060
- postgres-exporter:9187
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line should go below lsif-server on line 18; the area you put it are for entries that must be duplicated for multiple replicas