Skip to content

Commit 51fc929

Browse files
Bring spec in accordance with the new tests
1 parent 9987dbf commit 51fc929

File tree

1 file changed

+16
-26
lines changed

1 file changed

+16
-26
lines changed

source/open-telemetry/open-telemetry.md

Lines changed: 16 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -163,11 +163,7 @@ span.
163163

164164
##### Span Name
165165

166-
The span name SHOULD be:
167-
168-
- `server_command db.collection_name` if the command is executed on a collection (e.g.,
169-
`findAndModify warehouse.users`).
170-
- `server_command db` if there is no specific collection for the command.
166+
The span name SHOULD be the command name. For example, `find`, `insert`, `update`, etc.
171167

172168
##### Span Kind
173169

@@ -177,32 +173,26 @@ Span kind MUST be "client".
177173

178174
Spans SHOULD have the following attributes:
179175

180-
| Attribute | Type | Description | Requirement Level |
181-
| :-------------------------------- | :------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :--------------------------- |
182-
| `db.system` | `string` | MUST be 'mongodb' | Required |
183-
| `db.namespace` | `string` | The database name | Required if available |
184-
| `db.collection.name` | `string` | The collection being accessed within the database stated in `db.namespace` | Required if available |
185-
| `db.command.name` | `string` | The name of the server command being executed | Required |
186-
| `db.response.status_code` | `string` | MongoDB error code represented as a string. This attribute should be added only if an error happens. | Required if an error happens |
187-
| `error.type` | `string` | Describes a class of error the operation ended with. This attribute should be added only if an error happens. Examples: `timeout; java.net.UnknownHostException; server_certificate_invalid; 500`. | Required if an error happens |
188-
| `server.port` | `int64` | Server port number | Required |
189-
| `server.address` | `string` | Name of the database host, or IP address if name is not known | Required |
190-
| `network.transport` | `string` | MUST be 'tcp' or 'unix' depending on the protocol | Required |
191-
| `db.query.summary` | `string` | Equivalent to span name | Required |
192-
| `db.mongodb.server_connection_id` | `int64` | Server connection id | Required if available |
193-
| `db.mongodb.driver_connection_id` | `int64` | Local connection id | Required if available |
194-
| `db.query.text` | `string` | Database command that was sent to the server. Content should be equivalent to the `document` field of the CommandStartedEvent of the command monitoring. | Conditional |
195-
| `db.mongodb.cursor_id` | `int64` | If a cursor is created or used in the operation | Required if available |
176+
| Attribute | Type | Description | Requirement Level |
177+
| :-------------------------------- | :------- | :------------------------------------------------------------------------------------------------------------------------------------------------------- | :--------------------------- |
178+
| `db.system` | `string` | MUST be 'mongodb' | Required |
179+
| `db.namespace` | `string` | The database name | Required if available |
180+
| `db.collection.name` | `string` | The collection being accessed within the database stated in `db.namespace` | Required if available |
181+
| `db.command.name` | `string` | The name of the server command being executed | Required |
182+
| `db.response.status_code` | `string` | MongoDB error code represented as a string. This attribute should be added only if an error happens. | Required if an error happens |
183+
| `server.port` | `int64` | Server port number | Required |
184+
| `server.address` | `string` | Name of the database host, or IP address if name is not known | Required |
185+
| `network.transport` | `string` | MUST be 'tcp' or 'unix' depending on the protocol | Required |
186+
| `db.query.summary` | `string` | Equivalent to span name | Required |
187+
| `db.mongodb.server_connection_id` | `int64` | Server connection id | Required if available |
188+
| `db.mongodb.driver_connection_id` | `int64` | Local connection id | Required if available |
189+
| `db.query.text` | `string` | Database command that was sent to the server. Content should be equivalent to the `document` field of the CommandStartedEvent of the command monitoring. | Conditional |
190+
| `db.mongodb.cursor_id` | `int64` | If a cursor is created or used in the operation | Required if available |
196191

197192
Besides the attributes listed in the table above, drivers MAY add other attributes from the
198193
[Semantic Conventions for Databases](https://opentelemetry.io/docs/specs/semconv/registry/attributes/db/) that are
199194
applicable to MongoDB.
200195

201-
###### db.response.status_code and error.type
202-
203-
These attributes should be added only if the command was not successful. The content of `error.type` is language
204-
specific; a driver decides what best describes the error.
205-
206196
###### db.query.text
207197

208198
This attribute contains the full database command executed serialized to extended JSON. If not truncated, the content of

0 commit comments

Comments
 (0)