Skip to content

Commit

Permalink
feat: Add MySQL instance address attribute (open-telemetry#345)
Browse files Browse the repository at this point in the history
Co-authored-by: Alexander Wert <AlexanderWert@users.noreply.github.com>
  • Loading branch information
arielvalentin and AlexanderWert authored Nov 30, 2023
1 parent fc73453 commit efd9345
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/attributes-registry/db.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
| Attribute | Type | Description | Examples |
|---|---|---|---|
| `db.connection_string` | string | The connection string used to connect to the database. It is recommended to remove embedded credentials. | `Server=(localdb)\v11.0;Integrated Security=true;` |
| `db.instance.id` | string | An identifier (address, unique name, or any other identifier) of the database instance that is executing queries or mutations on the current connection. This is useful in cases where the database is running in a clustered environment and the instrumentation is able to record the node executing the query. The client may obtain this value in databases like MySQL using queries like `select @@hostname`. | `mysql-e26b99z.example.com` |
| `db.name` | string | This attribute is used to report the name of the database being accessed. For commands that switch the database, this should be set to the target database (even if the command fails). [1] | `customers`; `main` |
| `db.operation` | string | The name of the operation being executed, e.g. the [MongoDB command name](https://docs.mongodb.com/manual/reference/command/#database-operations) such as `findAndModify`, or the SQL keyword. [2] | `findAndModify`; `HMSET`; `SELECT` |
| `db.statement` | string | The database statement being executed. | `SELECT * FROM wuser_table`; `SET mykey "WuValue"` |
Expand Down
1 change: 1 addition & 0 deletions docs/database/database-spans.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ Some database systems may allow a connection to switch to a different `db.user`,
| Attribute | Type | Description | Examples | Requirement Level |
|---|---|---|---|---|
| [`db.connection_string`](../attributes-registry/db.md) | string | The connection string used to connect to the database. It is recommended to remove embedded credentials. | `Server=(localdb)\v11.0;Integrated Security=true;` | Recommended |
| [`db.instance.id`](../attributes-registry/db.md) | string | An identifier (address, unique name, or any other identifier) of the database instance that is executing queries or mutations on the current connection. This is useful in cases where the database is running in a clustered environment and the instrumentation is able to record the node executing the query. The client may obtain this value in databases like MySQL using queries like `select @@hostname`. | `mysql-e26b99z.example.com` | Recommended: If different from the `server.address` |
| [`db.system`](../attributes-registry/db.md) | string | An identifier for the database management system (DBMS) product being used. See below for a list of well-known identifiers. | `other_sql` | Required |
| [`db.user`](../attributes-registry/db.md) | string | Username for accessing the database. | `readonly_user`; `reporting_user` | Recommended |
| [`network.peer.address`](../attributes-registry/network.md) | string | Peer address of the network connection - IP address or Unix domain socket name. | `10.1.2.80`; `/tmp/my.sock` | Recommended |
Expand Down
8 changes: 8 additions & 0 deletions model/registry/db.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -422,3 +422,11 @@ groups:
Username for accessing the database.
examples: ['readonly_user', 'reporting_user']
tag: db-generic
- id: instance.id
tag: db-generic
type: string
brief: >
An identifier (address, unique name, or any other identifier) of the database instance that is executing queries or mutations on the current connection.
This is useful in cases where the database is running in a clustered environment and the instrumentation is able to record the node executing the query.
The client may obtain this value in databases like MySQL using queries like `select @@hostname`.
examples: 'mysql-e26b99z.example.com'
4 changes: 4 additions & 0 deletions model/trace/database.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ groups:
tag: connection-level
- ref: network.type
tag: connection-level
- ref: db.instance.id
tag: connection-level
requirement_level:
recommended: If different from the `server.address`

- id: db.mssql
type: span
Expand Down

0 comments on commit efd9345

Please sign in to comment.