Skip to content
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

Mark database semconv as release candidate #1101

Merged
merged 9 commits into from
Oct 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions .chloggen/1101.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Use this changelog template to create an entry for release notes.
#
# If your change doesn't affect end users you should instead start
# your pull request title with [chore] or use the "Skip Changelog" label.

# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
change_type: enhancement

# The name of the area of concern in the attributes-registry, (e.g. http, cloud, db)
component: db

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Mark database semantic conventions as release candidate

# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
# The values here must be integers.
issues: [ 1101 ]

# (Optional) One or more lines of additional information to render under the primary note.
# These lines will be padded with 2 spaces and then inserted directly into the document.
# Use pipe (|) for multiline entries.
subtext:
120 changes: 64 additions & 56 deletions docs/attributes-registry/db.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/database/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ path_base_for_github_subdir:

# Semantic Conventions for Database Calls and Systems

**Status**: [Experimental][DocumentStatus]
**Status**: [Mixed][DocumentStatus]

This document defines semantic conventions for database client spans as well as
database metrics and logs.
Expand Down
6 changes: 6 additions & 0 deletions docs/database/cassandra.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,21 +43,25 @@ The Semantic Conventions for [Cassandra](https://cassandra.apache.org/) extend a
**[1]:** It is RECOMMENDED to capture the value as provided by the application without attempting to do any case normalization.
If the collection name is parsed from the query text, it SHOULD be the first collection name found in the query and it SHOULD match the value provided in the query text including any schema and database name prefix.
For batch operations, if the individual operations are known to have the same collection name then that collection name SHOULD be used, otherwise `db.collection.name` SHOULD NOT be captured.
This attribute has stability level RELEASE CANDIDATE.

**[2]:** If readily available. The collection name MAY be parsed from the query text, in which case it SHOULD be the first collection name found in the query.

**[3]:** If a database system has multiple namespace components, they SHOULD be concatenated (potentially using database system specific conventions) from most general to most specific namespace component, and more specific namespaces SHOULD NOT be captured without the more general namespaces, to ensure that "startswith" queries for the more general namespaces will be valid.
Semantic conventions for individual database systems SHOULD document what `db.namespace` means in the context of that system.
It is RECOMMENDED to capture the value as provided by the application without attempting to do any case normalization.
This attribute has stability level RELEASE CANDIDATE.

**[4]:** It is RECOMMENDED to capture the value as provided by the application without attempting to do any case normalization.
If the operation name is parsed from the query text, it SHOULD be the first operation name found in the query.
For batch operations, if the individual operations are known to have the same operation name then that operation name SHOULD be used prepended by `BATCH `, otherwise `db.operation.name` SHOULD be `BATCH` or some other database system specific term if more applicable.
This attribute has stability level RELEASE CANDIDATE.

**[5]:** If readily available. The operation name MAY be parsed from the query text, in which case it SHOULD be the first operation name found in the query.

**[6]:** The status code returned by the database. Usually it represents an error code, but may also represent partial success, warning, or differentiate between various types of successful outcomes.
Semantic conventions for individual database systems SHOULD document what `db.response.status_code` means in the context of that system.
This attribute has stability level RELEASE CANDIDATE.

**[7]:** If the operation failed and status code is available.

Expand All @@ -74,6 +78,7 @@ Instrumentations SHOULD document how `error.type` is populated.
**[12]:** For sanitization see [Sanitization of `db.query.text`](../../docs/database/database-spans.md#sanitization-of-dbquerytext).
For batch operations, if the individual operations are known to have the same query text then that query text SHOULD be used, otherwise all of the individual query texts SHOULD be concatenated with separator `; ` or some other database system specific separator if more applicable.
Even though parameterized query text can potentially have sensitive data, by using a parameterized query the user is giving a strong signal that any sensitive data will be passed as parameter values, and the benefit to observability of capturing the static part of the query text by default outweighs the risk.
This attribute has stability level RELEASE CANDIDATE.

**[13]:** SHOULD be collected by default only if there is sanitization that excludes sensitive information. See [Sanitization of `db.query.text`](../../docs/database/database-spans.md#sanitization-of-dbquerytext).

Expand All @@ -83,6 +88,7 @@ Even though parameterized query text can potentially have sensitive data, by usi

**[16]:** Query parameters should only be captured when `db.query.text` is parameterized with placeholders.
If a parameter has no name and instead is referenced only by index, then `<key>` SHOULD be the 0-based index.
This attribute has stability level RELEASE CANDIDATE.



Expand Down
3 changes: 3 additions & 0 deletions docs/database/cosmosdb.md
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ additional values when introducing new operations.

**[5]:** The status code returned by the database. Usually it represents an error code, but may also represent partial success, warning, or differentiate between various types of successful outcomes.
Semantic conventions for individual database systems SHOULD document what `db.response.status_code` means in the context of that system.
This attribute has stability level RELEASE CANDIDATE.

**[6]:** The `error.type` SHOULD match the `db.response.status_code` returned by the database or the client library, or the canonical name of exception that occurred.
When using canonical exception type name, instrumentation SHOULD do the best effort to report the most relevant type. For example, if the original exception is wrapped into a generic one, the original exception SHOULD be preferred.
Expand All @@ -189,6 +190,7 @@ Instrumentations SHOULD document how `error.type` is populated.
**[10]:** For sanitization see [Sanitization of `db.query.text`](../../docs/database/database-spans.md#sanitization-of-dbquerytext).
For batch operations, if the individual operations are known to have the same query text then that query text SHOULD be used, otherwise all of the individual query texts SHOULD be concatenated with separator `; ` or some other database system specific separator if more applicable.
Even though parameterized query text can potentially have sensitive data, by using a parameterized query the user is giving a strong signal that any sensitive data will be passed as parameter values, and the benefit to observability of capturing the static part of the query text by default outweighs the risk.
This attribute has stability level RELEASE CANDIDATE.

**[11]:** SHOULD be collected by default only if there is sanitization that excludes sensitive information. See [Sanitization of `db.query.text`](../../docs/database/database-spans.md#sanitization-of-dbquerytext).

Expand All @@ -200,6 +202,7 @@ Even though parameterized query text can potentially have sensitive data, by usi

**[14]:** Query parameters should only be captured when `db.query.text` is parameterized with placeholders.
If a parameter has no name and instead is referenced only by index, then `<key>` SHOULD be the 0-based index.
This attribute has stability level RELEASE CANDIDATE.



Expand Down
1 change: 1 addition & 0 deletions docs/database/couchdb.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ The Semantic Conventions for [CouchDB](https://couchdb.apache.org/) extend and o

**[3]:** The status code returned by the database. Usually it represents an error code, but may also represent partial success, warning, or differentiate between various types of successful outcomes.
Semantic conventions for individual database systems SHOULD document what `db.response.status_code` means in the context of that system.
This attribute has stability level RELEASE CANDIDATE.

**[4]:** If response was received and the HTTP response code is available.

Expand Down
66 changes: 35 additions & 31 deletions docs/database/database-metrics.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,25 @@ linkTitle: Metrics

# Semantic Conventions for Database Metrics

**Status**: [Experimental][DocumentStatus]

The conventions described in this section are specific to SQL and NoSQL clients.

**Disclaimer:** These are initial database client metric instruments
and attributes but more may be added in the future.
**Status**: [Mixed][DocumentStatus]

<!-- Re-generate TOC with `markdown-toc --no-first-h1 -i` -->

<!-- toc -->

- [Database operation](#database-operation)
- [Metric: `db.client.operation.duration`](#metric-dbclientoperationduration)
- [Connection pools](#connection-pools)
- [Metric: `db.client.connection.count`](#metric-dbclientconnectioncount)
- [Metric: `db.client.connection.idle.max`](#metric-dbclientconnectionidlemax)
- [Metric: `db.client.connection.idle.min`](#metric-dbclientconnectionidlemin)
- [Metric: `db.client.connection.max`](#metric-dbclientconnectionmax)
- [Metric: `db.client.connection.pending_requests`](#metric-dbclientconnectionpending_requests)
- [Metric: `db.client.connection.timeouts`](#metric-dbclientconnectiontimeouts)
- [Metric: `db.client.connection.create_time`](#metric-dbclientconnectioncreate_time)
- [Metric: `db.client.connection.wait_time`](#metric-dbclientconnectionwait_time)
- [Metric: `db.client.connection.use_time`](#metric-dbclientconnectionuse_time)
- [Experimental](#experimental)
- [Connection pools](#connection-pools)
- [Metric: `db.client.connection.count`](#metric-dbclientconnectioncount)
- [Metric: `db.client.connection.idle.max`](#metric-dbclientconnectionidlemax)
- [Metric: `db.client.connection.idle.min`](#metric-dbclientconnectionidlemin)
- [Metric: `db.client.connection.max`](#metric-dbclientconnectionmax)
- [Metric: `db.client.connection.pending_requests`](#metric-dbclientconnectionpending_requests)
- [Metric: `db.client.connection.timeouts`](#metric-dbclientconnectiontimeouts)
- [Metric: `db.client.connection.create_time`](#metric-dbclientconnectioncreate_time)
- [Metric: `db.client.connection.wait_time`](#metric-dbclientconnectionwait_time)
- [Metric: `db.client.connection.use_time`](#metric-dbclientconnectionuse_time)

<!-- tocstop -->

Expand Down Expand Up @@ -60,7 +56,7 @@ and attributes but more may be added in the future.

### Metric: `db.client.operation.duration`

**Status**: [Experimental][DocumentStatus]
**Status**: [Release Candidate][DocumentStatus]

This metric is [required][MetricRequired].

Expand Down Expand Up @@ -99,25 +95,30 @@ of `[ 0.001, 0.005, 0.01, 0.05, 0.1, 0.5, 1, 5, 10 ]`.
| [`server.address`](/docs/attributes-registry/server.md) | string | Name of the database host. [13] | `example.com`; `10.1.2.80`; `/tmp/my.sock` | `Recommended` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) |

**[1]:** The actual DBMS may differ from the one identified by the client. For example, when using PostgreSQL client libraries to connect to a CockroachDB, the `db.system` is set to `postgresql` based on the instrumentation's best knowledge.
This attribute has stability level RELEASE CANDIDATE.

**[2]:** It is RECOMMENDED to capture the value as provided by the application without attempting to do any case normalization.
If the collection name is parsed from the query text, it SHOULD be the first collection name found in the query and it SHOULD match the value provided in the query text including any schema and database name prefix.
For batch operations, if the individual operations are known to have the same collection name then that collection name SHOULD be used, otherwise `db.collection.name` SHOULD NOT be captured.
This attribute has stability level RELEASE CANDIDATE.

**[3]:** If readily available. The collection name MAY be parsed from the query text, in which case it SHOULD be the first collection name in the query.

**[4]:** If a database system has multiple namespace components, they SHOULD be concatenated (potentially using database system specific conventions) from most general to most specific namespace component, and more specific namespaces SHOULD NOT be captured without the more general namespaces, to ensure that "startswith" queries for the more general namespaces will be valid.
Semantic conventions for individual database systems SHOULD document what `db.namespace` means in the context of that system.
It is RECOMMENDED to capture the value as provided by the application without attempting to do any case normalization.
This attribute has stability level RELEASE CANDIDATE.

**[5]:** It is RECOMMENDED to capture the value as provided by the application without attempting to do any case normalization.
If the operation name is parsed from the query text, it SHOULD be the first operation name found in the query.
For batch operations, if the individual operations are known to have the same operation name then that operation name SHOULD be used prepended by `BATCH `, otherwise `db.operation.name` SHOULD be `BATCH` or some other database system specific term if more applicable.
This attribute has stability level RELEASE CANDIDATE.

**[6]:** If readily available. The operation name MAY be parsed from the query text, in which case it SHOULD be the first operation name found in the query.

**[7]:** The status code returned by the database. Usually it represents an error code, but may also represent partial success, warning, or differentiate between various types of successful outcomes.
Semantic conventions for individual database systems SHOULD document what `db.response.status_code` means in the context of that system.
This attribute has stability level RELEASE CANDIDATE.

**[8]:** If the operation failed and status code is available.

Expand Down Expand Up @@ -166,20 +167,20 @@ If a database operation involved multiple network calls (for example retries), t
| `instantdb` | InstantDB | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| `interbase` | InterBase | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| `intersystems_cache` | InterSystems Caché | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| `mariadb` | MariaDB | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| `mariadb` | MariaDB (This value has stability level RELEASE CANDIDATE) | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| `maxdb` | SAP MaxDB | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| `memcached` | Memcached | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| `mongodb` | MongoDB | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| `mssql` | Microsoft SQL Server | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| `mysql` | MySQL | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| `mssql` | Microsoft SQL Server (This value has stability level RELEASE CANDIDATE) | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| `mysql` | MySQL (This value has stability level RELEASE CANDIDATE) | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| `neo4j` | Neo4j | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| `netezza` | Netezza | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| `opensearch` | OpenSearch | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| `oracle` | Oracle Database | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| `other_sql` | Some other SQL database. Fallback only. See notes. | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| `pervasive` | Pervasive PSQL | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| `pointbase` | PointBase | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| `postgresql` | PostgreSQL | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| `postgresql` | PostgreSQL (This value has stability level RELEASE CANDIDATE) | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| `progress` | Progress Database | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| `redis` | Redis | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| `redshift` | Amazon Redshift | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
Expand All @@ -204,11 +205,13 @@ If a database operation involved multiple network calls (for example retries), t
<!-- END AUTOGENERATED TEXT -->
<!-- endsemconv -->

## Connection pools
## Experimental

### Connection pools

The following metric instruments describe database client connection pool operations.

### Metric: `db.client.connection.count`
#### Metric: `db.client.connection.count`

This metric is [required][MetricRequired].

Expand Down Expand Up @@ -241,7 +244,8 @@ This metric is [required][MetricRequired].
<!-- prettier-ignore-end -->
<!-- END AUTOGENERATED TEXT -->
<!-- endsemconv -->
### Metric: `db.client.connection.idle.max`

#### Metric: `db.client.connection.idle.max`

This metric is [recommended][MetricRecommended].

Expand All @@ -266,7 +270,7 @@ This metric is [recommended][MetricRecommended].
<!-- END AUTOGENERATED TEXT -->
<!-- endsemconv -->

### Metric: `db.client.connection.idle.min`
#### Metric: `db.client.connection.idle.min`

This metric is [recommended][MetricRecommended].

Expand All @@ -291,7 +295,7 @@ This metric is [recommended][MetricRecommended].
<!-- END AUTOGENERATED TEXT -->
<!-- endsemconv -->

### Metric: `db.client.connection.max`
#### Metric: `db.client.connection.max`

This metric is [recommended][MetricRecommended].

Expand All @@ -316,7 +320,7 @@ This metric is [recommended][MetricRecommended].
<!-- END AUTOGENERATED TEXT -->
<!-- endsemconv -->

### Metric: `db.client.connection.pending_requests`
#### Metric: `db.client.connection.pending_requests`

This metric is [recommended][MetricRecommended].

Expand All @@ -341,7 +345,7 @@ This metric is [recommended][MetricRecommended].
<!-- END AUTOGENERATED TEXT -->
<!-- endsemconv -->

### Metric: `db.client.connection.timeouts`
#### Metric: `db.client.connection.timeouts`

This metric is [recommended][MetricRecommended].

Expand All @@ -366,7 +370,7 @@ This metric is [recommended][MetricRecommended].
<!-- END AUTOGENERATED TEXT -->
<!-- endsemconv -->

### Metric: `db.client.connection.create_time`
#### Metric: `db.client.connection.create_time`

This metric is [recommended][MetricRecommended].

Expand All @@ -391,7 +395,7 @@ This metric is [recommended][MetricRecommended].
<!-- END AUTOGENERATED TEXT -->
<!-- endsemconv -->

### Metric: `db.client.connection.wait_time`
#### Metric: `db.client.connection.wait_time`

This metric is [recommended][MetricRecommended].

Expand All @@ -416,7 +420,7 @@ This metric is [recommended][MetricRecommended].
<!-- END AUTOGENERATED TEXT -->
<!-- endsemconv -->

### Metric: `db.client.connection.use_time`
#### Metric: `db.client.connection.use_time`

This metric is [recommended][MetricRecommended].

Expand Down
Loading
Loading