You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by GitBox <gi...@apache.org> on 2022/09/23 06:38:35 UTC

[GitHub] [skywalking] kezhenxu94 commented on a diff in pull request #9673: Support monitoring PostgreSQL slow SQLs.

kezhenxu94 commented on code in PR #9673:
URL: https://github.com/apache/skywalking/pull/9673#discussion_r978305128


##########
test/e2e-v2/cases/postgresql/postgres-exporter/docker-compose.yml:
##########
@@ -20,23 +20,42 @@ services:
     extends:
       file: ../../../script/docker-compose/base-compose.yml
       service: oap
+    entrypoint: ['sh', '-c', '/download-mysql.sh && chmod 777 /skywalking/docker-entrypoint.sh && /skywalking/docker-entrypoint.sh']

Review Comment:
   This is only needed when we use mysql driver, but psql does not use mysql driver, right?
   
   ```suggestion
   ```



##########
docs/en/setup/backend/backend-postgresql-monitoring.md:
##########
@@ -44,8 +45,33 @@ PostgreSQL monitoring provides monitoring of the status and resources of the Pos
 | Idle Sessions |      | meter_pg_idle_sessions | The number of connections which state is idle,idle in transaction or idle in transaction (aborted)  | postgres-exporter|
 | Locks Count |      | meter_pg_locks_count | Number of locks  | postgres-exporter|
 
-
-## Customizations
+### Customizations
 You can customize your own metrics/expression/dashboard panel.
 The metrics definition and expression rules are found in `/config/otel-rules/postgresql.yaml`.
 The PostgreSQL dashboard panel configurations are found in `/config/ui-initialized-templates/postgresql`.
+
+## Collect sampled slow SQLs
+SkyWalking leverages [fluentbit](https://fluentbit.io/) or other log agents for collecting slow SQL statements from PostgreSQL.
+
+### Data flow
+1. fluentbit agent collects slow sql logs from PostgreSQL.
+2. fluentbit agent sends data to SkyWalking OAP Server using native meter APIs via HTTP.

Review Comment:
   ```suggestion
   2. fluentbit agent sends data to SkyWalking OAP Server using native log APIs via HTTP.
   ```



##########
docs/en/setup/backend/backend-postgresql-monitoring.md:
##########
@@ -44,8 +45,33 @@ PostgreSQL monitoring provides monitoring of the status and resources of the Pos
 | Idle Sessions |      | meter_pg_idle_sessions | The number of connections which state is idle,idle in transaction or idle in transaction (aborted)  | postgres-exporter|
 | Locks Count |      | meter_pg_locks_count | Number of locks  | postgres-exporter|
 
-
-## Customizations
+### Customizations
 You can customize your own metrics/expression/dashboard panel.
 The metrics definition and expression rules are found in `/config/otel-rules/postgresql.yaml`.
 The PostgreSQL dashboard panel configurations are found in `/config/ui-initialized-templates/postgresql`.
+
+## Collect sampled slow SQLs
+SkyWalking leverages [fluentbit](https://fluentbit.io/) or other log agents for collecting slow SQL statements from PostgreSQL.
+
+### Data flow
+1. fluentbit agent collects slow sql logs from PostgreSQL.
+2. fluentbit agent sends data to SkyWalking OAP Server using native meter APIs via HTTP.
+3. The SkyWalking OAP Server parses the expression with [LAL](../../concepts-and-designs/lal.md) to parse/extract and store the results.
+
+### Set up
+1. Set up [fluentbit](https://docs.fluentbit.io/manual/installation/docker).
+2. Config [fluentbit](../../../../test/e2e-v2/cases/postgresql/postgres-exporter/fluent-bit.conf)
+3. Config PostgreSQL to enable slow log.[example](../../../../test/e2e-v2/cases/postgresql/postgres-exporter/postgresql.conf).

Review Comment:
   ```suggestion
   3. Config PostgreSQL to enable slow log. [Example](../../../../test/e2e-v2/cases/postgresql/postgres-exporter/postgresql.conf).
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org