-
Notifications
You must be signed in to change notification settings - Fork 246
DRIVERS-719 OpenTelementry specification #1826
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
…logy. Adding toplogy requirements for transaction tests
source/unified-test-format/tests/invalid/expectedTracingSpans-spanMalformedMissingName.yml
Outdated
Show resolved
Hide resolved
source/unified-test-format/tests/invalid/expectedTracingSpans-spanMalformedMissingName.yml
Outdated
Show resolved
Hide resolved
source/unified-test-format/tests/invalid/expectedTracingSpans-spanMalformedTagsMustBeObject.yml
Outdated
Show resolved
Hide resolved
source/unified-test-format/tests/invalid/expectedTracingSpans-spanMalformedTagsMustBeObject.yml
Outdated
Show resolved
Hide resolved
- `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. |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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 👍
Co-authored-by: Jeremy Mikola <[email protected]>
Co-authored-by: Jeremy Mikola <[email protected]>
…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]>
- error.type is dropped in favour of using https://opentelemetry.io/docs/specs/semconv/exceptions/exceptions-spans/ - db.response.status_code is set in case of an error - namespace and collection names are reported as following: - 1: If the operation/command operates at the user collection level, then these fields should be set - 2: If the operation/command operates at the admin db, then only db.namespace should be set - 3: For bulkWrite collection name is not reported (db name is admin) - 4: For [abort|commit]Transaction no db name or collection reported
8532f58
to
0edc807
Compare
…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`. |
There was a problem hiding this comment.
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?
|
||
#### Tracer Attributes | ||
|
||
If a driver creates a Tracer using OpenTelemetry API, drivers MUST use the following attributes: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this say "When a driver"? Is creating a Tracer optional?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- In the Ruby driver I implemented
tracing
attribute as aHash
, so the code should be likeMongo::Client.new('mongodb://...', tracing: { enabled: true })
. Do you think we should specify the syntax here? - As mentioned above, some driver may decide not to use OpenTelemetry API. In this case they do not have a
Tracer
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you're using a Hash
, do you anticipate there will be a need for additional options beyond enabled
? My first impression is that such a design conflicts with the Defy Augury mantra for our specs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Java uses MongoClientSettings builder to pass in the tracer instance (interface abstracting the underlying collector) . Drivers should be free to define this in their idiomatic way.
|
||
A common complaint from our support team is that they don't know how to easily get debugging information from drivers. | ||
Some drivers provide debug logging, but others do not. For drivers that do provide it, the log messages produced and the | ||
mechanisms for enabling debug logging are inconsistent. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wasn't this the motivation for standardized logging? Could this section reference Standardized Logging and explain why OTel is a better (or necessary) alternative?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we could get the motivation part from the scope - https://docs.google.com/document/d/1h6qNCY0UCcfbGHCL4qzTCeYHf6W_IINJlLRQaTmhUZc/edit?tab=t.0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ShaneHarvey I updated the motivation based on the scope, please let me know if you think it looks better now.
|
||
## Covered operations | ||
|
||
The OpenTelemetry specification covers the following operations: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this say something like "covers all driver operations including but not limited to"? My understanding is that every driver api should produce OTel info, even non-spec driver specific helpers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this say something like "including but not limited to
Agree, in this iteration, we tried to include all the operations supported by the unified test runner. Example AFAIK there's no dropDatabase
test in the UTR but the operation is reported in OTel.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point, thanks. Updated accordingly.
| `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) | |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's included (with its corresponding test) https://github.com/mongodb/specifications/blob/DRIVERS-719/source/open-telemetry/open-telemetry.md#covered-operations 👍
A Tracer is responsible for creating spans, and using a tracer is the only way to create a span. A Tracer is not | ||
responsible for configuration; this should be the responsibility of the TracerProvider instead. | ||
|
||
**OpenTelemetry API and SDK** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this section intended to be under ### Terms
? It definitely doesn't look like it belongs under #### Tracer
.
It seems relevant to the paragraph under #### External Dependencies
below, so perhaps drop the title here and just move the following paragraph to that section.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I completely removed the Tracer section, and moved the API and SDK to the External Dependencies.
|
||
OpenTelemetry SHOULD be disabled by default. | ||
|
||
Drivers SHOULD support configuring OpenTelemetry on multiple levels. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nhachicha @comandeo-mongo: Feel free to resolve this if the question is no longer relevant. Otherwise, respond and I'll resolve after reading.
- **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`. |
There was a problem hiding this comment.
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
|
||
#### Tracer Attributes | ||
|
||
If a driver creates a Tracer using OpenTelemetry API, drivers MUST use the following attributes: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you're using a Hash
, do you anticipate there will be a need for additional options beyond enabled
? My first impression is that such a design conflicts with the Defy Augury mantra for our specs.
|
||
This attribute contains the full database command executed serialized to extended JSON. If not truncated, the content of | ||
this attribute SHOULD be equivalent to the `document` field of the CommandStartedEvent of the command monitoring | ||
excluding the following fields: `lsid`, `$db`, `$clusterTime`, `signature`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The PHP team was recently discussing query shapes and how one might remove dynamic values (e.g. 5
in { x: { $gt: 5 }}
) to yield a parameterized query for purposes of logging or query aggregation. In the case of CSFLE, the query might already have BSON binary values (with the encrypted subtype) by the time the query is sent along for logging, which can also be considered a form of parameterization. In that case, a driver could easily replace those binary values with placeholders (assuming the encrypted blobs are irrelevant for logging).
There's may also be some overlap here with making security redactions for other, sensitive commands.
With regard to this spec, I'd suggest mentioning query parameterization as a potential todo item in a "Future Work" section (as is found in other specs).
@@ -0,0 +1,129 @@ | |||
description: cursor retrieval |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it's not too much work, I'd advocate for making these descriptions consistent with the base filename (sans .yml
extension). So if "cursor retrieval" is the logical name to group tests in this file, I'd suggest using cursor-retrieval
here and naming the file cursor-retrieval.yml
.
exception.type: { $$exists: false } | ||
exception.stacktrace: { $$exists: false } | ||
server.address: { $$type: string } | ||
server.port: { $$type: ['int', 'long'] } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I noticed you don't quote single values for $$type
above, so consider using [int, long]
here in the interest of consistency and keeping the tests as concise as possible (without sacrificing readability and introducing ambiguity in YAML parsing).
- name: aggregate | ||
object: *collection0 | ||
arguments: | ||
pipeline: &pipeline1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: was this test originally taken from a larger file? I would have expected &pipeline0
here.
Co-authored-by: Jeremy Mikola <[email protected]>
Co-authored-by: Jeremy Mikola <[email protected]>
DRIVERS-719
observeTracingMessages
andexpectTracingMessages