Skip to content

Commit 5af87ec

Browse files
Fix review remarks
1 parent 2841df3 commit 5af87ec

File tree

1 file changed

+31
-3
lines changed

1 file changed

+31
-3
lines changed

source/open-telemetry/open-telemetry.md

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,9 +118,9 @@ the `withTransaction` span.
118118

119119
The span name SHOULD be:
120120

121-
- `driver_operation_name db.collection_name` if the command is executed on a collection (e.g.,
121+
- `driver_operation_name db.collection_name` if the operation is executed on a collection (e.g.,
122122
`findOneAndDelete warehouse.users`).
123-
- `driver_operation_name db` if there is no specific collection for the command (e.g., `runCommand warehouse`).
123+
- `driver_operation_name db` if there is no specific collection for the operation (e.g., `runCommand warehouse`).
124124

125125
##### Span Kind
126126

@@ -142,6 +142,16 @@ Spans SHOULD have the following attributes:
142142
Not all attributes are available at the moment of span creation. Drivers need to add attributes at later stages, which
143143
requires an operation span to be available throughout the complete operation lifecycle.
144144

145+
###### db.namespace
146+
147+
This attribute SHOULD be set to current database name except for operations executing against admin db. This field is
148+
omitted for transaction (abort|commit), and client `bulkWrite` operations.
149+
150+
###### db.collection.name
151+
152+
This attribute should be set to the user's collection if the operation is executing against a collection, this field is
153+
omitted for commands running against `admin` database or commands that do not target a specific collection.
154+
145155
##### Exceptions
146156

147157
If the driver operation fails with an exception, drivers MUST record an exception to the current operation span. When
@@ -183,7 +193,7 @@ Spans SHOULD have the following attributes:
183193
| `server.port` | `int64` | Server port number | Required |
184194
| `server.address` | `string` | Name of the database host, or IP address if name is not known | Required |
185195
| `network.transport` | `string` | MUST be 'tcp' or 'unix' depending on the protocol | Required |
186-
| `db.query.summary` | `string` | Equivalent to span name | Required |
196+
| `db.query.summary` | `string` | `command_name database_name.collection_name` | Required |
187197
| `db.mongodb.server_connection_id` | `int64` | Server connection id | Required if available |
188198
| `db.mongodb.driver_connection_id` | `int64` | Local connection id | Required if available |
189199
| `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 |
@@ -193,6 +203,24 @@ Besides the attributes listed in the table above, drivers MAY add other attribut
193203
[Semantic Conventions for Databases](https://opentelemetry.io/docs/specs/semconv/registry/attributes/db/) that are
194204
applicable to MongoDB.
195205

206+
###### db.namespace
207+
208+
This attribute SHOULD be set to current database name except for commands executing against admin db. This field is
209+
omitted for transaction (abort|commit).
210+
211+
###### db.collection.name
212+
213+
This attribute should be set to the user's collection if the operation is executing against a collection, this field is
214+
omitted for commands running against `admin` database or commands that do not target a specific collection.
215+
216+
###### db.query.summary
217+
218+
This attribute SHOULD contain:
219+
220+
- `command_name db.collection_name` if the command is executed on a collection.
221+
- `command_name db` if there is no specific collection for the command.
222+
- `command_name` in other cases (e.g., commands executed against `admin` database).
223+
196224
###### db.query.text
197225

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

0 commit comments

Comments
 (0)