Skip to content

Conversation

@cyrille-leclerc
Copy link
Member

@cyrille-leclerc cyrille-leclerc commented Oct 20, 2025

Changes

  • Showcase Postgresql monitoring with dedicated user and the role pg_monitor
  • More realistic database name otel -> shop_db
image image

Merge Requirements

For new features contributions, please make sure you have completed the following
essential items:

  • CHANGELOG.md updated to document new feature additions
  • Appropriate documentation updates in the docs
  • Appropriate Helm chart updates in the helm-charts

Maintainers will not merge until the above have been completed. If you're unsure
which docs need to be changed ping the
@open-telemetry/demo-approvers.

@github-actions github-actions bot added the helm-update-required Requires an update to the Helm chart when released label Oct 20, 2025
@cyrille-leclerc cyrille-leclerc changed the title Showcase Postgresql monitoring with dedicated user and the role pg_monitor [postgres] Showcase Postgresql monitoring with dedicated user and the role pg_monitor Oct 20, 2025
@cyrille-leclerc cyrille-leclerc marked this pull request as ready for review October 20, 2025 08:24
@cyrille-leclerc cyrille-leclerc requested a review from a team as a code owner October 20, 2025 08:24
# Postgres
POSTGRES_HOST=postgresql
POSTGRES_PORT=5432
POSTGRES_DB=otel
Copy link
Member Author

Choose a reason for hiding this comment

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

keep the default database instance postgres and create a dedicated DB instance shop_db for the application, see init.sql for the creation of this shop_db instance.


CREATE USER otelu WITH PASSWORD 'otelp';
-- Create the shop_db database if it does not exist (uses psql \gexec)
SELECT 'CREATE DATABASE shop_db' WHERE NOT EXISTS (SELECT FROM pg_database WHERE datname = 'shop_db')\gexec
Copy link
Member Author

Choose a reason for hiding this comment

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

Create the shop_db DB instance, WHERE NOT EXISTS is not needed with the ephemeral containerized PostgreSQL instance but it's a PostgreSQL community best practice

DO
$$
BEGIN
IF NOT EXISTS (SELECT FROM pg_catalog.pg_roles WHERE rolname = 'shop_user') THEN
Copy link
Member Author

Choose a reason for hiding this comment

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

Ditto, IF NOT EXISTS is not actually needed with ephemeral container but it's a PostgreSQL community best practice

@github-actions
Copy link

This PR was marked stale due to lack of activity. It will be closed in 7 days.

@github-actions github-actions bot added the Stale label Oct 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

helm-update-required Requires an update to the Helm chart when released Stale

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant