Skip to content

Commit

Permalink
code review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Mateusz Rzeszutek committed Jan 31, 2022
1 parent f1809fa commit 323b881
Showing 1 changed file with 24 additions and 20 deletions.
44 changes: 24 additions & 20 deletions specification/metrics/semantic_conventions/database-metrics.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,33 +25,37 @@ and units.
Below is a table of database client connection pool metric instruments that MUST be used by connection pool
instrumentations:

| Name | Instrument | Unit | Unit ([UCUM](README.md#instrument-units)) | Description |
|-------------------------|----------------------------|--------------|-------------------------------------------|-------------|
| `db.connections.total` | Asynchronous UpDownCounter | connections | `{connections}` | The total number of open connections.
| `db.connections.active` | Asynchronous UpDownCounter | connections | `{connections}` | The number of open connections that are currently in use.
| `db.connections.idle` | Asynchronous UpDownCounter | connections | `{connections}` | The number of open connections that are currently idle.
| Name | Instrument | Unit | Unit ([UCUM](README.md#instrument-units)) | Description |
|------------------------|----------------------------|-------------|-------------------------------------------|-------------|
| `db.connections.usage` | Asynchronous UpDownCounter | connections | `{connections}` | The number of connections that are currently in state described by the `state` attribute.

The `db.connections.usage` metric events MUST include the following attribute:

| Name | Type | Description | Examples | Required |
|---------|--------|------------------------------------------------------------------------------|----------|----------|
| `state` | string | The state of a connection in the pool. Valid values include: `idle`, `used`. | `idle` | Yes |

Instrumentation libraries for database server connection pools that collect data for the following data MUST use the
following metric instruments. Otherwise, if the instrumentation library does not collect this data, these instruments
MUST NOT be used.

| Name | Instrument | Unit | Unit ([UCUM](README.md#instrument-units)) | Description |
|----------------------------------|----------------------------|--------------|-------------------------------------------|-------------|
| `db.connections.idle.max` | Asynchronous UpDownCounter | connections | `{connections}` | The maximum number of idle open connections allowed.
| `db.connections.idle.min` | Asynchronous UpDownCounter | connections | `{connections}` | The minimum number of idle open connections allowed.
| `db.connections.max` | Asynchronous UpDownCounter | connections | `{connections}` | The maximum number of open connections allowed.
| `db.connections.pending_threads` | Asynchronous UpDownCounter | threads | `{threads}` | The number of threads that are currently waiting for an open connection.
| `db.connections.timeouts` | Counter | timeouts | `{timeouts}` | The number of connection timeouts that have happened since the application start.
| `db.connections.time` | Histogram | milliseconds | `ms` | The time it took to apply an operation described by the `operation` attribute.
| Name | Instrument | Unit | Unit ([UCUM](README.md#instrument-units)) | Description |
|-----------------------------------|----------------------------|--------------|-------------------------------------------|-------------|
| `db.connections.idle.max` | Asynchronous UpDownCounter | connections | `{connections}` | The maximum number of idle open connections allowed.
| `db.connections.idle.min` | Asynchronous UpDownCounter | connections | `{connections}` | The minimum number of idle open connections allowed.
| `db.connections.max` | Asynchronous UpDownCounter | connections | `{connections}` | The maximum number of open connections allowed.
| `db.connections.waiting_requests` | Asynchronous UpDownCounter | requests | `{requests}` | The number of pending requests for an open connection.
| `db.connections.timeouts` | Counter | timeouts | `{timeouts}` | The number of connection timeouts that have happened since the application start.
| `db.connections.time` | Histogram | milliseconds | `ms` | The time it took to apply an operation described by the `operation` attribute.

The `db.connections.time` metric events MUST include the following attribute:

| Name | Type | Description | Examples | Required |
|-------------|--------|-----------------------------------------------------------------------------------------------|----------|----------|
| `operation` | string | The type of operation applied to a connection. Valid values include: `create`, `use`, `wait`. | `create` | Yes |

Below is a table of the attributes that MUST be included on connection pool metric events:
Below is a table of the attributes that MUST be included on all connection pool metric events:

| Name | Type | Description | Examples | Required |
|-------------|--------|------------------------------------------------------------------------------|----------------|----------|
| `pool.name` | string | The name of the connection pool; unique within the instrumented application. | `myDataSource` | Yes |

The `db.connections.time` metric events MUST include the following attribute:

| Name | Type | Description | Examples | Required |
|-------------|--------|-----------------------------------------------------------------------------------------------|----------------|----------|
| `operation` | string | The type of operation applied to a connection. Valid values include: `create`, `use`, `wait`. | `create` | Yes |

0 comments on commit 323b881

Please sign in to comment.