PgBouncer
- Canonical
- Databases
Channel | Revision | Published | Runs on |
---|---|---|---|
latest/stable | 5 | 17 Jan 2022 | |
1/stable | 397 | 11 Sep 2024 | |
1/stable | 396 | 11 Sep 2024 | |
1/stable | 395 | 11 Sep 2024 | |
1/stable | 394 | 11 Sep 2024 | |
1/candidate | 397 | 02 Sep 2024 | |
1/candidate | 396 | 02 Sep 2024 | |
1/candidate | 395 | 02 Sep 2024 | |
1/candidate | 394 | 02 Sep 2024 | |
1/beta | 397 | 29 Aug 2024 | |
1/beta | 396 | 29 Aug 2024 | |
1/beta | 395 | 29 Aug 2024 | |
1/beta | 394 | 29 Aug 2024 | |
1/edge | 510 | Today | |
1/edge | 509 | Today | |
1/edge | 508 | Today | |
1/edge | 507 | Today |
juju deploy pgbouncer --channel 1/stable
Deploy universal operators easily with Juju, the Universal Operator Lifecycle Manager.
Platform:
Note: All commands are written for juju >= v3.1
If you’re using juju 2.9
, check the juju 3.0
Release Notes.
Enable tracing
This guide contains the steps to enable tracing with Grafana Tempo for your PgBouncer application.
To summarize:
- Deploy the Tempo charm in a COS K8s environment
- Integrate it with the COS charms
- Offer interfaces for cross-model integrations
- View PgBouncer traces on Grafana
Warning: This is feature is in development. It is not recommended for production environments.
This feature is available for Charmed PgBouncer revision 210+ only.
Prerequisites
Enabling tracing with Tempo requires that you:
- Have deployed a Charmed PostgreSQL application
- Have deployed a Charmed PgBouncer application in the same model as the Charmed PostgreSQL application
- Have deployed a ‘cos-lite’ bundle from the
latest/edge
track in a Kubernetes environment
Deploy Tempo
First, switch to the Kubernetes controller where the COS model is deployed:
juju switch <k8s_controller_name>:<cos_model_name>
Then, deploy the tempo-k8s
charm:
juju deploy -n 1 tempo-k8s --channel latest/edge
Integrate with the COS charms
Integrate tempo-k8s
with the COS charms as follows:
juju integrate tempo-k8s:grafana-dashboard grafana:grafana-dashboard
juju integrate tempo-k8s:grafana-source grafana:grafana-source
juju integrate tempo-k8s:ingress traefik:traefik-route
juju integrate tempo-k8s:metrics-endpoint prometheus:metrics-endpoint
juju integrate tempo-k8s:logging loki:logging
If you would like to instrument traces from the COS charms as well, create the following integrations:
juju integrate tempo-k8s:tracing alertmanager:tracing
juju integrate tempo-k8s:tracing catalogue:tracing
juju integrate tempo-k8s:tracing grafana:tracing
juju integrate tempo-k8s:tracing loki:tracing
juju integrate tempo-k8s:tracing prometheus:tracing
juju integrate tempo-k8s:tracing traefik:tracing
Offer interfaces
Next, offer interfaces for cross-model integrations from the model where Charmed PgBouncer is deployed.
To offer the Tempo integration, run
juju offer tempo-k8s:tracing
Then, switch to the Charmed PgBouncer model, find the offers, and integrate (relate) with them:
juju switch <machine_controller_name>:<pgbouncer_model_name>
juju find-offers <k8s_controller_name>:
Do not miss the “
:
” in the command above.
Below is a sample output where k8s
is the K8s controller name and cos
is the model where cos-lite
and tempo-k8s
are deployed:
Store URL Access Interfaces
k8s admin/cos.tempo-k8s admin tracing:tracing
Next, consume this offer so that it is reachable from the current model:
juju consume k8s:admin/cos.tempo-k8s
Relate Charmed PgBouncer with the above consumed interface:
juju integrate pgbouncer:tracing tempo-k8s:tracing
Wait until the model settles. The following is an example of the juju status --relations
on the Charmed PgBouncer model:
Model Controller Cloud/Region Version SLA Timestamp
database lxd localhost/localhost 3.4.3 unsupported 18:19:57Z
SAAS Status Store URL
tempo-k8s active uk8s admin/cos.tempo-k8s
App Version Status Scale Charm Channel Rev Exposed Message
pgbouncer 1.21.0 active 1 pgbouncer 1/edge 290 no
postgresql 14.11 active 1 postgresql 14/edge 436 no
postgresql-test-app active 1 postgresql-test-app latest/edge 176 no received database credentials of the first database
Unit Workload Agent Machine Public address Ports Message
postgresql-test-app/0* active idle 1 10.205.193.243 received database credentials of the first database
pgbouncer/0* active idle 10.205.193.243
postgresql/0* active idle 0 10.205.193.129 5432/tcp Primary
Machine State Address Inst id Base AZ Message
0 started 10.205.193.129 juju-6cd8c5-0 ubuntu@22.04 Running
1 started 10.205.193.243 juju-6cd8c5-1 ubuntu@22.04 Running
Integration provider Requirer Interface Type Message
pgbouncer:database postgresql-test-app:first-database postgresql_client subordinate
pgbouncer:pgb-peers pgbouncer:pgb-peers pgb_peers peer
pgbouncer:upgrade pgbouncer:upgrade upgrade peer
postgresql-test-app:postgresql-test-peers postgresql-test-app:postgresql-test-peers postgresql-test-peers peer
postgresql:database pgbouncer:backend-database postgresql_client regular
postgresql:database-peers postgresql:database-peers postgresql_peers peer
postgresql:restart postgresql:restart rolling_op peer
postgresql:upgrade postgresql:upgrade upgrade peer
tempo-k8s:tracing pgbouncer:tracing tracing regular
Note: All traces are exported to Tempo using HTTP. Support for sending traces via HTTPS is an upcoming feature.
View traces
After this is complete, the Tempo traces will be accessible from Grafana under the Explore
section with tempo-k8s
as the data source. You will be able to select pgbouncer
as the Service Name
under the Search
tab to view traces belonging to Charmed PgBouncer.
Below is a screenshot demonstrating a Charmed PgBouncer trace:
Feel free to read through the Tempo documentation at your leisure to explore its deployment and its integrations