feat: Add MySQL instance address attribute (#345)

Co-authored-by: Alexander Wert <AlexanderWert@users.noreply.github.com>
This commit is contained in:
Ariel Valentin 2023-11-30 02:22:16 -06:00 committed by GitHub
parent fc73453d04
commit efd9345199
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 14 additions and 0 deletions

View File

@ -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"` |

View File

@ -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 |

View File

@ -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'

View File

@ -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