Skip to content

Conversation

nhachicha
Copy link

@nhachicha nhachicha commented Aug 8, 2025

DRIVERS-719

  • Update schema to 1.26
  • Added invalid test to unified test runner
  • Added nominal valid tests for the 3 tracing grouping (Operation, Cursor and Transaction)
  • Update description of the new field observeTracingMessages and expectTracingMessages
  • Merge back the draft spec into this

@nhachicha nhachicha self-assigned this Aug 8, 2025
@nhachicha nhachicha changed the title OpenTelemetry DRIVERS-719 OpenTelementry specification Aug 8, 2025
- `enableCommandPayload`: Optional boolean. When set to `true`, enables capturing of command payload details in
tracing spans.
- If `true`, the test runner SHOULD capture detailed command payload information in tracing spans.
- If `false` or omitted, the test runner SHOULD exclude command payload details.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I realize this impacts the test runner, but should it also refer to configuring the MongoClient to enable tracing?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This point is similar to #1826 (comment) ?
This option is both configured via the test runner and should be available to toggle on/off via MongoClient. This should be covered by a prose test 👍

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prose test added

nhachicha and others added 8 commits August 14, 2025 17:48
…TracingMessages-additionalProperties.yml

Co-authored-by: Jeremy Mikola <[email protected]>
…spanMalformedTagsMustBeObject.yml

Co-authored-by: Jeremy Mikola <[email protected]>
…TracingMessages-additionalPropertyType.yml

Co-authored-by: Jeremy Mikola <[email protected]>
…missingPropertySpans.yml

Co-authored-by: Jeremy Mikola <[email protected]>
…spanMalformedMissingName.yml

Co-authored-by: Jeremy Mikola <[email protected]>
…spanMalformedTagsMustBeObject.yml

Co-authored-by: Jeremy Mikola <[email protected]>
@nhachicha nhachicha requested review from a team as code owners September 10, 2025 12:24
@nhachicha nhachicha requested review from alcaeus, jmikola, GromNaN and blink1073 and removed request for a team and blink1073 September 10, 2025 12:24
…summary with examples

- Adding test for abortTransaction
- Renaming transaction test to core_api
- **MongoClient Level**: Drivers SHOULD provide a configuration option for `MongoClient`'s Configuration/Settings that
enables or disables tracing for operations and commands executed with this client. This option MUST override
settings on higher levels. This configuration can be implemented with a `MongoClient` option, for example,
`tracing.enabled`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. We usually call out if an option should be URI, MongoClient settings, or both. Like for versioned api:
https://github.com/mongodb/specifications/blob/master/source/versioned-api/versioned-api.md#no-uri-options

Also can you clarify how tracing.enabled is supposed to be translated into code? Is it MongoClient(tracing=True), MongoClient(tracing="enabled"), or something else?

| `abortTransaction` | [tests/transaction/transaction.yml](tests/transaction/transaction.yml) |
| `createCollection` | [tests/transaction/create_collection.yml](tests/operation/create_collection.yml) |
| `createIndexes` | [tests/transaction/create_indexes.yml](tests/operation/create_indexes.yml) |
| `createView` | [tests/transaction/create_view.yml](tests/operation/create_view.yml) |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

createView is not a spec method. I don't think it should be included here or in the unified tests.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a fair point, my understanding is that some operations predate the spec ex createView defined in https://jira.mongodb.org/browse/DRIVERS-309 or createCollection only defined in unified tests. To your point in #1826 (comment) We should aim to cover the majority of operations that will help the developer trace and troubleshoot their application

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So are we going to remove createView here? Or mention that it's not standard?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem is that createView doesn't exist in any specs. I don't think this PR should introduce it as if it's a spec method that exists in all drivers.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed tests for the createView, and the row in this table.

- **MongoClient Level**: Drivers SHOULD provide a configuration option for `MongoClient`'s Configuration/Settings that
enables or disables tracing for operations and commands executed with this client. This option MUST override
settings on higher levels. This configuration can be implemented with a `MongoClient` option, for example,
`tracing.enabled`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ShaneHarvey: thanks for bringing up the typing. If this really is just a boolean type, I think tracing or enableTracing (more active language than tracingEnabled) with a default value of false would be most consistent with other driver option names in PHP. But since these aren't URI options there should be more naming flexibility available for drivers.

It looks like @comandeo-mongo is talking about this in a comment below, too: https://github.com/mongodb/specifications/pull/1826/files#r2339648026

@kevinAlbs kevinAlbs changed the title DRIVERS-719 OpenTelementry specification DRIVERS-719 OpenTelemetry specification Sep 17, 2025
- **MongoClient Level**: Drivers SHOULD provide a configuration option for `MongoClient`'s Configuration/Settings that
enables or disables tracing for operations and commands executed with this client. This option MUST override
settings on higher levels. This configuration can be implemented with a `MongoClient` option, for example,
`tracing.enabled`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nhachicha: Do you want to chime in here?


Drivers MUST take care to avoid exposing sensitive information (e.g. authentication credentials) in traces.

## Future Work
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@comandeo-mongo: Did you want to add a concise mention of "query parameterization" under this section? Doesn't need to be explained in detail, but just something to capture our original exchange in the earlier comment thread, which you can resolve.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added some clarification, I hope I understand correctly what you suggested.

| `db.mongodb.server_connection_id` | `int64` | Server connection id | Required if available |
| `db.mongodb.driver_connection_id` | `int64` | Local connection id | Required if available |
| `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 |
| `db.mongodb.cursor_id` | `int64` | If a cursor is created or used in the operation | Required if available |
| `db.mongodb.lsid` | `string` | Logical session id | Required is available |
| `db.mongodb.txn_number` | `int64` | Transaction number | Required is available |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for lsid and txn_number: is -> if

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed, thanks!

##### Exceptions

If the driver operation fails with an exception, drivers MUST record an exception to the current operation span. When
recording an exception, drivers SHOULD add the following attributes to the span, when the content for the attribute if
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This typo still exists.

| `abortTransaction` | [tests/transaction/transaction.yml](tests/transaction/transaction.yml) |
| `createCollection` | [tests/transaction/create_collection.yml](tests/operation/create_collection.yml) |
| `createIndexes` | [tests/transaction/create_indexes.yml](tests/operation/create_indexes.yml) |
| `createView` | [tests/transaction/create_view.yml](tests/operation/create_view.yml) |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem is that createView doesn't exist in any specs. I don't think this PR should introduce it as if it's a spec method that exists in all drivers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants