Charmed PostgreSQL VM

Channel Revision Published Runs on
latest/stable 345 09 Nov 2023
Ubuntu 22.04 Ubuntu 20.04 Ubuntu 18.04 Ubuntu 16.04 Ubuntu 14.04
latest/stable 239 09 Feb 2022
Ubuntu 22.04 Ubuntu 20.04 Ubuntu 18.04 Ubuntu 16.04 Ubuntu 14.04
latest/stable 226 01 Apr 2021
Ubuntu 22.04 Ubuntu 20.04 Ubuntu 18.04 Ubuntu 16.04 Ubuntu 14.04
14/stable 430 28 Jun 2024
Ubuntu 22.04
14/stable 429 28 Jun 2024
Ubuntu 22.04
14/candidate 429 26 Jun 2024
Ubuntu 22.04
14/candidate 430 26 Jun 2024
Ubuntu 22.04
14/beta 430 26 Jun 2024
Ubuntu 22.04
14/beta 429 26 Jun 2024
Ubuntu 22.04
14/edge 436 10 Jul 2024
Ubuntu 22.04
14/edge 435 10 Jul 2024
Ubuntu 22.04
juju deploy postgresql --channel 14/stable
Show information

Platform:

Ubuntu
22.04 20.04 18.04 16.04 14.04

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 PostgreSQL application.

To summarize:

Warning: This is feature is in development. It is not recommended for production environments.

This feature is available for Charmed PostgreSQL revision 421+ only.

Prerequisites

Enabling tracing with Tempo requires that you:


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
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 PostgreSQL is deployed.

To offer the Tempo integration, run

juju offer tempo-k8s:tracing

Then, switch to the Charmed PostgreSQL model, find the offers, and integrate (relate) with them:

juju switch <machine_controller_name>:<postgresql_model_name>

juju find-offers <k8s_controller_name>:

:exclamation: 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 PostgreSQL with the above consumed interface:

juju integrate postgresql:tracing tempo-k8s:tracing

Wait until the model settles. The following is an example of the juju status --relations on the Charmed PostgreSQL model:

Model     Controller  Cloud/Region         Version  SLA          Timestamp
database  lxd         localhost/localhost  3.4.3    unsupported  19:32:36Z

SAAS       Status  Store  URL
tempo-k8s  active  k8s    admin/cos.tempo-k8s

App         Version  Status  Scale  Charm       Channel       Rev  Exposed  Message
postgresql  14.11    active      1  postgresql  14/candidate  422  no       

Unit           Workload  Agent  Machine  Public address  Ports     Message
postgresql/1*  active    idle   1        10.205.193.156  5432/tcp  Primary

Machine  State    Address         Inst id        Base          AZ  Message
1        started  10.205.193.156  juju-ceca46-1  ubuntu@22.04      Running

Integration provider       Requirer                   Interface         Type     Message
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          postgresql: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 postgresql as the Service Name under the Search tab to view traces belonging to Charmed PostgreSQL.

Below is a screenshot demonstrating a Charmed PostgreSQL trace:

Feel free to read through the Tempo documentation at your leisure to explore its deployment and its integrations.