We are using render-oss/docker-pgbouncer for connection pooling.
We ran into a max client connection issue that brought down our system, so we wanted to integrate pgbouncer with datadog for better observability.
We want to give datadog username access to pgbouncer so that the datadog agent has permissions to start publishing pgbouncer metrics onto its platform. We’ve also modified the datadog agent deployed through render by adding the pgbouncer specific config file to our datadog agent config as instructed in the configuration section
To achieve this, we wanted to stand up pgbouncer via render.yaml like so:
Thank you Matt! And also appreciate your help via the email and your recommendations - we’re trying various approaches at the moment to get a better handle on this area of our system.
I see those instructions in the README, which actually come from the original repo. So troubleshooting that approach might make more sense with a Github issue to that original repo.
However, I took a quick look and I’m wondering if a simpler approach would be to just fork the example repo and make a few additions.
If it were me, I would try to mimic that approach and just add another similar line for your datadog user. You could base the username/password off of environment variables which you could configure in the Dashboard.
I have not set up docker secrets yet, but as a matter of end-to-end transparency, here is the current datadog agent setup in render.yaml. I use the generated password and pass it to datadog agent:
When deployed to preview env, you can run cat /etc/pgbouncer/userlist.txt on your pgbouncer resource within the terminal to ensure that the datadog user + generated password is populated. Within the datadog agent resource, you can run agent status to check to make sure that datadog agent was able to successfully access pgbouncer.
pgbouncer (6.1.0)
-----------------
Instance ID: pgbouncer:6ee89549c365f1a6 [OK]
Configuration Source: file:/etc/datadog-agent/conf.d/pgbouncer.d/conf.yaml
Total Runs: 6
Metric Samples: Last Run: 4, Total: 24
Events: Last Run: 0, Total: 0
Service Checks: Last Run: 1, Total: 6
Average Execution Time : 63ms
Last Execution Date : 2024-02-14 18:35:28 UTC (1707935728000)
Last Successful Execution Date : 2024-02-14 18:35:28 UTC (1707935728000)
metadata:
version.major: 1
version.minor: 21
version.patch: 0
version.raw: 1.21.0
version.scheme: semver
Finally, in the datadog UI, navigate to Integrations and install the PgBouncer integration. You should then be able to see a dashboard that looks like below.