From 657670c6150bba8bfbc2389be9353fccb632aa0f Mon Sep 17 00:00:00 2001 From: Justin Date: Fri, 30 Oct 2020 09:51:23 -0700 Subject: [PATCH] Move db.table to SQL-specific call level attributes --- semantic_conventions/trace/database.yaml | 35 ++++++++++++------- .../trace/semantic_conventions/database.md | 6 ++-- 2 files changed, 25 insertions(+), 16 deletions(-) diff --git a/semantic_conventions/trace/database.yaml b/semantic_conventions/trace/database.yaml index 3d30c66e24f..ac72ae0fe66 100644 --- a/semantic_conventions/trace/database.yaml +++ b/semantic_conventions/trace/database.yaml @@ -199,19 +199,6 @@ groups: If the statement has an ambiguous operation, or performs more than one operation, this value may be omitted. examples: ['findAndModify', 'HMSET', 'SELECT'] - - id: table - tag: call-level - type: string - required: - conditional: Recommended if available. - brief: The name of the primary table, collection, segment, etc... that the operation is acting upon, including the schema name (if applicable). - note: > - It is not recommended to attempt any client-side parsing of - `db.statement` just to get this property, but it should be set if - it is provided by the library being instrumented. - If the operation is acting upon an anonymous table, or more than one table, this - value may be omitted. - examples: ['public.users', 'customers'] - ref: net.peer.name tag: connection-level required: @@ -309,6 +296,27 @@ groups: The collection being accessed within the database stated in `db.name`. examples: [ 'customers', 'products' ] + - id: db.sql + prefix: 'db.sql' + extends: 'db' + brief: > + Call-level attrbiutes for SQL databases + attributes: + - id: table + tag: call-level-tech-specific + type: string + required: + conditional: Recommended if available. + brief: The name of the primary table that the operation is acting upon, including the schema name (if applicable). + note: > + It is not recommended to attempt any client-side parsing of + `db.statement` just to get this property, but it should be set if + it is provided by the library being instrumented. + If the operation is acting upon an anonymous table, or more than one table, this + value may be omitted. + examples: ['public.users', 'customers'] + + - id: db.tech brief: "Semantic convention group for specific technologies" constraints: @@ -316,3 +324,4 @@ groups: - include: 'db.hbase' - include: 'db.redis' - include: 'db.mongodb' + - include: 'db.sql' diff --git a/specification/trace/semantic_conventions/database.md b/specification/trace/semantic_conventions/database.md index 5763cd06287..d1bc1af6161 100644 --- a/specification/trace/semantic_conventions/database.md +++ b/specification/trace/semantic_conventions/database.md @@ -136,7 +136,6 @@ Usually only one `db.name` will be used per connection though. | `db.name` | string | If no [tech-specific attribute](#call-level-attributes-for-specific-technologies) is defined, 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` | Conditional [2] | | `db.statement` | string | The database statement being executed. [3] | `SELECT * FROM wuser_table`
`SET mykey "WuValue"` | Conditional
Required if applicable. | | `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. [4] | `findAndModify`
`HMSET`
`SELECT` | Conditional
Required, if `db.statement` is not applicable. | -| `db.table` | string | The name of the primary table, collection, segment, etc... that the operation is acting upon, including the schema name (if applicable). [5] | `public.users`
`customers` | Conditional
Recommended if available. | **[1]:** In some SQL databases, the database name to be used is called "schema name". @@ -145,8 +144,6 @@ Usually only one `db.name` will be used per connection though. **[3]:** The value may be sanitized to exclude sensitive information. **[4]:** It is not recommended to attempt any client-side parsing of `db.statement` just to get this property, but it should be set if the operation name is provided by the library being instrumented. If the statement has an ambiguous operation, or performs more than one operation, this value may be omitted. - -**[5]:** It is not recommended to attempt any client-side parsing of `db.statement` just to get this property, but it should be set if it is provided by the library being instrumented. If the operation is acting upon an anonymous table, or more than one table, this value may be omitted. For **Redis**, the value provided for `db.statement` SHOULD correspond to the syntax of the Redis CLI. @@ -168,8 +165,11 @@ For example, when retrieving a document, `db.operation` would be set to (literal | `db.hbase.namespace` | string | The [HBase namespace](https://hbase.apache.org/book.html#_namespace) being accessed. To be used instead of the generic `db.name` attribute. | `default` | Yes | | `db.redis.database_index` | number | The index of the database being accessed as used in the [`SELECT` command](https://redis.io/commands/select), provided as an integer. To be used instead of the generic `db.name` attribute. | `0`
`1`
`15` | Conditional [1] | | `db.mongodb.collection` | string | The collection being accessed within the database stated in `db.name`. | `customers`
`products` | Yes | +| `db.sql.table` | string | The name of the primary table that the operation is acting upon, including the schema name (if applicable). [2] | `public.users`
`customers` | Conditional
Recommended if available. | **[1]:** Required, if other than the default database (`0`). + +**[2]:** It is not recommended to attempt any client-side parsing of `db.statement` just to get this property, but it should be set if it is provided by the library being instrumented. If the operation is acting upon an anonymous table, or more than one table, this value may be omitted. ## Examples