You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: internal/component/database_observability/README.md
+25-2Lines changed: 25 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -400,21 +400,44 @@ show track_activity_query_size;
400
400
4kB
401
401
```
402
402
403
-
6. Create a dedicated DB user and grant permissions.
403
+
6. Create a dedicated DB user and grant permissions to monitor the DB.
404
404
405
405
```sql
406
406
CREATE USER "db-o11y" WITH PASSWORD '<password>';
407
407
GRANT pg_monitor TO "db-o11y";
408
408
GRANT pg_read_all_stats TO "db-o11y";
409
409
```
410
410
411
-
7. Verify that the user has been properly created.
411
+
7. Verify that the user has been properly created and has the correct privileges for the `pg_stat_statements` extension.
412
412
413
413
```sql
414
414
-- run with the `db-o11y` user
415
415
SELECT*FROM pg_stat_statements LIMIT1;
416
416
```
417
417
418
+
8. Grant the `db-o11y` user additional privileges to access the objects (databases, schemas, tables, views) for which you want to collect detailed information.
419
+
420
+
For example, connect to a `payments` database and grant access to specific schemas:
421
+
422
+
```sql
423
+
-- switch to the 'payments' database
424
+
\c payments
425
+
426
+
-- grant USAGE and SELECT permissions in the 'public' schema
427
+
GRANT USAGE ON SCHEMA public TO "db-o11y";
428
+
GRANTSELECTON ALL TABLES IN SCHEMA public TO "db-o11y";
429
+
430
+
-- grant USAGE and SELECT permissions in the 'tests' schema
431
+
GRANT USAGE ON SCHEMA tests TO "db-o11y";
432
+
GRANTSELECTON ALL TABLES IN SCHEMA tests TO "db-o11y";
433
+
```
434
+
435
+
Alternatively, use the predefined role `pg_read_all_data` to grant `USAGE` and `SELECT` permissions to all objects at once:
436
+
437
+
```sql
438
+
GRANT pg_read_all_data TO "db-o11y";
439
+
```
440
+
418
441
### Running and configuring Alloy
419
442
420
443
1. You need to run the latest Alloy version from the `main` branch. The latest tags are available here on [Docker Hub](https://hub.docker.com/r/grafana/alloy-dev/tags) (for example, `grafana/alloy-dev:v1.10.0-devel-630bcbb` or more recent) . Additionally, the `--stability.level=experimental` CLI flag is necessary for running the `database_observability` component.
0 commit comments