-
Notifications
You must be signed in to change notification settings - Fork 5k
[postgres] Showcase Postgresql monitoring with dedicated user and the role pg_monitor
#2665
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
base: main
Are you sure you want to change the base?
[postgres] Showcase Postgresql monitoring with dedicated user and the role pg_monitor
#2665
Conversation
pg_monitorpg_monitor
| # Postgres | ||
| POSTGRES_HOST=postgresql | ||
| POSTGRES_PORT=5432 | ||
| POSTGRES_DB=otel |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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
|
This PR was marked stale due to lack of activity. It will be closed in 7 days. |
Changes
pg_monitorotel->shop_dbMerge Requirements
For new features contributions, please make sure you have completed the following
essential items:
CHANGELOG.mdupdated to document new feature additionsMaintainers 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.