Skip to content

Commit 5368123

Browse files
committed
docs(instrumentation-pg): document span types created by instrumentation
Add documentation to README.md explaining the three span types created: - `pg.query:<OPERATION> <database>` - query execution spans - `pg.connect` - client connection spans - `pg-pool.connect` - pool connection acquisition spans Include guidance on when `pg-pool.connect` spans are useful vs potentially noisy in high-throughput scenarios.
1 parent 53a6c94 commit 5368123

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

packages/instrumentation-pg/README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,18 @@ registerInstrumentations({
3939

4040
PgInstrumentation contains both pg and [`pg.Pool`](https://node-postgres.com/api/pool) so it will be instrumented automatically.
4141

42+
### Span Types Created
43+
44+
This instrumentation creates the following span types:
45+
46+
| Span Name | Description | When Created |
47+
| --------- | ----------- | ------------ |
48+
| `pg.query:<OPERATION> <database>` | Database query execution | When `client.query()` is called |
49+
| `pg.connect` | Client connection to database | When `new Client().connect()` is called directly |
50+
| `pg-pool.connect` | Pool connection acquisition wait time | When acquiring a connection from `pg-pool` |
51+
52+
The `pg-pool.connect` spans measure the time spent waiting to acquire a connection from the pool. This can be valuable for identifying connection pool exhaustion or sizing issues. However, in high-throughput scenarios where connections are readily available, these spans may add noise with minimal diagnostic value. Consider using the `requireParentSpan` option or sampling strategies if pool connect spans become excessive.
53+
4254
### PostgreSQL Instrumentation Options
4355

4456
PostgreSQL instrumentation has few options available to choose from. You can set the following:

0 commit comments

Comments
 (0)