From 97d8a5bd535ea2648be475ba375b84461f7443db Mon Sep 17 00:00:00 2001 From: Nabil Hachicha Date: Fri, 11 Jul 2025 18:57:02 +0100 Subject: [PATCH 01/62] added first tracing tests --- source/tracing/tests/operation/find.json | 115 ++++++++++ source/tracing/tests/operation/insert.json | 121 +++++++++++ .../tests/transaction/transaction.json | 205 ++++++++++++++++++ 3 files changed, 441 insertions(+) create mode 100644 source/tracing/tests/operation/find.json create mode 100644 source/tracing/tests/operation/insert.json create mode 100644 source/tracing/tests/transaction/transaction.json diff --git a/source/tracing/tests/operation/find.json b/source/tracing/tests/operation/find.json new file mode 100644 index 0000000000..1d310bc30a --- /dev/null +++ b/source/tracing/tests/operation/find.json @@ -0,0 +1,115 @@ +{ + "description" : "operation find", + "schemaVersion" : "1.9", + "createEntities" : [ + { + "client" : { + "id" : "client0", + "useMultipleMongoses" : false, + "tracing" : { + "enableCommandPayload" : true + } + } + }, + { + "database" : { + "id" : "database0", + "client" : "client0", + "databaseName" : "operation-find" + } + }, + { + "collection" : { + "id" : "collection0", + "database" : "database0", + "collectionName" : "test" + } + } + ], + "initialData" : [ + { + "collectionName" : "test", + "databaseName" : "operation-find", + "documents" : [] + } + ], + "tests" : [ + { + "description" : "find an element", + "operations" : [ + { + "name" : "find", + "object" : "collection0", + "arguments" : { + "filter" : { + "x" : 1 + } + } + } + ], + "expectTracingSpans" : { + "client" : "client0", + "ignoreExtraSpans" : false, + "spans" : [ + { + "name" : "find operation-find.test", + "tags" : { + "db.system" : "mongodb", + "db.collection.name" : "test", + "db.namespace" : "operation-find" + }, + "nested" : [ + { + "name" : "command find", + "tags" : { + "db.system" : "mongodb", + "db.namespace" : "operation-find", + "server.address" : { + "$$type" : "string" + }, + "server.port" : { + "$$type" : [ + "long", + "string" + ] + }, + "server.type" : { + "$$type" : "string" + }, + "db.query.summary" : { + "$$matchAsDocument" : { + "$$matchAsRoot" : { + "find" : "test", + "filter" : { + "x" : 1 + } + } + } + }, + "db.query.text" : { + "$$matchAsDocument" : { + "$$matchAsRoot" : { + "find" : "test", + "filter" : { + "x" : 1 + }, + "$db" : "operation-find" + } + } + } + } + } + ] + } + ] + }, + "outcome" : [ + { + "collectionName" : "test", + "databaseName" : "operation-find", + "documents" : [] + } + ] + } + ] +} diff --git a/source/tracing/tests/operation/insert.json b/source/tracing/tests/operation/insert.json new file mode 100644 index 0000000000..f35105e587 --- /dev/null +++ b/source/tracing/tests/operation/insert.json @@ -0,0 +1,121 @@ +{ + "description" : "operation insert", + "schemaVersion" : "1.9", + "createEntities" : [ + { + "client" : { + "id" : "client0", + "useMultipleMongoses" : false, + "tracing" : { + "enableCommandPayload" : true + } + } + }, + { + "database" : { + "id" : "database0", + "client" : "client0", + "databaseName" : "operation-insert" + } + }, + { + "collection" : { + "id" : "collection0", + "database" : "database0", + "collectionName" : "test" + } + } + ], + "initialData" : [ + { + "collectionName" : "test", + "databaseName" : "operation-insert", + "documents" : [] + } + ], + "tests" : [ + { + "description" : "insert one element", + "operations" : [ + { + "object" : "collection0", + "name" : "insertOne", + "arguments" : { + "document" : { + "_id" : 1 + } + } + } + ], + "expectTracingSpans" : { + "client" : "client0", + "ignoreExtraSpans" : false, + "spans" : [ + { + "name" : "mixedbulkwriteoperation operation-insert.test", + "tags" : { + "db.system" : "mongodb", + "db.collection.name" : "test", + "db.namespace" : "operation-insert" + }, + "nested" : [ + { + "name" : "command insert", + "tags" : { + "db.system" : "mongodb", + "db.namespace" : "operation-insert", + "server.address" : { + "$$type" : "string" + }, + "server.port" : { + "$$type" : [ + "long", + "string" + ] + }, + "server.type" : { + "$$type" : "string" + }, + "db.query.summary" : { + "$$matchAsDocument" : { + "$$matchAsRoot" : { + "insert" : "test", + "ordered" : true + } + } + }, + "db.query.text" : { + "$$matchAsDocument" : { + "$$matchAsRoot" : { + "insert" : "test", + "ordered" : true, + "txnNumber" : 1, + "$db" : "operation-insert", + "documents" : [ + { + "_id" : 1 + } + ] + } + } + } + } + } + ] + } + ] + }, + "outcome" : [ + { + "collectionName" : "test", + "databaseName" : "operation-insert", + "documents" : [ + { + "_id" : 1 + } + ] + } + ] + } + ] +} diff --git a/source/tracing/tests/transaction/transaction.json b/source/tracing/tests/transaction/transaction.json new file mode 100644 index 0000000000..ad2528c11c --- /dev/null +++ b/source/tracing/tests/transaction/transaction.json @@ -0,0 +1,205 @@ +{ + "description" : "transaction spans", + "schemaVersion" : "1.9", + "createEntities" : [ + { + "client" : { + "id" : "client0", + "useMultipleMongoses" : false, + "tracing" : { + "enableCommandPayload" : true + } + } + }, + { + "database" : { + "id" : "database0", + "client" : "client0", + "databaseName" : "transaction-tests" + } + }, + { + "collection" : { + "id" : "collection0", + "database" : "database0", + "collectionName" : "test" + } + }, + { + "session" : { + "id" : "session0", + "client" : "client0" + } + } + ], + "initialData" : [ + { + "collectionName" : "test", + "databaseName" : "transaction-tests", + "documents" : [] + } + ], + "tests" : [ + { + "description" : "tracing around transaction", + "operations" : [ + { + "object" : "session0", + "name" : "startTransaction" + }, + { + "object" : "collection0", + "name" : "insertOne", + "arguments" : { + "session" : "session0", + "document" : { + "_id" : 1 + } + } + }, + { + "object" : "session0", + "name" : "commitTransaction" + }, + { + "name" : "find", + "object" : "collection0", + "arguments" : { + "filter" : { + "x" : 1 + } + } + } + ], + "expectTracingSpans" : { + "client" : "client0", + "ignoreExtraSpans" : false, + "spans" : [ + { + "name" : "transaction", + "nested" : [ + { + "name" : "mixedbulkwriteoperation transaction-tests.test", + "tags" : { + "db.system" : "mongodb", + "db.collection.name" : "test", + "db.namespace" : "transaction-tests" + }, + "nested" : [ + { + "name" : "command insert", + "tags" : { + "db.system" : "mongodb", + "db.namespace" : "transaction-tests", + "server.address" : { + "$$type" : "string" + }, + "server.port" : { + "$$type" : [ + "long", + "string" + ] + }, + "server.type" : { + "$$type" : "string" + }, + "db.query.summary" : { + "$$matchAsDocument" : { + "$$matchAsRoot" : { + "insert" : "test", + "ordered" : true + } + } + }, + "db.query.text" : { + "$$matchAsDocument" : { + "$$matchAsRoot" : { + "insert" : "test", + "ordered" : true, + "$db" : "transaction-tests", + "lsid" : { + "$$sessionLsid" : "session0" + }, + "txnNumber" : 1, + "startTransaction" : true, + "autocommit" : false, + "documents" : [ + { + "_id" : 1 + } + ] + } + } + }, + "db.mongodb.lsid" : { + "$$sessionLsid" : "session0" + } + } + } + ] + }, + { + "name" : "commitTransaction", + "nested" : [ + { + "name" : "command commitTransaction", + "tags" : { + "db.system" : "mongodb" + } + } + ] + } + ] + }, + { + "name" : "find transaction-tests.test", + "tags" : { + }, + "nested" : [ + { + "name" : "command find", + "tags" : { + "db.system" : "mongodb", + "db.namespace" : "transaction-tests", + "server.address" : { + "$$type" : "string" + }, + "server.port" : { + "$$type" : [ + "long", + "string" + ] + }, + "server.type" : { + "$$type" : "string" + }, + "db.query.summary" : { + "$$matchAsDocument" : { + "$$matchAsRoot" : { + "find" : "test", + "filter" : { + "x" : 1 + } + } + } + } + } + } + ] + } + ] + }, + "outcome" : [ + { + "collectionName" : "test", + "databaseName" : "transaction-tests", + "documents" : [ + { + "_id" : 1 + } + ] + } + ] + } + ] +} From c82a6a279b2b02361a60551b51c05cc5e678c007 Mon Sep 17 00:00:00 2001 From: Nabil Hachicha Date: Wed, 16 Jul 2025 11:05:33 +0100 Subject: [PATCH 02/62] using unsetOrMatches for txNumber, since it's not set for single topology. Adding toplogy requirements for transaction tests --- source/tracing/tests/operation/insert.json | 4 +++- source/tracing/tests/transaction/transaction.json | 15 +++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/source/tracing/tests/operation/insert.json b/source/tracing/tests/operation/insert.json index f35105e587..9d3b1dff26 100644 --- a/source/tracing/tests/operation/insert.json +++ b/source/tracing/tests/operation/insert.json @@ -89,7 +89,9 @@ "$$matchAsRoot" : { "insert" : "test", "ordered" : true, - "txnNumber" : 1, + "txnNumber" : { + "$$unsetOrMatches" : 1 + }, "$db" : "operation-insert", "documents" : [ { diff --git a/source/tracing/tests/transaction/transaction.json b/source/tracing/tests/transaction/transaction.json index ad2528c11c..84dc8336eb 100644 --- a/source/tracing/tests/transaction/transaction.json +++ b/source/tracing/tests/transaction/transaction.json @@ -1,6 +1,21 @@ { "description" : "transaction spans", "schemaVersion" : "1.9", + "runOnRequirements": [ + { + "minServerVersion": "4.0", + "topologies": [ + "replicaset" + ] + }, + { + "minServerVersion": "4.1.8", + "topologies": [ + "sharded", + "load-balanced" + ] + } + ], "createEntities" : [ { "client" : { From 61270d61656709944e6b75e160453e3bfa658483 Mon Sep 17 00:00:00 2001 From: Nabil Hachicha Date: Sun, 20 Jul 2025 22:15:20 +0100 Subject: [PATCH 03/62] updating tests --- source/tracing/tests/operation/find.json | 6 ++---- source/tracing/tests/operation/insert.json | 6 ++---- .../tracing/tests/transaction/transaction.json | 16 +++++++++------- 3 files changed, 13 insertions(+), 15 deletions(-) diff --git a/source/tracing/tests/operation/find.json b/source/tracing/tests/operation/find.json index 1d310bc30a..b9415da339 100644 --- a/source/tracing/tests/operation/find.json +++ b/source/tracing/tests/operation/find.json @@ -52,11 +52,9 @@ "ignoreExtraSpans" : false, "spans" : [ { - "name" : "find operation-find.test", + "name" : "find", "tags" : { - "db.system" : "mongodb", - "db.collection.name" : "test", - "db.namespace" : "operation-find" + "db.system" : "mongodb" }, "nested" : [ { diff --git a/source/tracing/tests/operation/insert.json b/source/tracing/tests/operation/insert.json index 9d3b1dff26..5685acd289 100644 --- a/source/tracing/tests/operation/insert.json +++ b/source/tracing/tests/operation/insert.json @@ -52,11 +52,9 @@ "ignoreExtraSpans" : false, "spans" : [ { - "name" : "mixedbulkwriteoperation operation-insert.test", + "name" : "insert", "tags" : { - "db.system" : "mongodb", - "db.collection.name" : "test", - "db.namespace" : "operation-insert" + "db.system" : "mongodb" }, "nested" : [ { diff --git a/source/tracing/tests/transaction/transaction.json b/source/tracing/tests/transaction/transaction.json index 84dc8336eb..f0d95cc90a 100644 --- a/source/tracing/tests/transaction/transaction.json +++ b/source/tracing/tests/transaction/transaction.json @@ -92,13 +92,14 @@ "spans" : [ { "name" : "transaction", + "tags" : { + "db.system" : "mongodb" + }, "nested" : [ { - "name" : "mixedbulkwriteoperation transaction-tests.test", + "name" : "insert", "tags" : { - "db.system" : "mongodb", - "db.collection.name" : "test", - "db.namespace" : "transaction-tests" + "db.system" : "mongodb" }, "nested" : [ { @@ -155,6 +156,9 @@ }, { "name" : "commitTransaction", + "tags" : { + "db.system" : "mongodb" + }, "nested" : [ { "name" : "command commitTransaction", @@ -167,9 +171,7 @@ ] }, { - "name" : "find transaction-tests.test", - "tags" : { - }, + "name" : "find", "nested" : [ { "name" : "command find", From 581faa1f945b62e16e080221c4ae5ce2f0c156eb Mon Sep 17 00:00:00 2001 From: Nabil Hachicha Date: Fri, 8 Aug 2025 16:06:37 +0100 Subject: [PATCH 04/62] Tests and schema update for the upcoming Otel spec --- source/tracing/tests/cursor/cursor.json | 321 +++++ source/tracing/tests/cursor/cursor.yml | 144 ++ source/tracing/tests/operation/find.json | 49 +- source/tracing/tests/operation/find.yml | 74 + source/tracing/tests/operation/insert.json | 135 +- source/tracing/tests/operation/insert.yml | 63 + .../tests/transaction/transaction.json | 241 ++-- .../tracing/tests/transaction/transaction.yml | 116 ++ source/unified-test-format/schema-1.26.json | 1217 +++++++++++++++++ ...veTracingMessages-additionalProperties.yml | 14 + ...racingMessages-additionalPropertyType.json | 20 + ...TracingMessages-additionalPropertyType.yml | 14 + ...ty-client-observeTracingMessages-type.json | 18 + ...ity-client-observeTracingMessages-type.yml | 12 + ...ctedTracingSpans-additionalProperties.json | 25 + ...ectedTracingSpans-additionalProperties.yml | 16 + .../expectedTracingSpans-clientType.json | 23 + .../expectedTracingSpans-clientType.yml | 14 + ...tedTracingSpans-missingPropertyClient.json | 22 + ...ctedTracingSpans-missingPropertyClient.yml | 13 + ...ctedTracingSpans-missingPropertySpans.json | 20 + ...ectedTracingSpans-missingPropertySpans.yml | 13 + ...ans-spanMalformedAdditionalProperties.json | 28 + ...pans-spanMalformedAdditionalProperties.yml | 19 + ...TracingSpans-spanMalformedMissingName.json | 27 + ...dTracingSpans-spanMalformedMissingName.yml | 16 + ...TracingSpans-spanMalformedMissingTags.json | 25 + ...dTracingSpans-spanMalformedMissingTags.yml | 15 + ...gSpans-spanMalformedNestedMustBeArray.json | 27 + ...ngSpans-spanMalformedNestedMustBeArray.yml | 18 + ...ngSpans-spanMalformedTagsMustBeObject.json | 27 + ...ingSpans-spanMalformedTagsMustBeObject.yml | 18 + 32 files changed, 2602 insertions(+), 202 deletions(-) create mode 100644 source/tracing/tests/cursor/cursor.json create mode 100644 source/tracing/tests/cursor/cursor.yml create mode 100644 source/tracing/tests/operation/find.yml create mode 100644 source/tracing/tests/operation/insert.yml create mode 100644 source/tracing/tests/transaction/transaction.yml create mode 100644 source/unified-test-format/schema-1.26.json create mode 100644 source/unified-test-format/tests/invalid/entity-client-observeTracingMessages-additionalProperties.yml create mode 100644 source/unified-test-format/tests/invalid/entity-client-observeTracingMessages-additionalPropertyType.json create mode 100644 source/unified-test-format/tests/invalid/entity-client-observeTracingMessages-additionalPropertyType.yml create mode 100644 source/unified-test-format/tests/invalid/entity-client-observeTracingMessages-type.json create mode 100644 source/unified-test-format/tests/invalid/entity-client-observeTracingMessages-type.yml create mode 100644 source/unified-test-format/tests/invalid/expectedTracingSpans-additionalProperties.json create mode 100644 source/unified-test-format/tests/invalid/expectedTracingSpans-additionalProperties.yml create mode 100644 source/unified-test-format/tests/invalid/expectedTracingSpans-clientType.json create mode 100644 source/unified-test-format/tests/invalid/expectedTracingSpans-clientType.yml create mode 100644 source/unified-test-format/tests/invalid/expectedTracingSpans-missingPropertyClient.json create mode 100644 source/unified-test-format/tests/invalid/expectedTracingSpans-missingPropertyClient.yml create mode 100644 source/unified-test-format/tests/invalid/expectedTracingSpans-missingPropertySpans.json create mode 100644 source/unified-test-format/tests/invalid/expectedTracingSpans-missingPropertySpans.yml create mode 100644 source/unified-test-format/tests/invalid/expectedTracingSpans-spanMalformedAdditionalProperties.json create mode 100644 source/unified-test-format/tests/invalid/expectedTracingSpans-spanMalformedAdditionalProperties.yml create mode 100644 source/unified-test-format/tests/invalid/expectedTracingSpans-spanMalformedMissingName.json create mode 100644 source/unified-test-format/tests/invalid/expectedTracingSpans-spanMalformedMissingName.yml create mode 100644 source/unified-test-format/tests/invalid/expectedTracingSpans-spanMalformedMissingTags.json create mode 100644 source/unified-test-format/tests/invalid/expectedTracingSpans-spanMalformedMissingTags.yml create mode 100644 source/unified-test-format/tests/invalid/expectedTracingSpans-spanMalformedNestedMustBeArray.json create mode 100644 source/unified-test-format/tests/invalid/expectedTracingSpans-spanMalformedNestedMustBeArray.yml create mode 100644 source/unified-test-format/tests/invalid/expectedTracingSpans-spanMalformedTagsMustBeObject.json create mode 100644 source/unified-test-format/tests/invalid/expectedTracingSpans-spanMalformedTagsMustBeObject.yml diff --git a/source/tracing/tests/cursor/cursor.json b/source/tracing/tests/cursor/cursor.json new file mode 100644 index 0000000000..0572d71e4c --- /dev/null +++ b/source/tracing/tests/cursor/cursor.json @@ -0,0 +1,321 @@ +{ + "description": "cursor retrieval", + "schemaVersion": "1.26", + "createEntities": [ + { + "client": { + "id": "client0", + "useMultipleMongoses": false, + "tracing": { + "enableCommandPayload": true + } + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "cursor" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "test" + } + } + ], + "initialData": [ + { + "collectionName": "test", + "databaseName": "cursor", + "documents": [ + { + "_id": 1 + }, + { + "_id": 2 + }, + { + "_id": 3 + }, + { + "_id": 4 + }, + { + "_id": 5 + }, + { + "_id": 6 + } + ] + } + ], + "tests": [ + { + "description": "find with a cursor", + "operations": [ + { + "name": "find", + "object": "collection0", + "arguments": { + "filter": { + "_id": { + "$gt": 1 + } + }, + "batchSize": 2 + }, + "expectResult": [ + { + "_id": 2 + }, + { + "_id": 3 + }, + { + "_id": 4 + }, + { + "_id": 5 + }, + { + "_id": 6 + } + ] + } + ], + "expectTracingSpans": { + "client": "client0", + "ignoreExtraSpans": false, + "spans": [ + { + "name": "find cursor.test", + "tags": { + "db.system": "mongodb", + "db.namespace": "cursor", + "db.collection.name": "test", + "db.operation.name": "find", + "db.operation.summary": "find cursor.test" + }, + "nested": [ + { + "name": "command find", + "tags": { + "db.system": "mongodb", + "db.namespace": "cursor", + "db.collection.name": "cursor.$cmd", + "db.command.name": "find", + "network.transport": "tcp", + "db.mongodb.cursor_id": { + "$$exists": false + }, + "db.response.status_code": { + "$$exists": false + }, + "error.message": { + "$$exists": false + }, + "error.type": { + "$$exists": false + }, + "error.stacktrace": { + "$$exists": false + }, + "server.address": { + "$$type": "string" + }, + "server.port": { + "$$type": [ + "long", + "string" + ] + }, + "server.type": { + "$$type": "string" + }, + "db.query.summary": "find", + "db.query.text": { + "$$matchAsDocument": { + "$$matchAsRoot": { + "find": "test", + "filter": { + "_id": { + "$gt": 1 + } + }, + "batchSize": 2, + "$db": "cursor" + } + } + }, + "db.mongodb.server_connection_id": { + "$$type": [ + "long", + "string" + ] + }, + "db.mongodb.driver_connection_id": { + "$$type": [ + "string" + ] + }, + "exception.message": { + "$$exists": false + }, + "exception.type": { + "$$exists": false + }, + "exception.stacktrace": { + "$$exists": false + } + } + }, + { + "name": "command getMore", + "tags": { + "db.system": "mongodb", + "db.namespace": "cursor", + "db.collection.name": "cursor.$cmd", + "db.command.name": "getMore", + "network.transport": "tcp", + "db.mongodb.cursor_id": { + "$$type": "string" + }, + "db.response.status_code": { + "$$exists": false + }, + "error.message": { + "$$exists": false + }, + "error.type": { + "$$exists": false + }, + "error.stacktrace": { + "$$exists": false + }, + "server.address": { + "$$type": "string" + }, + "server.port": { + "$$type": [ + "long", + "string" + ] + }, + "server.type": { + "$$type": "string" + }, + "db.query.summary": "getMore", + "db.query.text": { + "$$matchAsDocument": { + "$$matchAsRoot": { + "getMore": { + "$$type": "long" + }, + "collection": "test", + "batchSize": 2, + "$db": "cursor" + } + } + }, + "db.mongodb.server_connection_id": { + "$$type": [ + "long", + "string" + ] + }, + "db.mongodb.driver_connection_id": { + "$$type": [ + "string" + ] + }, + "exception.message": { + "$$exists": false + }, + "exception.type": { + "$$exists": false + }, + "exception.stacktrace": { + "$$exists": false + } + } + }, + { + "name": "command getMore", + "tags": { + "db.system": "mongodb", + "db.namespace": "cursor", + "db.collection.name": "cursor.$cmd", + "db.command.name": "getMore", + "network.transport": "tcp", + "db.mongodb.cursor_id": { + "$$type": "string" + }, + "db.response.status_code": { + "$$exists": false + }, + "error.message": { + "$$exists": false + }, + "error.type": { + "$$exists": false + }, + "error.stacktrace": { + "$$exists": false + }, + "server.address": { + "$$type": "string" + }, + "server.port": { + "$$type": [ + "long", + "string" + ] + }, + "server.type": { + "$$type": "string" + }, + "db.query.summary": "getMore", + "db.query.text": { + "$$matchAsDocument": { + "$$matchAsRoot": { + "getMore": { + "$$type": "long" + }, + "collection": "test", + "batchSize": 2, + "$db": "cursor" + } + } + }, + "db.mongodb.server_connection_id": { + "$$type": [ + "long", + "string" + ] + }, + "db.mongodb.driver_connection_id": { + "$$type": [ + "string" + ] + }, + "exception.message": { + "$$exists": false + }, + "exception.type": { + "$$exists": false + }, + "exception.stacktrace": { + "$$exists": false + } + } + } + ] + } + ] + } + } + ] +} diff --git a/source/tracing/tests/cursor/cursor.yml b/source/tracing/tests/cursor/cursor.yml new file mode 100644 index 0000000000..44f5e85fea --- /dev/null +++ b/source/tracing/tests/cursor/cursor.yml @@ -0,0 +1,144 @@ +description: cursor retrieval +schemaVersion: '1.26' +createEntities: + - client: + id: client0 + useMultipleMongoses: false + tracing: + enableCommandPayload: true + - database: + id: database0 + client: client0 + databaseName: cursor + - collection: + id: collection0 + database: database0 + collectionName: test +initialData: + - collectionName: test + databaseName: cursor + documents: + - { _id: 1 } + - { _id: 2 } + - { _id: 3 } + - { _id: 4 } + - { _id: 5 } + - { _id: 6 } +tests: + - description: find with a cursor + operations: + - name: find + object: collection0 + arguments: + filter: { _id: { $gt: 1 } } + batchSize: 2 + expectResult: + - { _id: 2 } + - { _id: 3 } + - { _id: 4 } + - { _id: 5 } + - { _id: 6 } + expectTracingSpans: + client: client0 + ignoreExtraSpans: false + spans: + - name: find cursor.test + tags: + db.system: mongodb + db.namespace: cursor + db.collection.name: test + db.operation.name: find + db.operation.summary: find cursor.test + nested: + - name: command find + tags: + db.system: mongodb + db.namespace: cursor + db.collection.name: cursor.$cmd + db.command.name: find + network.transport: tcp + db.mongodb.cursor_id: { $$exists: false } + db.response.status_code: { $$exists: false } + error.message: { $$exists: false } + error.type: { $$exists: false } + error.stacktrace: { $$exists: false } + server.address: { $$type: string } + server.port: { $$type: [ 'long', 'string' ] } + server.type: { $$type: string } + db.query.summary: find + db.query.text: + $$matchAsDocument: + $$matchAsRoot: + find: test + filter: { _id: { $gt: 1 } } + batchSize: 2 + $db: cursor + db.mongodb.server_connection_id: + $$type: [ 'long', 'string' ] + db.mongodb.driver_connection_id: + $$type: [ 'string' ] + exception.message: { $$exists: false } + exception.type: { $$exists: false } + exception.stacktrace: { $$exists: false } + + - name: command getMore + tags: + db.system: mongodb + db.namespace: cursor + db.collection.name: cursor.$cmd + db.command.name: getMore + network.transport: tcp + db.mongodb.cursor_id: { $$type: string } + db.response.status_code: { $$exists: false } + error.message: { $$exists: false } + error.type: { $$exists: false } + error.stacktrace: { $$exists: false } + server.address: { $$type: string } + server.port: { $$type: [ 'long', 'string' ] } + server.type: { $$type: string } + db.query.summary: getMore + db.query.text: + $$matchAsDocument: + $$matchAsRoot: + getMore: { $$type: long } + collection: test + batchSize: 2 + $db: cursor + db.mongodb.server_connection_id: + $$type: [ 'long', 'string' ] + db.mongodb.driver_connection_id: + $$type: [ 'string' ] + exception.message: { $$exists: false } + exception.type: { $$exists: false } + exception.stacktrace: { $$exists: false } + - name: command getMore + tags: + db.system: mongodb + db.namespace: cursor + db.collection.name: cursor.$cmd + db.command.name: getMore + network.transport: tcp + db.mongodb.cursor_id: { $$type: string } + db.response.status_code: { $$exists: false } + error.message: { $$exists: false } + error.type: { $$exists: false } + error.stacktrace: { $$exists: false } + server.address: { $$type: string } + server.port: { $$type: [ 'long', 'string' ] } + server.type: { $$type: string } + db.query.summary: getMore + db.query.text: + $$matchAsDocument: + $$matchAsRoot: + getMore: { $$type: long } + collection: test + batchSize: 2 + $db: cursor + db.mongodb.server_connection_id: + $$type: [ 'long', 'string' ] + db.mongodb.driver_connection_id: + $$type: [ 'string' ] + exception.message: { $$exists: false } + exception.type: { $$exists: false } + exception.stacktrace: { $$exists: false } + diff --git a/source/tracing/tests/operation/find.json b/source/tracing/tests/operation/find.json index b9415da339..5295648d3b 100644 --- a/source/tracing/tests/operation/find.json +++ b/source/tracing/tests/operation/find.json @@ -1,6 +1,6 @@ { "description" : "operation find", - "schemaVersion" : "1.9", + "schemaVersion" : "1.26", "createEntities" : [ { "client" : { @@ -52,9 +52,13 @@ "ignoreExtraSpans" : false, "spans" : [ { - "name" : "find", + "name" : "find operation-find.test", "tags" : { - "db.system" : "mongodb" + "db.system" : "mongodb", + "db.namespace": "operation-find", + "db.collection.name": "test", + "db.operation.name": "find", + "db.operation.summary": "find operation-find.test" }, "nested" : [ { @@ -62,6 +66,14 @@ "tags" : { "db.system" : "mongodb", "db.namespace" : "operation-find", + "db.collection.name" : "operation-find.$cmd", + "db.command.name": "find", + "network.transport": "tcp", + "db.mongodb.cursor_id": { "$$exists": false }, + "db.response.status_code": { "$$exists": false }, + "error.message": { "$$exists": false }, + "error.type": { "$$exists": false }, + "error.stacktrace": { "$$exists": false }, "server.address" : { "$$type" : "string" }, @@ -74,16 +86,7 @@ "server.type" : { "$$type" : "string" }, - "db.query.summary" : { - "$$matchAsDocument" : { - "$$matchAsRoot" : { - "find" : "test", - "filter" : { - "x" : 1 - } - } - } - }, + "db.query.summary" : "find", "db.query.text" : { "$$matchAsDocument" : { "$$matchAsRoot" : { @@ -94,6 +97,26 @@ "$db" : "operation-find" } } + }, + "db.mongodb.server_connection_id" : { + "$$type" : [ + "long", + "string" + ] + }, + "db.mongodb.driver_connection_id" : { + "$$type" : [ + "string" + ] + }, + "exception.message" : { + "$$exists" : false + }, + "exception.type" : { + "$$exists" : false + }, + "exception.stacktrace": { + "$$exists" : false } } } diff --git a/source/tracing/tests/operation/find.yml b/source/tracing/tests/operation/find.yml new file mode 100644 index 0000000000..606c394f5b --- /dev/null +++ b/source/tracing/tests/operation/find.yml @@ -0,0 +1,74 @@ +description: operation find +schemaVersion: '1.9' +createEntities: + - client: + id: client0 + useMultipleMongoses: false + tracing: + enableCommandPayload: true + - database: + id: database0 + client: client0 + databaseName: operation-find + - collection: + id: collection0 + database: database0 + collectionName: test +initialData: + - collectionName: test + databaseName: operation-find + documents: [] +tests: + - description: find an element + operations: + - name: find + object: collection0 + arguments: + filter: + x: 1 + expectTracingSpans: + client: client0 + ignoreExtraSpans: false + spans: + - name: find operation-find.test + tags: + db.system: mongodb + db.namespace: operation-find + db.collection.name: test + db.operation.name: find + db.operation.summary: find operation-find.test + nested: + - name: command find + tags: + db.system: mongodb + db.namespace: operation-find + db.collection.name: operation-find.$cmd + db.command.name: find + network.transport: tcp + db.mongodb.cursor_id: { $$exists: false } + db.response.status_code: { $$exists: false } + error.message: { $$exists: false } + error.type: { $$exists: false } + error.stacktrace: { $$exists: false } + server.address: { $$type: string } + server.port: { $$type: ['long', 'string'] } + server.type: { $$type: string } + db.query.summary: find + db.query.text: + $$matchAsDocument: + $$matchAsRoot: + find: test + filter: + x: 1 + $db: operation-find + db.mongodb.server_connection_id: + $$type: ['long', 'string'] + db.mongodb.driver_connection_id: + $$type: ['string'] + exception.message: { $$exists: false } + exception.type: { $$exists: false } + exception.stacktrace: { $$exists: false } + outcome: + - collectionName: test + databaseName: operation-find + documents: [] \ No newline at end of file diff --git a/source/tracing/tests/operation/insert.json b/source/tracing/tests/operation/insert.json index 5685acd289..ec6a65dd66 100644 --- a/source/tracing/tests/operation/insert.json +++ b/source/tracing/tests/operation/insert.json @@ -1,99 +1,96 @@ { - "description" : "operation insert", - "schemaVersion" : "1.9", - "createEntities" : [ + "description": "operation insert", + "schemaVersion": "1.26", + "createEntities": [ { - "client" : { - "id" : "client0", - "useMultipleMongoses" : false, - "tracing" : { - "enableCommandPayload" : true + "client": { + "id": "client0", + "useMultipleMongoses": false, + "tracing": { + "enableCommandPayload": true } } }, { - "database" : { - "id" : "database0", - "client" : "client0", - "databaseName" : "operation-insert" + "database": { + "id": "database0", + "client": "client0", + "databaseName": "operation-insert" } }, { - "collection" : { - "id" : "collection0", - "database" : "database0", - "collectionName" : "test" + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "test" } } ], - "initialData" : [ + "initialData": [ { - "collectionName" : "test", - "databaseName" : "operation-insert", - "documents" : [] + "collectionName": "test", + "databaseName": "operation-insert", + "documents": [] } ], - "tests" : [ + "tests": [ { - "description" : "insert one element", - "operations" : [ + "description": "insert one element", + "operations": [ { - "object" : "collection0", - "name" : "insertOne", - "arguments" : { - "document" : { - "_id" : 1 + "object": "collection0", + "name": "insertOne", + "arguments": { + "document": { + "_id": 1 } } } ], - "expectTracingSpans" : { - "client" : "client0", - "ignoreExtraSpans" : false, - "spans" : [ + "expectTracingSpans": { + "client": "client0", + "ignoreExtraSpans": false, + "spans": [ { - "name" : "insert", - "tags" : { - "db.system" : "mongodb" + "name": "insert operation-insert.test", + "tags": { + "db.system": "mongodb", + "db.namespace": "operation-insert", + "db.collection.name": "test", + "db.operation.name": "insert", + "db.operation.summary": "insert operation-insert.test" }, - "nested" : [ + "nested": [ { - "name" : "command insert", - "tags" : { - "db.system" : "mongodb", - "db.namespace" : "operation-insert", - "server.address" : { - "$$type" : "string" + "name": "command insert", + "tags": { + "db.system": "mongodb", + "db.namespace": "operation-insert", + "server.address": { + "$$type": "string" }, - "server.port" : { - "$$type" : [ + "server.port": { + "$$type": [ "long", "string" ] }, - "server.type" : { - "$$type" : "string" + "server.type": { + "$$type": "string" }, - "db.query.summary" : { - "$$matchAsDocument" : { - "$$matchAsRoot" : { - "insert" : "test", - "ordered" : true - } - } - }, - "db.query.text" : { - "$$matchAsDocument" : { - "$$matchAsRoot" : { - "insert" : "test", - "ordered" : true, - "txnNumber" : { - "$$unsetOrMatches" : 1 + "db.query.summary": "insert", + "db.query.text": { + "$$matchAsDocument": { + "$$matchAsRoot": { + "insert": "test", + "ordered": true, + "txnNumber": { + "$$unsetOrMatches": 1 }, - "$db" : "operation-insert", - "documents" : [ + "$db": "operation-insert", + "documents": [ { - "_id" : 1 + "_id": 1 } ] } @@ -105,13 +102,13 @@ } ] }, - "outcome" : [ + "outcome": [ { - "collectionName" : "test", - "databaseName" : "operation-insert", - "documents" : [ + "collectionName": "test", + "databaseName": "operation-insert", + "documents": [ { - "_id" : 1 + "_id": 1 } ] } diff --git a/source/tracing/tests/operation/insert.yml b/source/tracing/tests/operation/insert.yml new file mode 100644 index 0000000000..aa42b0d654 --- /dev/null +++ b/source/tracing/tests/operation/insert.yml @@ -0,0 +1,63 @@ +description: operation insert +schemaVersion: '1.26' +createEntities: + - client: + id: client0 + useMultipleMongoses: false + tracing: + enableCommandPayload: true + - database: + id: database0 + client: client0 + databaseName: operation-insert + - collection: + id: collection0 + database: database0 + collectionName: test +initialData: + - collectionName: test + databaseName: operation-insert + documents: [] +tests: + - description: insert one element + operations: + - object: collection0 + name: insertOne + arguments: + document: + _id: 1 + expectTracingSpans: + client: client0 + ignoreExtraSpans: false + spans: + - name: insert operation-insert.test + tags: + db.system: mongodb + db.namespace: operation-insert + db.collection.name: test + db.operation.name: insert + db.operation.summary: insert operation-insert.test + nested: + - name: command insert + tags: + db.system: mongodb + db.namespace: operation-insert + server.address: { $$type: string } + server.port: { $$type: [ 'long', 'string' ] } + server.type: { $$type: string } + db.query.summary: insert + db.query.text: + $$matchAsDocument: + $$matchAsRoot: + insert: test + ordered: true + txnNumber: { $$unsetOrMatches: 1 } + $db: operation-insert + documents: + - _id: 1 + + outcome: + - collectionName: test + databaseName: operation-insert + documents: + - _id: 1 diff --git a/source/tracing/tests/transaction/transaction.json b/source/tracing/tests/transaction/transaction.json index f0d95cc90a..10db743270 100644 --- a/source/tracing/tests/transaction/transaction.json +++ b/source/tracing/tests/transaction/transaction.json @@ -1,6 +1,6 @@ { - "description" : "transaction spans", - "schemaVersion" : "1.9", + "description": "transaction spans", + "schemaVersion": "1.26", "runOnRequirements": [ { "minServerVersion": "4.0", @@ -16,154 +16,164 @@ ] } ], - "createEntities" : [ + "createEntities": [ { - "client" : { - "id" : "client0", - "useMultipleMongoses" : false, - "tracing" : { - "enableCommandPayload" : true + "client": { + "id": "client0", + "useMultipleMongoses": false, + "tracing": { + "enableCommandPayload": true } } }, { - "database" : { - "id" : "database0", - "client" : "client0", - "databaseName" : "transaction-tests" + "database": { + "id": "database0", + "client": "client0", + "databaseName": "transaction-tests" } }, { - "collection" : { - "id" : "collection0", - "database" : "database0", - "collectionName" : "test" + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "test" } }, { - "session" : { - "id" : "session0", - "client" : "client0" + "session": { + "id": "session0", + "client": "client0" } } ], - "initialData" : [ + "initialData": [ { - "collectionName" : "test", - "databaseName" : "transaction-tests", - "documents" : [] + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [] } ], - "tests" : [ + "tests": [ { - "description" : "tracing around transaction", - "operations" : [ + "description": "tracing around transaction", + "operations": [ { - "object" : "session0", - "name" : "startTransaction" + "object": "session0", + "name": "startTransaction" }, { - "object" : "collection0", - "name" : "insertOne", - "arguments" : { - "session" : "session0", - "document" : { - "_id" : 1 + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 1 } } }, { - "object" : "session0", - "name" : "commitTransaction" + "object": "session0", + "name": "commitTransaction" }, { - "name" : "find", - "object" : "collection0", - "arguments" : { - "filter" : { - "x" : 1 + "name": "find", + "object": "collection0", + "arguments": { + "filter": { + "x": 1 } } } ], - "expectTracingSpans" : { - "client" : "client0", - "ignoreExtraSpans" : false, - "spans" : [ + "expectTracingSpans": { + "client": "client0", + "ignoreExtraSpans": false, + "spans": [ { - "name" : "transaction", - "tags" : { - "db.system" : "mongodb" + "name": "transaction", + "tags": { + "db.system": "mongodb" }, - "nested" : [ + "nested": [ { - "name" : "insert", - "tags" : { - "db.system" : "mongodb" + "name": "insert transaction-tests.test", + "tags": { + "db.system": "mongodb", + "db.namespace": "transaction-tests", + "db.collection.name": "test", + "db.operation.name": "insert", + "db.operation.summary": "insert transaction-tests.test" }, - "nested" : [ + "nested": [ { - "name" : "command insert", - "tags" : { - "db.system" : "mongodb", - "db.namespace" : "transaction-tests", - "server.address" : { - "$$type" : "string" + "name": "command insert", + "tags": { + "db.system": "mongodb", + "db.namespace": "transaction-tests", + "server.address": { + "$$type": "string" }, - "server.port" : { - "$$type" : [ + "server.port": { + "$$type": [ "long", "string" ] }, - "server.type" : { - "$$type" : "string" + "server.type": { + "$$type": "string" }, - "db.query.summary" : { - "$$matchAsDocument" : { - "$$matchAsRoot" : { - "insert" : "test", - "ordered" : true - } - } - }, - "db.query.text" : { - "$$matchAsDocument" : { - "$$matchAsRoot" : { - "insert" : "test", - "ordered" : true, - "$db" : "transaction-tests", - "lsid" : { - "$$sessionLsid" : "session0" + "db.query.summary": "insert", + "db.query.text": { + "$$matchAsDocument": { + "$$matchAsRoot": { + "insert": "test", + "ordered": true, + "$db": "transaction-tests", + "lsid": { + "$$sessionLsid": "session0" }, - "txnNumber" : 1, - "startTransaction" : true, - "autocommit" : false, - "documents" : [ + "txnNumber": 1, + "startTransaction": true, + "autocommit": false, + "documents": [ { - "_id" : 1 + "_id": 1 } ] } } }, - "db.mongodb.lsid" : { - "$$sessionLsid" : "session0" + "db.mongodb.lsid": { + "$$sessionLsid": "session0" } } } ] }, { - "name" : "commitTransaction", - "tags" : { - "db.system" : "mongodb" + "name": "commitTransaction admin.$cmd", + "tags": { + "db.system": "mongodb" }, - "nested" : [ + "nested": [ { - "name" : "command commitTransaction", - "tags" : { - "db.system" : "mongodb" + "name": "command commitTransaction", + "tags": { + "db.system": "mongodb", + "db.query.text": { + "$$matchAsDocument": { + "$$matchAsRoot": { + "commitTransaction": 1, + "$db": "admin", + "lsid": { + "$$sessionLsid": "session0" + }, + "txnNumber": 1, + "autocommit": false + } + } + } } } ] @@ -171,48 +181,39 @@ ] }, { - "name" : "find", - "nested" : [ + "name": "find transaction-tests.test", + "nested": [ { - "name" : "command find", - "tags" : { - "db.system" : "mongodb", - "db.namespace" : "transaction-tests", - "server.address" : { - "$$type" : "string" + "name": "command find", + "tags": { + "db.system": "mongodb", + "db.namespace": "transaction-tests", + "server.address": { + "$$type": "string" }, - "server.port" : { - "$$type" : [ + "server.port": { + "$$type": [ "long", "string" ] }, - "server.type" : { - "$$type" : "string" + "server.type": { + "$$type": "string" }, - "db.query.summary" : { - "$$matchAsDocument" : { - "$$matchAsRoot" : { - "find" : "test", - "filter" : { - "x" : 1 - } - } - } - } + "db.query.summary": "find" } } ] } ] }, - "outcome" : [ + "outcome": [ { - "collectionName" : "test", - "databaseName" : "transaction-tests", - "documents" : [ + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [ { - "_id" : 1 + "_id": 1 } ] } diff --git a/source/tracing/tests/transaction/transaction.yml b/source/tracing/tests/transaction/transaction.yml new file mode 100644 index 0000000000..9e87b6a2d7 --- /dev/null +++ b/source/tracing/tests/transaction/transaction.yml @@ -0,0 +1,116 @@ +description: transaction spans +schemaVersion: '1.26' +runOnRequirements: + - minServerVersion: '4.0' + topologies: + - replicaset + - minServerVersion: '4.1.8' + topologies: + - sharded + - load-balanced +createEntities: + - client: + id: client0 + useMultipleMongoses: false + tracing: + enableCommandPayload: true + - database: + id: database0 + client: client0 + databaseName: transaction-tests + - collection: + id: collection0 + database: database0 + collectionName: test + - session: + id: session0 + client: client0 +initialData: + - collectionName: test + databaseName: transaction-tests + documents: [] +tests: + - description: tracing around transaction + operations: + - object: session0 + name: startTransaction + - object: collection0 + name: insertOne + arguments: + session: session0 + document: + _id: 1 + - object: session0 + name: commitTransaction + - name: find + object: collection0 + arguments: + filter: + x: 1 + expectTracingSpans: + client: client0 + ignoreExtraSpans: false + spans: + - name: transaction + tags: + db.system: mongodb + nested: + - name: insert transaction-tests.test + tags: + db.system: mongodb + db.namespace: transaction-tests + db.collection.name: test + db.operation.name: insert + db.operation.summary: insert transaction-tests.test + nested: + - name: command insert + tags: + db.system: mongodb + db.namespace: transaction-tests + server.address: { $$type: string } + server.port: { $$type: ['long', 'string'] } + server.type: { $$type: string } + db.query.summary: insert + db.query.text: + $$matchAsDocument: + $$matchAsRoot: + insert: test + ordered: true + $db: transaction-tests + lsid: { $$sessionLsid: session0 } + txnNumber: 1 + startTransaction: true + autocommit: false + documents: + - _id: 1 + db.mongodb.lsid: { $$sessionLsid: session0 } + - name: commitTransaction admin.$cmd + tags: + db.system: mongodb + nested: + - name: command commitTransaction + tags: + db.system: mongodb + db.query.text: + $$matchAsDocument: + $$matchAsRoot: + commitTransaction: 1 + $db: admin + lsid: { $$sessionLsid: session0 } + txnNumber: 1 + autocommit: false + - name: find transaction-tests.test + nested: + - name: command find + tags: + db.system: mongodb + db.namespace: transaction-tests + server.address: { $$type: string } + server.port: { $$type: ['long', 'string'] } + server.type: { $$type: string } + db.query.summary: find + outcome: + - collectionName: test + databaseName: transaction-tests + documents: + - _id: 1 diff --git a/source/unified-test-format/schema-1.26.json b/source/unified-test-format/schema-1.26.json new file mode 100644 index 0000000000..d0fda99cbc --- /dev/null +++ b/source/unified-test-format/schema-1.26.json @@ -0,0 +1,1217 @@ +{ + "$schema": "https://json-schema.org/draft/2019-09/schema#", + "title": "Unified Test Format", + "type": "object", + "additionalProperties": false, + "required": [ + "description", + "schemaVersion", + "tests" + ], + "properties": { + "description": { + "type": "string" + }, + "schemaVersion": { + "$ref": "#/definitions/version" + }, + "runOnRequirements": { + "type": "array", + "minItems": 1, + "items": { + "$ref": "#/definitions/runOnRequirement" + } + }, + "createEntities": { + "type": "array", + "minItems": 1, + "items": { + "$ref": "#/definitions/entity" + } + }, + "initialData": { + "type": "array", + "minItems": 1, + "items": { + "$ref": "#/definitions/collectionData" + } + }, + "tests": { + "type": "array", + "minItems": 1, + "items": { + "$ref": "#/definitions/test" + } + }, + "_yamlAnchors": { + "type": "object", + "additionalProperties": true + } + }, + "definitions": { + "version": { + "type": "string", + "pattern": "^[0-9]+(\\.[0-9]+){1,2}$" + }, + "runOnRequirement": { + "type": "object", + "additionalProperties": false, + "minProperties": 1, + "properties": { + "maxServerVersion": { + "$ref": "#/definitions/version" + }, + "minServerVersion": { + "$ref": "#/definitions/version" + }, + "topologies": { + "type": "array", + "minItems": 1, + "items": { + "type": "string", + "enum": [ + "single", + "replicaset", + "sharded", + "sharded-replicaset", + "load-balanced" + ] + } + }, + "serverless": { + "type": "string", + "enum": [ + "require", + "forbid", + "allow" + ] + }, + "serverParameters": { + "type": "object", + "minProperties": 1 + }, + "auth": { + "type": "boolean" + }, + "authMechanism": { + "type": "string" + }, + "csfle": { + "type": "boolean" + } + } + }, + "entity": { + "type": "object", + "additionalProperties": false, + "maxProperties": 1, + "minProperties": 1, + "properties": { + "client": { + "type": "object", + "additionalProperties": false, + "required": [ + "id" + ], + "properties": { + "id": { + "type": "string" + }, + "uriOptions": { + "type": "object" + }, + "useMultipleMongoses": { + "type": "boolean" + }, + "observeEvents": { + "type": "array", + "minItems": 1, + "items": { + "type": "string", + "enum": [ + "commandStartedEvent", + "commandSucceededEvent", + "commandFailedEvent", + "poolCreatedEvent", + "poolReadyEvent", + "poolClearedEvent", + "poolClosedEvent", + "connectionCreatedEvent", + "connectionReadyEvent", + "connectionClosedEvent", + "connectionCheckOutStartedEvent", + "connectionCheckOutFailedEvent", + "connectionCheckedOutEvent", + "connectionCheckedInEvent", + "serverDescriptionChangedEvent", + "topologyDescriptionChangedEvent", + "topologyOpeningEvent", + "topologyClosedEvent" + ] + } + }, + "ignoreCommandMonitoringEvents": { + "type": "array", + "minItems": 1, + "items": { + "type": "string" + } + }, + "storeEventsAsEntities": { + "deprecated": true, + "type": "array", + "minItems": 1, + "items": { + "$ref": "#/definitions/storeEventsAsEntity" + } + }, + "observeLogMessages": { + "type": "object", + "minProperties": 1, + "additionalProperties": false, + "properties": { + "command": { + "$ref": "#/definitions/logSeverityLevel" + }, + "topology": { + "$ref": "#/definitions/logSeverityLevel" + }, + "serverSelection": { + "$ref": "#/definitions/logSeverityLevel" + }, + "connection": { + "$ref": "#/definitions/logSeverityLevel" + } + } + }, + "serverApi": { + "$ref": "#/definitions/serverApi" + }, + "observeSensitiveCommands": { + "type": "boolean" + }, + "autoEncryptOpts": { + "type": "object", + "additionalProperties": false, + "required": [ + "keyVaultNamespace", + "kmsProviders" + ], + "properties": { + "keyVaultNamespace": { + "type": "string" + }, + "bypassAutoEncryption": { + "type": "boolean" + }, + "kmsProviders": { + "$ref": "#/definitions/kmsProviders" + }, + "schemaMap": { + "type": "object", + "additionalProperties": { + "type": "object" + } + }, + "extraOptions": { + "type": "object" + }, + "encryptedFieldsMap": { + "type": "object", + "additionalProperties": { + "type": "object" + } + }, + "bypassQueryAnalysis": { + "type": "boolean" + }, + "keyExpirationMS": { + "type": "integer" + } + } + }, + "tracing": { + "type": "object", + "additionalProperties": false, + "properties": { + "enableCommandPayload": { + "type": "boolean" + } + } + } + } + }, + "clientEncryption": { + "type": "object", + "additionalProperties": false, + "required": [ + "id", + "clientEncryptionOpts" + ], + "properties": { + "id": { + "type": "string" + }, + "clientEncryptionOpts": { + "$ref": "#/definitions/clientEncryptionOpts" + } + } + }, + "database": { + "type": "object", + "additionalProperties": false, + "required": [ + "id", + "client", + "databaseName" + ], + "properties": { + "id": { + "type": "string" + }, + "client": { + "type": "string" + }, + "databaseName": { + "type": "string" + }, + "databaseOptions": { + "$ref": "#/definitions/collectionOrDatabaseOptions" + } + } + }, + "collection": { + "type": "object", + "additionalProperties": false, + "required": [ + "id", + "database", + "collectionName" + ], + "properties": { + "id": { + "type": "string" + }, + "database": { + "type": "string" + }, + "collectionName": { + "type": "string" + }, + "collectionOptions": { + "$ref": "#/definitions/collectionOrDatabaseOptions" + } + } + }, + "session": { + "type": "object", + "additionalProperties": false, + "required": [ + "id", + "client" + ], + "properties": { + "id": { + "type": "string" + }, + "client": { + "type": "string" + }, + "sessionOptions": { + "type": "object" + } + } + }, + "bucket": { + "type": "object", + "additionalProperties": false, + "required": [ + "id", + "database" + ], + "properties": { + "id": { + "type": "string" + }, + "database": { + "type": "string" + }, + "bucketOptions": { + "type": "object" + } + } + }, + "thread": { + "type": "object", + "additionalProperties": false, + "required": [ + "id" + ], + "properties": { + "id": { + "type": "string" + } + } + } + } + }, + "logComponent": { + "type": "string", + "enum": [ + "command", + "topology", + "serverSelection", + "connection" + ] + }, + "spanComponent": { + "type": "object", + "additionalProperties": false, + "required": [ + "name", + "tags" + ], + "properties": { + "name": { + "type": "string" + }, + "tags": { + "type": "object" + }, + "nested": { + "type": "array", + "items": { + "$ref": "#/definitions/spanComponent" + } + } + } + }, + "logSeverityLevel": { + "type": "string", + "enum": [ + "emergency", + "alert", + "critical", + "error", + "warning", + "notice", + "info", + "debug", + "trace" + ] + }, + "clientEncryptionOpts": { + "type": "object", + "additionalProperties": false, + "required": [ + "keyVaultClient", + "keyVaultNamespace", + "kmsProviders" + ], + "properties": { + "keyVaultClient": { + "type": "string" + }, + "keyVaultNamespace": { + "type": "string" + }, + "kmsProviders": { + "$ref": "#/definitions/kmsProviders" + }, + "keyExpirationMS": { + "type": "integer" + } + } + }, + "kmsProviders": { + "$defs": { + "stringOrPlaceholder": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "object", + "additionalProperties": false, + "required": [ + "$$placeholder" + ], + "properties": { + "$$placeholder": {} + } + } + ] + } + }, + "type": "object", + "additionalProperties": false, + "patternProperties": { + "^aws(:[a-zA-Z0-9_]+)?$": { + "type": "object", + "additionalProperties": false, + "properties": { + "accessKeyId": { + "$ref": "#/definitions/kmsProviders/$defs/stringOrPlaceholder" + }, + "secretAccessKey": { + "$ref": "#/definitions/kmsProviders/$defs/stringOrPlaceholder" + }, + "sessionToken": { + "$ref": "#/definitions/kmsProviders/$defs/stringOrPlaceholder" + } + } + }, + "^azure(:[a-zA-Z0-9_]+)?$": { + "type": "object", + "additionalProperties": false, + "properties": { + "tenantId": { + "$ref": "#/definitions/kmsProviders/$defs/stringOrPlaceholder" + }, + "clientId": { + "$ref": "#/definitions/kmsProviders/$defs/stringOrPlaceholder" + }, + "clientSecret": { + "$ref": "#/definitions/kmsProviders/$defs/stringOrPlaceholder" + }, + "identityPlatformEndpoint": { + "$ref": "#/definitions/kmsProviders/$defs/stringOrPlaceholder" + } + } + }, + "^gcp(:[a-zA-Z0-9_]+)?$": { + "type": "object", + "additionalProperties": false, + "properties": { + "email": { + "$ref": "#/definitions/kmsProviders/$defs/stringOrPlaceholder" + }, + "privateKey": { + "$ref": "#/definitions/kmsProviders/$defs/stringOrPlaceholder" + }, + "endpoint": { + "$ref": "#/definitions/kmsProviders/$defs/stringOrPlaceholder" + } + } + }, + "^kmip(:[a-zA-Z0-9_]+)?$": { + "type": "object", + "additionalProperties": false, + "properties": { + "endpoint": { + "$ref": "#/definitions/kmsProviders/$defs/stringOrPlaceholder" + } + } + }, + "^local(:[a-zA-Z0-9_]+)?$": { + "type": "object", + "additionalProperties": false, + "properties": { + "key": { + "$ref": "#/definitions/kmsProviders/$defs/stringOrPlaceholder" + } + } + } + } + }, + "storeEventsAsEntity": { + "deprecated": true, + "type": "object", + "additionalProperties": false, + "required": [ + "id", + "events" + ], + "properties": { + "id": { + "type": "string" + }, + "events": { + "type": "array", + "minItems": 1, + "items": { + "type": "string", + "enum": [ + "PoolCreatedEvent", + "PoolReadyEvent", + "PoolClearedEvent", + "PoolClosedEvent", + "ConnectionCreatedEvent", + "ConnectionReadyEvent", + "ConnectionClosedEvent", + "ConnectionCheckOutStartedEvent", + "ConnectionCheckOutFailedEvent", + "ConnectionCheckedOutEvent", + "ConnectionCheckedInEvent", + "CommandStartedEvent", + "CommandSucceededEvent", + "CommandFailedEvent", + "ServerDescriptionChangedEvent", + "TopologyDescriptionChangedEvent" + ] + } + } + } + }, + "collectionData": { + "type": "object", + "additionalProperties": false, + "required": [ + "collectionName", + "databaseName", + "documents" + ], + "properties": { + "collectionName": { + "type": "string" + }, + "databaseName": { + "type": "string" + }, + "createOptions": { + "type": "object", + "properties": { + "writeConcern": false + } + }, + "documents": { + "type": "array", + "items": { + "type": "object" + } + } + } + }, + "expectedEventsForClient": { + "type": "object", + "additionalProperties": false, + "required": [ + "client", + "events" + ], + "properties": { + "client": { + "type": "string" + }, + "eventType": { + "type": "string", + "enum": [ + "command", + "cmap", + "sdam" + ] + }, + "events": { + "type": "array" + }, + "ignoreExtraEvents": { + "type": "boolean" + } + }, + "oneOf": [ + { + "required": [ + "eventType" + ], + "properties": { + "eventType": { + "const": "command" + }, + "events": { + "type": "array", + "items": { + "$ref": "#/definitions/expectedCommandEvent" + } + } + } + }, + { + "required": [ + "eventType" + ], + "properties": { + "eventType": { + "const": "cmap" + }, + "events": { + "type": "array", + "items": { + "$ref": "#/definitions/expectedCmapEvent" + } + } + } + }, + { + "required": [ + "eventType" + ], + "properties": { + "eventType": { + "const": "sdam" + }, + "events": { + "type": "array", + "items": { + "$ref": "#/definitions/expectedSdamEvent" + } + } + } + }, + { + "additionalProperties": false, + "properties": { + "client": { + "type": "string" + }, + "events": { + "type": "array", + "items": { + "$ref": "#/definitions/expectedCommandEvent" + } + }, + "ignoreExtraEvents": { + "type": "boolean" + } + } + } + ] + }, + "expectedCommandEvent": { + "type": "object", + "additionalProperties": false, + "maxProperties": 1, + "minProperties": 1, + "properties": { + "commandStartedEvent": { + "type": "object", + "additionalProperties": false, + "properties": { + "command": { + "type": "object" + }, + "commandName": { + "type": "string" + }, + "databaseName": { + "type": "string" + }, + "hasServiceId": { + "type": "boolean" + }, + "hasServerConnectionId": { + "type": "boolean" + } + } + }, + "commandSucceededEvent": { + "type": "object", + "additionalProperties": false, + "properties": { + "reply": { + "type": "object" + }, + "commandName": { + "type": "string" + }, + "databaseName": { + "type": "string" + }, + "hasServiceId": { + "type": "boolean" + }, + "hasServerConnectionId": { + "type": "boolean" + } + } + }, + "commandFailedEvent": { + "type": "object", + "additionalProperties": false, + "properties": { + "commandName": { + "type": "string" + }, + "databaseName": { + "type": "string" + }, + "hasServiceId": { + "type": "boolean" + }, + "hasServerConnectionId": { + "type": "boolean" + } + } + } + } + }, + "expectedCmapEvent": { + "type": "object", + "additionalProperties": false, + "maxProperties": 1, + "minProperties": 1, + "properties": { + "poolCreatedEvent": { + "type": "object", + "additionalProperties": false, + "properties": {} + }, + "poolReadyEvent": { + "type": "object", + "additionalProperties": false, + "properties": {} + }, + "poolClearedEvent": { + "type": "object", + "additionalProperties": false, + "properties": { + "hasServiceId": { + "type": "boolean" + }, + "interruptInUseConnections": { + "type": "boolean" + } + } + }, + "poolClosedEvent": { + "type": "object", + "additionalProperties": false, + "properties": {} + }, + "connectionCreatedEvent": { + "type": "object", + "additionalProperties": false, + "properties": {} + }, + "connectionReadyEvent": { + "type": "object", + "additionalProperties": false, + "properties": {} + }, + "connectionClosedEvent": { + "type": "object", + "additionalProperties": false, + "properties": { + "reason": { + "type": "string" + } + } + }, + "connectionCheckOutStartedEvent": { + "type": "object", + "additionalProperties": false, + "properties": {} + }, + "connectionCheckOutFailedEvent": { + "type": "object", + "additionalProperties": false, + "properties": { + "reason": { + "type": "string" + } + } + }, + "connectionCheckedOutEvent": { + "type": "object", + "additionalProperties": false, + "properties": {} + }, + "connectionCheckedInEvent": { + "type": "object", + "additionalProperties": false, + "properties": {} + } + } + }, + "expectedSdamEvent": { + "type": "object", + "additionalProperties": false, + "maxProperties": 1, + "minProperties": 1, + "properties": { + "serverDescriptionChangedEvent": { + "type": "object", + "additionalProperties": false, + "properties": { + "previousDescription": { + "$ref": "#/definitions/serverDescription" + }, + "newDescription": { + "$ref": "#/definitions/serverDescription" + } + } + }, + "topologyDescriptionChangedEvent": { + "type": "object", + "additionalProperties": false, + "properties": { + "previousDescription": { + "$ref": "#/definitions/topologyDescription" + }, + "newDescription": { + "$ref": "#/definitions/topologyDescription" + } + } + }, + "serverHeartbeatStartedEvent": { + "type": "object", + "additionalProperties": false, + "properties": { + "awaited": { + "type": "boolean" + } + } + }, + "serverHeartbeatSucceededEvent": { + "type": "object", + "additionalProperties": false, + "properties": { + "awaited": { + "type": "boolean" + } + } + }, + "serverHeartbeatFailedEvent": { + "type": "object", + "additionalProperties": false, + "properties": { + "awaited": { + "type": "boolean" + } + } + }, + "topologyOpeningEvent": { + "type": "object", + "additionalProperties": false, + "properties": {} + }, + "topologyClosedEvent": { + "type": "object", + "additionalProperties": false, + "properties": {} + } + } + }, + "serverDescription": { + "type": "object", + "additionalProperties": false, + "properties": { + "type": { + "type": "string", + "enum": [ + "Standalone", + "Mongos", + "PossiblePrimary", + "RSPrimary", + "RSSecondary", + "RSOther", + "RSArbiter", + "RSGhost", + "LoadBalancer", + "Unknown" + ] + } + } + }, + "topologyDescription": { + "type": "object", + "additionalProperties": false, + "properties": { + "type": { + "type": "string", + "enum": [ + "Single", + "Unknown", + "ReplicaSetNoPrimary", + "ReplicaSetWithPrimary", + "Sharded", + "LoadBalanced" + ] + } + } + }, + "expectedLogMessagesForClient": { + "type": "object", + "additionalProperties": false, + "required": [ + "client", + "messages" + ], + "properties": { + "client": { + "type": "string" + }, + "messages": { + "type": "array", + "items": { + "$ref": "#/definitions/expectedLogMessage" + } + }, + "ignoreExtraMessages": { + "type": "boolean" + }, + "ignoreMessages": { + "type": "array", + "items": { + "$ref": "#/definitions/expectedLogMessage" + } + } + } + }, + "expectedLogMessage": { + "type": "object", + "additionalProperties": false, + "required": [ + "level", + "component", + "data" + ], + "properties": { + "level": { + "$ref": "#/definitions/logSeverityLevel" + }, + "component": { + "$ref": "#/definitions/logComponent" + }, + "data": { + "type": "object" + }, + "failureIsRedacted": { + "type": "boolean" + } + } + }, + "collectionOrDatabaseOptions": { + "type": "object", + "additionalProperties": false, + "properties": { + "readConcern": { + "type": "object" + }, + "readPreference": { + "type": "object" + }, + "writeConcern": { + "type": "object" + }, + "timeoutMS": { + "type": "integer" + } + } + }, + "serverApi": { + "type": "object", + "additionalProperties": false, + "required": [ + "version" + ], + "properties": { + "version": { + "type": "string" + }, + "strict": { + "type": "boolean" + }, + "deprecationErrors": { + "type": "boolean" + } + } + }, + "operation": { + "type": "object", + "additionalProperties": false, + "required": [ + "name", + "object" + ], + "properties": { + "name": { + "type": "string" + }, + "object": { + "type": "string" + }, + "arguments": { + "type": "object" + }, + "ignoreResultAndError": { + "type": "boolean" + }, + "expectError": { + "$ref": "#/definitions/expectedError" + }, + "expectResult": {}, + "saveResultAsEntity": { + "type": "string" + } + }, + "allOf": [ + { + "not": { + "required": [ + "expectError", + "expectResult" + ] + } + }, + { + "not": { + "required": [ + "expectError", + "saveResultAsEntity" + ] + } + }, + { + "not": { + "required": [ + "ignoreResultAndError", + "expectResult" + ] + } + }, + { + "not": { + "required": [ + "ignoreResultAndError", + "expectError" + ] + } + }, + { + "not": { + "required": [ + "ignoreResultAndError", + "saveResultAsEntity" + ] + } + } + ] + }, + "expectedError": { + "type": "object", + "additionalProperties": false, + "minProperties": 1, + "properties": { + "isError": { + "type": "boolean", + "const": true + }, + "isClientError": { + "type": "boolean" + }, + "isTimeoutError": { + "type": "boolean" + }, + "errorContains": { + "type": "string" + }, + "errorCode": { + "type": "integer" + }, + "errorCodeName": { + "type": "string" + }, + "errorLabelsContain": { + "type": "array", + "minItems": 1, + "items": { + "type": "string" + } + }, + "errorLabelsOmit": { + "type": "array", + "minItems": 1, + "items": { + "type": "string" + } + }, + "writeErrors": { + "type": "object" + }, + "writeConcernErrors": { + "type": "array", + "items": { + "type": "object" + } + }, + "errorResponse": { + "type": "object" + }, + "expectResult": {} + } + }, + "test": { + "type": "object", + "additionalProperties": false, + "required": [ + "description", + "operations" + ], + "properties": { + "description": { + "type": "string" + }, + "runOnRequirements": { + "type": "array", + "minItems": 1, + "items": { + "$ref": "#/definitions/runOnRequirement" + } + }, + "skipReason": { + "type": "string" + }, + "operations": { + "type": "array", + "items": { + "$ref": "#/definitions/operation" + } + }, + "expectEvents": { + "type": "array", + "minItems": 1, + "items": { + "$ref": "#/definitions/expectedEventsForClient" + } + }, + "expectLogMessages": { + "type": "array", + "minItems": 1, + "items": { + "$ref": "#/definitions/expectedLogMessagesForClient" + } + }, + "expectTracingSpans": { + "additionalProperties" : false, + "type": "object", + "required": [ + "client", + "spans" + ], + "properties": { + "client": { + "type": "string" + }, + "ignoreExtraSpans": { + "type": "boolean" + }, + "spans": { + "type": "array", + "minItems": 1, + "items": { + "$ref": "#/definitions/spanComponent" + } + } + } + }, + "outcome": { + "type": "array", + "minItems": 1, + "items": { + "$ref": "#/definitions/collectionData" + } + } + } + } + } +} diff --git a/source/unified-test-format/tests/invalid/entity-client-observeTracingMessages-additionalProperties.yml b/source/unified-test-format/tests/invalid/entity-client-observeTracingMessages-additionalProperties.yml new file mode 100644 index 0000000000..b970e58ab9 --- /dev/null +++ b/source/unified-test-format/tests/invalid/entity-client-observeTracingMessages-additionalProperties.yml @@ -0,0 +1,14 @@ +description: "entity-client-observeTracingMessages-additionalProperties" + +schemaVersion: "1.26" + +createEntities: + - client: + id: &client0 "client0" + tracing: { + foo: "bar" + } + +tests: + - description: "observeTracingMessages must not have additional properties'" + operations: [ ] diff --git a/source/unified-test-format/tests/invalid/entity-client-observeTracingMessages-additionalPropertyType.json b/source/unified-test-format/tests/invalid/entity-client-observeTracingMessages-additionalPropertyType.json new file mode 100644 index 0000000000..f0f3e7ddba --- /dev/null +++ b/source/unified-test-format/tests/invalid/entity-client-observeTracingMessages-additionalPropertyType.json @@ -0,0 +1,20 @@ +{ + "description": "entity-client-observeTracingMessages-additionalPropertyType", + "schemaVersion": "1.25", + "createEntities": [ + { + "client": { + "id": "client0", + "tracing": { + "enableCommandPayload": 0 + } + } + } + ], + "tests": [ + { + "description": "observeTracingMessages enableCommandPayload must be boolean", + "operations": [] + } + ] +} diff --git a/source/unified-test-format/tests/invalid/entity-client-observeTracingMessages-additionalPropertyType.yml b/source/unified-test-format/tests/invalid/entity-client-observeTracingMessages-additionalPropertyType.yml new file mode 100644 index 0000000000..6167c13089 --- /dev/null +++ b/source/unified-test-format/tests/invalid/entity-client-observeTracingMessages-additionalPropertyType.yml @@ -0,0 +1,14 @@ +description: "entity-client-observeTracingMessages-additionalPropertyType" + +schemaVersion: "1.26" + +createEntities: + - client: + id: &client0 "client0" + tracing: { + enableCommandPayload: 0 + } + +tests: + - description: "observeTracingMessages enableCommandPayload must be boolean" + operations: [ ] diff --git a/source/unified-test-format/tests/invalid/entity-client-observeTracingMessages-type.json b/source/unified-test-format/tests/invalid/entity-client-observeTracingMessages-type.json new file mode 100644 index 0000000000..57b970e681 --- /dev/null +++ b/source/unified-test-format/tests/invalid/entity-client-observeTracingMessages-type.json @@ -0,0 +1,18 @@ +{ + "description": "entity-client-observeTracingMessages-type", + "schemaVersion": "1.26", + "createEntities": [ + { + "client": { + "id": "client0", + "tracing": "foo" + } + } + ], + "tests": [ + { + "description": "observeTracingMessages must be an object", + "operations": [] + } + ] +} diff --git a/source/unified-test-format/tests/invalid/entity-client-observeTracingMessages-type.yml b/source/unified-test-format/tests/invalid/entity-client-observeTracingMessages-type.yml new file mode 100644 index 0000000000..e882dc26cd --- /dev/null +++ b/source/unified-test-format/tests/invalid/entity-client-observeTracingMessages-type.yml @@ -0,0 +1,12 @@ +description: "entity-client-observeTracingMessages-type" + +schemaVersion: "1.26" + +createEntities: + - client: + id: &client0 "client0" + tracing: "foo" + +tests: + - description: "observeTracingMessages must be an object" + operations: [ ] diff --git a/source/unified-test-format/tests/invalid/expectedTracingSpans-additionalProperties.json b/source/unified-test-format/tests/invalid/expectedTracingSpans-additionalProperties.json new file mode 100644 index 0000000000..b6f8104747 --- /dev/null +++ b/source/unified-test-format/tests/invalid/expectedTracingSpans-additionalProperties.json @@ -0,0 +1,25 @@ +{ + "description": "expectedTracingSpans-additionalProperties", + "schemaVersion": "1.26", + "createEntities": [ + { + "client": { + "id": "client0" + } + } + ], + "tests": [ + { + "description": "additional property foo not allowed in expectTracingSpans", + "operations": [], + "expectTracingSpans": { + "client": "client0", + "ignoreExtraSpans": false, + "spans": [ + {} + ], + "foo": 0 + } + } + ] +} diff --git a/source/unified-test-format/tests/invalid/expectedTracingSpans-additionalProperties.yml b/source/unified-test-format/tests/invalid/expectedTracingSpans-additionalProperties.yml new file mode 100644 index 0000000000..d351f3601f --- /dev/null +++ b/source/unified-test-format/tests/invalid/expectedTracingSpans-additionalProperties.yml @@ -0,0 +1,16 @@ +description: "expectedTracingSpans-additionalProperties" + +schemaVersion: "1.26" + +createEntities: + - client: + id: &client0 "client0" + +tests: + - description: "additional property foo not allowed in expectTracingSpans" + operations: [] + expectTracingSpans: + client: *client0 + ignoreExtraSpans: false + spans: [{}] + foo: 0 diff --git a/source/unified-test-format/tests/invalid/expectedTracingSpans-clientType.json b/source/unified-test-format/tests/invalid/expectedTracingSpans-clientType.json new file mode 100644 index 0000000000..55fc7cd170 --- /dev/null +++ b/source/unified-test-format/tests/invalid/expectedTracingSpans-clientType.json @@ -0,0 +1,23 @@ +{ + "description": "expectedTracingSpans-clientType", + "schemaVersion": "1.26", + "createEntities": [ + { + "client": { + "id": "client0" + } + } + ], + "tests": [ + { + "description": "client type must be string", + "operations": [], + "expectTracingSpans": { + "client": 0, + "spans": [ + {} + ] + } + } + ] +} diff --git a/source/unified-test-format/tests/invalid/expectedTracingSpans-clientType.yml b/source/unified-test-format/tests/invalid/expectedTracingSpans-clientType.yml new file mode 100644 index 0000000000..2bf9d8e42e --- /dev/null +++ b/source/unified-test-format/tests/invalid/expectedTracingSpans-clientType.yml @@ -0,0 +1,14 @@ +description: "expectedTracingSpans-clientType" + +schemaVersion: "1.26" + +createEntities: + - client: + id: &client0 "client0" + +tests: + - description: "client type must be string" + operations: [] + expectTracingSpans: + client: 0 + spans: [{}] diff --git a/source/unified-test-format/tests/invalid/expectedTracingSpans-missingPropertyClient.json b/source/unified-test-format/tests/invalid/expectedTracingSpans-missingPropertyClient.json new file mode 100644 index 0000000000..db651f72a6 --- /dev/null +++ b/source/unified-test-format/tests/invalid/expectedTracingSpans-missingPropertyClient.json @@ -0,0 +1,22 @@ +{ + "description": "expectedTracingSpans-missingPropertyClient", + "schemaVersion": "1.26", + "createEntities": [ + { + "client": { + "id": "client0" + } + } + ], + "tests": [ + { + "description": "missing required property client", + "operations": [], + "expectTracingSpans": { + "spans": [ + {} + ] + } + } + ] +} diff --git a/source/unified-test-format/tests/invalid/expectedTracingSpans-missingPropertyClient.yml b/source/unified-test-format/tests/invalid/expectedTracingSpans-missingPropertyClient.yml new file mode 100644 index 0000000000..e2e690110f --- /dev/null +++ b/source/unified-test-format/tests/invalid/expectedTracingSpans-missingPropertyClient.yml @@ -0,0 +1,13 @@ +description: "expectedTracingSpans-missingPropertyClient" + +schemaVersion: "1.26" + +createEntities: + - client: + id: &client0 "client0" + +tests: + - description: "missing required property client" + operations: [] + expectTracingSpans: + spans: [{}] diff --git a/source/unified-test-format/tests/invalid/expectedTracingSpans-missingPropertySpans.json b/source/unified-test-format/tests/invalid/expectedTracingSpans-missingPropertySpans.json new file mode 100644 index 0000000000..faf0373002 --- /dev/null +++ b/source/unified-test-format/tests/invalid/expectedTracingSpans-missingPropertySpans.json @@ -0,0 +1,20 @@ +{ + "description": "expectedTracingSpans-missingPropertySpans", + "schemaVersion": "1.26", + "createEntities": [ + { + "client": { + "id": "client0" + } + } + ], + "tests": [ + { + "description": "missing required property spans", + "operations": [], + "expectTracingSpans": { + "client": "client0" + } + } + ] +} diff --git a/source/unified-test-format/tests/invalid/expectedTracingSpans-missingPropertySpans.yml b/source/unified-test-format/tests/invalid/expectedTracingSpans-missingPropertySpans.yml new file mode 100644 index 0000000000..d86be8be7c --- /dev/null +++ b/source/unified-test-format/tests/invalid/expectedTracingSpans-missingPropertySpans.yml @@ -0,0 +1,13 @@ +description: "expectedTracingSpans-missingPropertySpans" + +schemaVersion: "1.26" + +createEntities: + - client: + id: &client0 "client0" + +tests: + - description: "missing required property spans" + operations: [] + expectTracingSpans: + client: client0 diff --git a/source/unified-test-format/tests/invalid/expectedTracingSpans-spanMalformedAdditionalProperties.json b/source/unified-test-format/tests/invalid/expectedTracingSpans-spanMalformedAdditionalProperties.json new file mode 100644 index 0000000000..aac61b51e0 --- /dev/null +++ b/source/unified-test-format/tests/invalid/expectedTracingSpans-spanMalformedAdditionalProperties.json @@ -0,0 +1,28 @@ +{ + "description": "expectedTracingSpans-spanMalformedAdditionalProperties", + "schemaVersion": "1.26", + "createEntities": [ + { + "client": { + "id": "client0" + } + } + ], + "tests": [ + { + "description": "Span must not have additional properties", + "operations": [], + "expectTracingSpans": { + "client": "client0", + "spans": [ + { + "name": "foo", + "tags": {}, + "nested": [], + "foo": "bar" + } + ] + } + } + ] +} diff --git a/source/unified-test-format/tests/invalid/expectedTracingSpans-spanMalformedAdditionalProperties.yml b/source/unified-test-format/tests/invalid/expectedTracingSpans-spanMalformedAdditionalProperties.yml new file mode 100644 index 0000000000..52f890d61a --- /dev/null +++ b/source/unified-test-format/tests/invalid/expectedTracingSpans-spanMalformedAdditionalProperties.yml @@ -0,0 +1,19 @@ +description: "expectedTracingSpans-spanMalformedAdditionalProperties" + +schemaVersion: "1.26" + +createEntities: + - client: + id: &client0 "client0" + +tests: + - description: "Span must not have additional properties" + operations: [] + expectTracingSpans: + client: client0 + spans: + - name: "foo" + tags: {} + nested: [] + foo: "bar" + diff --git a/source/unified-test-format/tests/invalid/expectedTracingSpans-spanMalformedMissingName.json b/source/unified-test-format/tests/invalid/expectedTracingSpans-spanMalformedMissingName.json new file mode 100644 index 0000000000..c9b879aeeb --- /dev/null +++ b/source/unified-test-format/tests/invalid/expectedTracingSpans-spanMalformedMissingName.json @@ -0,0 +1,27 @@ +{ + "description": "expectedTracingSpans-spanMalformedMissingName", + "schemaVersion": "1.26", + "createEntities": [ + { + "client": { + "id": "client0" + } + } + ], + "tests": [ + { + "description": "missing required span name", + "operations": [], + "expectTracingSpans": { + "client": "client0", + "spans": [ + { + "tags": { + "db.system": "mongodb" + } + } + ] + } + } + ] +} diff --git a/source/unified-test-format/tests/invalid/expectedTracingSpans-spanMalformedMissingName.yml b/source/unified-test-format/tests/invalid/expectedTracingSpans-spanMalformedMissingName.yml new file mode 100644 index 0000000000..6af8c3149d --- /dev/null +++ b/source/unified-test-format/tests/invalid/expectedTracingSpans-spanMalformedMissingName.yml @@ -0,0 +1,16 @@ +description: "expectedTracingSpans-spanMalformedMissingName" + +schemaVersion: "1.26" + +createEntities: + - client: + id: &client0 "client0" + +tests: + - description: "missing required span name" + operations: [] + expectTracingSpans: + client: client0 + spans: + - tags: + db.system: mongodb diff --git a/source/unified-test-format/tests/invalid/expectedTracingSpans-spanMalformedMissingTags.json b/source/unified-test-format/tests/invalid/expectedTracingSpans-spanMalformedMissingTags.json new file mode 100644 index 0000000000..d97cf8f6b2 --- /dev/null +++ b/source/unified-test-format/tests/invalid/expectedTracingSpans-spanMalformedMissingTags.json @@ -0,0 +1,25 @@ +{ + "description": "expectedTracingSpans-spanMalformedMissingTags", + "schemaVersion": "1.26", + "createEntities": [ + { + "client": { + "id": "client0" + } + } + ], + "tests": [ + { + "description": "missing required span tags", + "operations": [], + "expectTracingSpans": { + "client": "client0", + "spans": [ + { + "name": "foo" + } + ] + } + } + ] +} diff --git a/source/unified-test-format/tests/invalid/expectedTracingSpans-spanMalformedMissingTags.yml b/source/unified-test-format/tests/invalid/expectedTracingSpans-spanMalformedMissingTags.yml new file mode 100644 index 0000000000..c08647d27e --- /dev/null +++ b/source/unified-test-format/tests/invalid/expectedTracingSpans-spanMalformedMissingTags.yml @@ -0,0 +1,15 @@ +description: "expectedTracingSpans-spanMalformedMissingTags" + +schemaVersion: "1.26" + +createEntities: + - client: + id: &client0 "client0" + +tests: + - description: "missing required span tags" + operations: [] + expectTracingSpans: + client: client0 + spans: + - name: "foo" diff --git a/source/unified-test-format/tests/invalid/expectedTracingSpans-spanMalformedNestedMustBeArray.json b/source/unified-test-format/tests/invalid/expectedTracingSpans-spanMalformedNestedMustBeArray.json new file mode 100644 index 0000000000..7d2208af9d --- /dev/null +++ b/source/unified-test-format/tests/invalid/expectedTracingSpans-spanMalformedNestedMustBeArray.json @@ -0,0 +1,27 @@ +{ + "description": "expectedTracingSpans-spanMalformedNestedMustBeArray", + "schemaVersion": "1.26", + "createEntities": [ + { + "client": { + "id": "client0" + } + } + ], + "tests": [ + { + "description": "nested spans must be an array", + "operations": [], + "expectTracingSpans": { + "client": "client0", + "spans": [ + { + "name": "foo", + "tags": {}, + "nested": {} + } + ] + } + } + ] +} diff --git a/source/unified-test-format/tests/invalid/expectedTracingSpans-spanMalformedNestedMustBeArray.yml b/source/unified-test-format/tests/invalid/expectedTracingSpans-spanMalformedNestedMustBeArray.yml new file mode 100644 index 0000000000..d3dc8dd013 --- /dev/null +++ b/source/unified-test-format/tests/invalid/expectedTracingSpans-spanMalformedNestedMustBeArray.yml @@ -0,0 +1,18 @@ +description: "expectedTracingSpans-spanMalformedNestedMustBeArray" + +schemaVersion: "1.26" + +createEntities: + - client: + id: &client0 "client0" + +tests: + - description: "nested spans must be an array" + operations: [] + expectTracingSpans: + client: client0 + spans: + - name: "foo" + tags: {} + nested: {} + diff --git a/source/unified-test-format/tests/invalid/expectedTracingSpans-spanMalformedTagsMustBeObject.json b/source/unified-test-format/tests/invalid/expectedTracingSpans-spanMalformedTagsMustBeObject.json new file mode 100644 index 0000000000..acd3962cde --- /dev/null +++ b/source/unified-test-format/tests/invalid/expectedTracingSpans-spanMalformedTagsMustBeObject.json @@ -0,0 +1,27 @@ +{ + "description": "expectedTracingSpans-spanMalformedNestedMustBeObject", + "schemaVersion": "1.26", + "createEntities": [ + { + "client": { + "id": "client0" + } + } + ], + "tests": [ + { + "description": "span tags must be an object", + "operations": [], + "expectTracingSpans": { + "client": "client0", + "spans": [ + { + "name": "foo", + "tags": [], + "nested": [] + } + ] + } + } + ] +} diff --git a/source/unified-test-format/tests/invalid/expectedTracingSpans-spanMalformedTagsMustBeObject.yml b/source/unified-test-format/tests/invalid/expectedTracingSpans-spanMalformedTagsMustBeObject.yml new file mode 100644 index 0000000000..87941d5929 --- /dev/null +++ b/source/unified-test-format/tests/invalid/expectedTracingSpans-spanMalformedTagsMustBeObject.yml @@ -0,0 +1,18 @@ +description: "expectedTracingSpans-spanMalformedNestedMustBeObject" + +schemaVersion: "1.26" + +createEntities: + - client: + id: &client0 "client0" + +tests: + - description: "span tags must be an object" + operations: [] + expectTracingSpans: + client: client0 + spans: + - name: "foo" + tags: [] + nested: [] + From 3a578ee3189b44db923671fca6e7c40930659914 Mon Sep 17 00:00:00 2001 From: nhachicha <1793238+nhachicha@users.noreply.github.com> Date: Fri, 8 Aug 2025 16:05:59 +0000 Subject: [PATCH 05/62] Update generated files --- source/tracing/tests/operation/find.json | 156 ++++++++++-------- .../tests/transaction/transaction.json | 2 +- ...eTracingMessages-additionalProperties.json | 20 +++ ...racingMessages-additionalPropertyType.json | 2 +- ...ty-client-observeTracingMessages-type.json | 4 +- 5 files changed, 107 insertions(+), 77 deletions(-) create mode 100644 source/unified-test-format/tests/invalid/entity-client-observeTracingMessages-additionalProperties.json diff --git a/source/tracing/tests/operation/find.json b/source/tracing/tests/operation/find.json index a947f9acb7..7c2936ee36 100644 --- a/source/tracing/tests/operation/find.json +++ b/source/tracing/tests/operation/find.json @@ -1,122 +1,132 @@ { - "description" : "operation find", - "schemaVersion" : "1.26", - "createEntities" : [ + "description": "operation find", + "schemaVersion": "1.9", + "createEntities": [ { - "client" : { - "id" : "client0", - "useMultipleMongoses" : false, - "observeTracingMessages" : { - "enableCommandPayload" : true + "client": { + "id": "client0", + "useMultipleMongoses": false, + "observeTracingMessages": { + "enableCommandPayload": true } } }, { - "database" : { - "id" : "database0", - "client" : "client0", - "databaseName" : "operation-find" + "database": { + "id": "database0", + "client": "client0", + "databaseName": "operation-find" } }, { - "collection" : { - "id" : "collection0", - "database" : "database0", - "collectionName" : "test" + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "test" } } ], - "initialData" : [ + "initialData": [ { - "collectionName" : "test", - "databaseName" : "operation-find", - "documents" : [] + "collectionName": "test", + "databaseName": "operation-find", + "documents": [] } ], - "tests" : [ + "tests": [ { - "description" : "find an element", - "operations" : [ + "description": "find an element", + "operations": [ { - "name" : "find", - "object" : "collection0", - "arguments" : { - "filter" : { - "x" : 1 + "name": "find", + "object": "collection0", + "arguments": { + "filter": { + "x": 1 } } } ], - "expectTracingMessages" : { - "client" : "client0", - "ignoreExtraSpans" : false, - "spans" : [ + "expectTracingMessages": { + "client": "client0", + "ignoreExtraSpans": false, + "spans": [ { - "name" : "find operation-find.test", - "tags" : { - "db.system" : "mongodb", + "name": "find operation-find.test", + "tags": { + "db.system": "mongodb", "db.namespace": "operation-find", "db.collection.name": "test", "db.operation.name": "find", "db.operation.summary": "find operation-find.test" }, - "nested" : [ + "nested": [ { - "name" : "command find", - "tags" : { - "db.system" : "mongodb", - "db.namespace" : "operation-find", - "db.collection.name" : "operation-find.$cmd", + "name": "command find", + "tags": { + "db.system": "mongodb", + "db.namespace": "operation-find", + "db.collection.name": "operation-find.$cmd", "db.command.name": "find", "network.transport": "tcp", - "db.mongodb.cursor_id": { "$$exists": false }, - "db.response.status_code": { "$$exists": false }, - "error.message": { "$$exists": false }, - "error.type": { "$$exists": false }, - "error.stacktrace": { "$$exists": false }, - "server.address" : { - "$$type" : "string" + "db.mongodb.cursor_id": { + "$$exists": false }, - "server.port" : { - "$$type" : [ + "db.response.status_code": { + "$$exists": false + }, + "error.message": { + "$$exists": false + }, + "error.type": { + "$$exists": false + }, + "error.stacktrace": { + "$$exists": false + }, + "server.address": { + "$$type": "string" + }, + "server.port": { + "$$type": [ "long", "string" ] }, - "server.type" : { - "$$type" : "string" + "server.type": { + "$$type": "string" }, - "db.query.summary" : "find", - "db.query.text" : { - "$$matchAsDocument" : { - "$$matchAsRoot" : { - "find" : "test", - "filter" : { - "x" : 1 + "db.query.summary": "find", + "db.query.text": { + "$$matchAsDocument": { + "$$matchAsRoot": { + "find": "test", + "filter": { + "x": 1 }, - "$db" : "operation-find" + "$db": "operation-find" } } }, - "db.mongodb.server_connection_id" : { - "$$type" : [ + "db.mongodb.server_connection_id": { + "$$type": [ "long", "string" ] }, - "db.mongodb.driver_connection_id" : { - "$$type" : [ + "db.mongodb.driver_connection_id": { + "$$type": [ "string" ] }, - "exception.message" : { - "$$exists" : false + "exception.message": { + "$$exists": false }, - "exception.type" : { - "$$exists" : false + "exception.type": { + "$$exists": false }, "exception.stacktrace": { - "$$exists" : false + "$$exists": false } } } @@ -124,11 +134,11 @@ } ] }, - "outcome" : [ + "outcome": [ { - "collectionName" : "test", - "databaseName" : "operation-find", - "documents" : [] + "collectionName": "test", + "databaseName": "operation-find", + "documents": [] } ] } diff --git a/source/tracing/tests/transaction/transaction.json b/source/tracing/tests/transaction/transaction.json index a73b6504a3..29ccbd7326 100644 --- a/source/tracing/tests/transaction/transaction.json +++ b/source/tracing/tests/transaction/transaction.json @@ -56,7 +56,7 @@ ], "tests": [ { - "description": "tracing around transaction", + "description": "observeTracingMessages around transaction", "operations": [ { "object": "session0", diff --git a/source/unified-test-format/tests/invalid/entity-client-observeTracingMessages-additionalProperties.json b/source/unified-test-format/tests/invalid/entity-client-observeTracingMessages-additionalProperties.json new file mode 100644 index 0000000000..aa8046d28e --- /dev/null +++ b/source/unified-test-format/tests/invalid/entity-client-observeTracingMessages-additionalProperties.json @@ -0,0 +1,20 @@ +{ + "description": "entity-client-observeTracingMessages-additionalProperties", + "schemaVersion": "1.26", + "createEntities": [ + { + "client": { + "id": "client0", + "observeTracingMessages": { + "foo": "bar" + } + } + } + ], + "tests": [ + { + "description": "observeTracingMessages must not have additional properties'", + "operations": [] + } + ] +} diff --git a/source/unified-test-format/tests/invalid/entity-client-observeTracingMessages-additionalPropertyType.json b/source/unified-test-format/tests/invalid/entity-client-observeTracingMessages-additionalPropertyType.json index 4292995a3c..0b3a65f587 100644 --- a/source/unified-test-format/tests/invalid/entity-client-observeTracingMessages-additionalPropertyType.json +++ b/source/unified-test-format/tests/invalid/entity-client-observeTracingMessages-additionalPropertyType.json @@ -1,6 +1,6 @@ { "description": "entity-client-observeTracingMessages-additionalPropertyType", - "schemaVersion": "1.25", + "schemaVersion": "1.26", "createEntities": [ { "client": { diff --git a/source/unified-test-format/tests/invalid/entity-client-observeTracingMessages-type.json b/source/unified-test-format/tests/invalid/entity-client-observeTracingMessages-type.json index 65952cdbe8..de3ef39ab1 100644 --- a/source/unified-test-format/tests/invalid/entity-client-observeTracingMessages-type.json +++ b/source/unified-test-format/tests/invalid/entity-client-observeTracingMessages-type.json @@ -1,5 +1,5 @@ { - "description": "entity-client-expectTracingMessages-type", + "description": "entity-client-observeTracingMessages-type", "schemaVersion": "1.26", "createEntities": [ { @@ -11,7 +11,7 @@ ], "tests": [ { - "description": "expectTracingMessages must be an object", + "description": "observeTracingMessages must be an object", "operations": [] } ] From dbb1a9cace16cf0ae1e73303849b1b10a7d81426 Mon Sep 17 00:00:00 2001 From: Nabil Hachicha Date: Fri, 8 Aug 2025 17:08:30 +0100 Subject: [PATCH 06/62] update schema to latest (1.26) --- source/unified-test-format/schema-latest.json | 54 +++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/source/unified-test-format/schema-latest.json b/source/unified-test-format/schema-latest.json index 3be461221e..2ee895419f 100644 --- a/source/unified-test-format/schema-latest.json +++ b/source/unified-test-format/schema-latest.json @@ -198,6 +198,15 @@ } } }, + "observeTracingMessages": { + "type": "object", + "additionalProperties": false, + "properties": { + "enableCommandPayload": { + "type": "boolean" + } + } + }, "serverApi": { "$ref": "#/definitions/serverApi" }, @@ -369,6 +378,28 @@ "connection" ] }, + "spanComponent": { + "type": "object", + "additionalProperties": false, + "required": [ + "name", + "tags" + ], + "properties": { + "name": { + "type": "string" + }, + "tags": { + "type": "object" + }, + "nested": { + "type": "array", + "items": { + "$ref": "#/definitions/spanComponent" + } + } + } + }, "logSeverityLevel": { "type": "string", "enum": [ @@ -1164,6 +1195,29 @@ "$ref": "#/definitions/expectedLogMessagesForClient" } }, + "expectTracingMessages": { + "additionalProperties" : false, + "type": "object", + "required": [ + "client", + "spans" + ], + "properties": { + "client": { + "type": "string" + }, + "ignoreExtraSpans": { + "type": "boolean" + }, + "spans": { + "type": "array", + "minItems": 1, + "items": { + "$ref": "#/definitions/spanComponent" + } + } + } + }, "outcome": { "type": "array", "minItems": 1, From 29e25a12728344c228563b940367ba6e26e4529f Mon Sep 17 00:00:00 2001 From: Nabil Hachicha Date: Fri, 8 Aug 2025 17:25:06 +0100 Subject: [PATCH 07/62] update tests --- source/tracing/tests/operation/find.json | 2 +- source/tracing/tests/operation/find.yml | 2 +- source/tracing/tests/transaction/transaction.json | 1 + source/tracing/tests/transaction/transaction.yml | 1 + 4 files changed, 4 insertions(+), 2 deletions(-) diff --git a/source/tracing/tests/operation/find.json b/source/tracing/tests/operation/find.json index 7c2936ee36..c6d932c9b8 100644 --- a/source/tracing/tests/operation/find.json +++ b/source/tracing/tests/operation/find.json @@ -1,6 +1,6 @@ { "description": "operation find", - "schemaVersion": "1.9", + "schemaVersion": "1.26", "createEntities": [ { "client": { diff --git a/source/tracing/tests/operation/find.yml b/source/tracing/tests/operation/find.yml index 5351cd5950..262403a496 100644 --- a/source/tracing/tests/operation/find.yml +++ b/source/tracing/tests/operation/find.yml @@ -1,5 +1,5 @@ description: operation find -schemaVersion: '1.9' +schemaVersion: '1.26' createEntities: - client: id: client0 diff --git a/source/tracing/tests/transaction/transaction.json b/source/tracing/tests/transaction/transaction.json index 29ccbd7326..76002922be 100644 --- a/source/tracing/tests/transaction/transaction.json +++ b/source/tracing/tests/transaction/transaction.json @@ -182,6 +182,7 @@ }, { "name": "find transaction-tests.test", + "tags": {}, "nested": [ { "name": "command find", diff --git a/source/tracing/tests/transaction/transaction.yml b/source/tracing/tests/transaction/transaction.yml index 03a183d73a..7ac899f61d 100644 --- a/source/tracing/tests/transaction/transaction.yml +++ b/source/tracing/tests/transaction/transaction.yml @@ -100,6 +100,7 @@ tests: txnNumber: 1 autocommit: false - name: find transaction-tests.test + tags: {} nested: - name: command find tags: From f801d783a2f375c0ca388f45049b495cb789f06b Mon Sep 17 00:00:00 2001 From: Dmitry Rybakov Date: Thu, 26 Jun 2025 10:40:38 +0200 Subject: [PATCH 08/62] DRIVERS-719 OpenTelementry specification --- source/index.md | 1 + source/open-telemetry/open-telemetry.md | 237 ++++++++++++++++++++++++ 2 files changed, 238 insertions(+) create mode 100644 source/open-telemetry/open-telemetry.md diff --git a/source/index.md b/source/index.md index fcf33d1933..29b2a51e86 100644 --- a/source/index.md +++ b/source/index.md @@ -36,6 +36,7 @@ - [MongoDB Handshake](mongodb-handshake/handshake.md) - [OCSP Support](ocsp-support/ocsp-support.md) - [OP_MSG](message/OP_MSG.md) +- [OpenTelemetry](open-telemetry/open-telemetry.md) - [Performance Benchmarking](benchmarking/benchmarking.md) - [Polling SRV Records for mongos Discovery](polling-srv-records-for-mongos-discovery/polling-srv-records-for-mongos-discovery.md) - [Read and Write Concern](read-write-concern/read-write-concern.md) diff --git a/source/open-telemetry/open-telemetry.md b/source/open-telemetry/open-telemetry.md new file mode 100644 index 0000000000..8070a6ab16 --- /dev/null +++ b/source/open-telemetry/open-telemetry.md @@ -0,0 +1,237 @@ +# OpenTelemetry + +- Title: OpenTelemetry +- Status: Accepted +- Minimum Server Version: N/A + +______________________________________________________________________ + +## Abstract + +This specification defines requirements for drivers' OpenTelemetry integration and behavior. Drivers will trace database +commands and driver operations with a pre-defined set of attributes when OpenTelemetry is enabled and configured in an +application. + +## META + +The keywords "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and +"OPTIONAL" in this document are to be interpreted as described in [RFC 2119](https://www.ietf.org/rfc/rfc2119.txt). + +## Specification + +### Terms + +**Host Application** + +An application that uses the MongoDB driver. + +**Span** + +A Span represents a single operation within a trace. Spans can be nested to form a trace tree. Each trace contains a +root span, which typically describes the entire operation and, optionally, one or more sub-spans for its sub-operations. + +Spans encapsulate: + +- The span name +- An immutable SpanContext that uniquely identifies the Span +- A parent span in the form of a Span, SpanContext, or null +- A SpanKind +- A start timestamp +- An end timestamp +- Attributes +- A list of Links to other Spans +- A list of timestamped Events +- A Status. + +**Tracer** + +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** + +OpenTelemetry offers two components for implementing instrumentation – API and SDK. The OpenTelemetry API provides all +the necessary types and method signatures. If there is no OpenTelemetry SDK available at runtime, API methods are no-op. +OpenTelemetry SDK is an actual implementation of the API. If the SDK is available, API methods do work. + +### Implementation Requirements + +#### External Dependencies + +Drivers MAY add a dependency to the corresponding OpenTelemetry API. This is the recommended way for implementing +OpenTelemetry in libraries. Alternatively, drivers can implement OpenTelemetry support using any suitable tools within +the driver ecosystem. Drivers MUST NOT add a dependency to OpenTelemetry SDK. + +#### Enabling and Disabling OpenTelemetry + +OpenTelemetry SHOULD be disabled by default. + +Drivers SHOULD support configuring OpenTelemetry on multiple levels. + +- **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. +- **Driver Level**: Drivers SHOULD provide a global setting that enables or disables OpenTelemetry for all `MongoClient` + instances (excluding those that explicitly override the setting). This configuration can be implemented with an + environment variable `OTEL_#{LANG}_INSTRUMENTATION_MONGODB_ENABLED`. Drivers MAY provide other means to globally + disable OpenTelemetry that are more suitable for their language ecosystem. This option MUST override settings on the + higher level. +- **Host Application Level**: If the host application enables OpenTelemetry for all available instrumentations (e.g., + Ruby), and a driver can detect this, OpenTelemetry SHOULD be enabled in the driver. + +Drivers MUST NOT try to detect whether the OpenTelemetry SDK library is available, and enable tracing based on this. + +#### Tracer Attributes + +If a driver creates a Tracer using OpenTelemetry API, drivers MUST use the following attributes: + +- `name`: A string that identifies the driver. It can be the name of a driver's component (e.g., "mongo", "PyMongo") or + a package name (e.g., "com.mongo.Driver"). Drivers SHOULD select a name that is idiomatic for their language and + ecosystem. Drivers SHOULD follow the Instrumentation Scope guidance. +- `version`: The version of the driver. + +#### Instrumenting Driver Operations + +When a user calls the driver's public API, the driver MUST create a span for every driver operation. Drivers MUST start +the span as soon as possible so that the span’s duration reflects all activities made by the driver, such as server +selection and serialization/deserialization. + +##### `withTransaction` + +The `withTransaction` operation is a special case because it may include other operations that are executed "in scope" +of `withTransaction`. In this case, spans for operations that are executed inside the callbacks SHOULD be nested into +the `withTransaction` span. + +##### Span Name + +The span name SHOULD be: + +- `driver_operation_name db.collection_name` if the command is executed on a collection (e.g., + `findOneAndDelete warehouse.users`). +- `db.driver_operation_name` if there is no specific collection for the command (e.g., `warehouse.runCommand`). + +##### Span Kind + +Span kind MUST be "client". + +##### Span Attributes + +Spans SHOULD have the following attributes: + +| Attribute | Type | Description | Requirement Level | +| :--------------------- | :------- | :------------------------------------------------------------------------- | :-------------------- | +| `db.system` | `string` | MUST be 'mongodb' | Required | +| `db.namespace` | `string` | The database name | Required if available | +| `db.collection.name` | `string` | The collection being accessed within the database stated in `db.namespace` | Required if available | +| `db.operation.name` | `string` | The name of the driver operation being executed | Required | +| `db.operation.summary` | `string` | Equivalent to span name | Required | +| `db.mongodb.cursor_id` | `int64` | If a cursor is created or used in the operation | Required if available | + +Not all attributes are available at the moment of span creation. Drivers need to add attributes at later stages, which +requires an operation span to be available throughout the complete operation lifecycle. + +##### 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 +available: + +- `exception.message` +- `exception.type` +- `exception.stacktrace` + +#### Instrumenting Server Commands + +Drivers MUST create a span for every server command sent to the server as a result of a public API call, except for +sensitive commands as listed in the command logging and monitoring specification. + +Spans for commands MUST be nested to the span for the corresponding driver operation span. If the command is being +retried, the driver MUST create a separate span for each retry. + +##### Span Name + +The span name SHOULD be: + +- `server_command db.collection_name` if the command is executed on a collection (e.g., + `findAndModify warehouse.users`). +- `db.server_command` if there is no specific collection for the command. + +##### Span Kind + +Span kind MUST be "client". + +##### Span Attributes + +Spans SHOULD have the following attributes: + +| Attribute | Type | Description | Requirement Level | +| :-------------------------------- | :------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :--------------------------- | +| `db.system` | `string` | MUST be 'mongodb' | Required | +| `db.namespace` | `string` | The database name | Required if available | +| `db.collection.name` | `string` | The collection being accessed within the database stated in `db.namespace` | Required if available | +| `db.command.name` | `string` | The name of the server command being executed | Required | +| `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 | +| `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 | +| `server.port` | `int64` | Server port number | Required | +| `server.address` | `string` | Name of the database host, or IP address if name is not known | Required | +| `network.transport` | `string` | MUST be 'tcp' or 'unix' depending on the protocol | Required | +| `db.query.summary` | `string` | Equivalent to span name | Required | +| `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.response.status_code and error.type + +These attributes should be added only if the command was not successful. The content of `error.type` is language +specific; a driver decides what best describes the error. + +##### db.query.text + +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 + +Drivers MUST NOT add this attribute by default. Drivers MUST provide a toggle to enable this attribute. This +configuration can be implemented with an environment variable +`OTEL_#{LANG}_INSTRUMENTATION_MONGODB_QUERY_TEXT_MAX_LENGTH` set to a positive integer value. The attribute will be +added and truncated to the provided value (similar to the Logging specification). + +##### db.mongodb.cursor_id + +If the command returns a cursor, or uses a cursor, the `cursor_id` attribute SHOULD be added. + +##### Exception Handling + +Exceptions SHOULD be added to the parent span of the command span, which is the driver operation span. + +## Motivation for Change + +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. + +Although users can implement their own debug logging support via existing driver events (SDAM, APM, etc), this requires +code changes. It is often difficult to quickly implement and deploy such changes in production at the time they are +needed, and to remove the changes afterward. Additionally, there are useful scenarios to log that do not correspond to +existing events. Standardizing on debug log messages that drivers produce and how to enable/configure logging will +provide TSEs, CEs, and MongoDB users an easier way to get debugging information out of our drivers, facilitate support +of drivers for our internal teams, and improve our documentation around troubleshooting. + +## Test Plan + +TODO + +## Backwards Compatibility + +Introduction of OpenTelemetry in new driver versions should not significantly affect existing applications that do not +enable OpenTelemetry. However, since the no-op tracing operation may introduce some performance degradation (though it +should be negligible), customers should be informed of this feature and how to disable it completely. + +If a driver is used in an application that has OpenTelemetry enabled, customers will see traces from the driver in their +OpenTelemetry backends. This may be unexpected and MAY cause negative effects in some cases (e.g., the OpenTelemetry +backend MAY not have enough capacity to process new traces). Customers should be informed of this feature and how to +disable it completely. + +## Security Implication + +Drivers MUST take care to avoid exposing sensitive information (e.g. authentication credentials) in traces. From 9d66a8a0114255de0134bfaed3e4f3d730e952dd Mon Sep 17 00:00:00 2001 From: Dmitry Rybakov Date: Fri, 1 Aug 2025 17:08:07 +0200 Subject: [PATCH 09/62] Cursor operations --- source/open-telemetry/open-telemetry.md | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/source/open-telemetry/open-telemetry.md b/source/open-telemetry/open-telemetry.md index 8070a6ab16..1fb47480c8 100644 --- a/source/open-telemetry/open-telemetry.md +++ b/source/open-telemetry/open-telemetry.md @@ -70,7 +70,8 @@ Drivers SHOULD support configuring OpenTelemetry on multiple levels. - **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. + settings on higher levels. This configuration can be implemented with a `MongoClient` option, for example, + `tracing.enabled`. - **Driver Level**: Drivers SHOULD provide a global setting that enables or disables OpenTelemetry for all `MongoClient` instances (excluding those that explicitly override the setting). This configuration can be implemented with an environment variable `OTEL_#{LANG}_INSTRUMENTATION_MONGODB_ENABLED`. Drivers MAY provide other means to globally @@ -96,6 +97,14 @@ When a user calls the driver's public API, the driver MUST create a span for eve the span as soon as possible so that the span’s duration reflects all activities made by the driver, such as server selection and serialization/deserialization. +The span for the operation MUST be created within the current span of the host application, with the exceptions listed +below. + +##### Cursors + +If the driver operation returns a cursor, spans for all the subsequent operations on the cursor SHOULD be nested into +the operation span. This includes operations such as `getMore`, `next`, `close`. + ##### `withTransaction` The `withTransaction` operation is a special case because it may include other operations that are executed "in scope" @@ -146,7 +155,8 @@ Drivers MUST create a span for every server command sent to the server as a resu sensitive commands as listed in the command logging and monitoring specification. Spans for commands MUST be nested to the span for the corresponding driver operation span. If the command is being -retried, the driver MUST create a separate span for each retry. +retried, the driver MUST create a separate span for each retry; all the retries MUST be nested to the same operation +span. ##### Span Name @@ -188,21 +198,25 @@ specific; a driver decides what best describes the error. ##### db.query.text -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 +This attribute contains the full database command executed serialized to 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`. Drivers MUST NOT add this attribute by default. Drivers MUST provide a toggle to enable this attribute. This configuration can be implemented with an environment variable `OTEL_#{LANG}_INSTRUMENTATION_MONGODB_QUERY_TEXT_MAX_LENGTH` set to a positive integer value. The attribute will be added and truncated to the provided value (similar to the Logging specification). +On the `MongoClient` level this configuration can be implemented with a `MongoClient` option, for example, +`tracing.query_text_max_length`. + ##### db.mongodb.cursor_id If the command returns a cursor, or uses a cursor, the `cursor_id` attribute SHOULD be added. ##### Exception Handling -Exceptions SHOULD be added to the parent span of the command span, which is the driver operation span. +Exceptions MUST be added to the parent span of the command span, which is the driver operation span. ## Motivation for Change From 269221caa8cef2862bb4c3ec4f287b6e7961b2a9 Mon Sep 17 00:00:00 2001 From: Nabil Hachicha Date: Sat, 9 Aug 2025 16:54:25 +0100 Subject: [PATCH 10/62] update doc --- source/open-telemetry/open-telemetry.md | 1 + .../unified-test-format.md | 24 +++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/source/open-telemetry/open-telemetry.md b/source/open-telemetry/open-telemetry.md index 1fb47480c8..c762cc9a56 100644 --- a/source/open-telemetry/open-telemetry.md +++ b/source/open-telemetry/open-telemetry.md @@ -25,6 +25,7 @@ The keywords "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SH An application that uses the MongoDB driver. + **Span** A Span represents a single operation within a trace. Spans can be nested to form a trace tree. Each trace contains a diff --git a/source/unified-test-format/unified-test-format.md b/source/unified-test-format/unified-test-format.md index e5ae243cef..2bb28e337e 100644 --- a/source/unified-test-format/unified-test-format.md +++ b/source/unified-test-format/unified-test-format.md @@ -523,6 +523,11 @@ The structure of this object is as follows: Messages for unspecified components and/or with lower severity levels than those specified MUST be ignored by this client's log collector(s) and SHOULD NOT be included in [test.expectLogMessages](#test_expectLogMessages) for this client. + + - `observeTracingMessages`: Optional object that configures tracing behavior for the client. The structure of this object is as follows: + - `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. - `serverApi`: Optional [serverApi](#serverapi) object. @@ -764,6 +769,20 @@ The structure of this object is as follows: Tests SHOULD NOT specify multiple [expectedLogMessagesForClient](#expectedlogmessagesforclient) objects for a single client entity. +- `expectTracingMessages`: Optional object that defines expected + tracing [spans](../open-telemetry/open-telemetry.md#span) for a test. The structure of this object is as + follows: + - `client`: Required string. The ID of the client entity associated with these tracing spans. + - `ignoreExtraSpans`: Optional boolean. + - If `true`, additional unexpected spans are allowed. + - If `false` or omitted, the test runner MUST fail if any unexpected spans are detected. + - `spans`: Required array of span objects. Each span describes an expected tracing event. + + Span object properties: + - `name`: Required string. The name of the tracing span. + - `tags`: Required object. Key-value pairs describing span metadata. + - `nested`: Optional array of nested span objects, following the same structure. + - `outcome`: Optional array of one or more [collectionData](#collectiondata) objects. Data that is expected to exist in @@ -3422,6 +3441,11 @@ other specs *and* collating spec changes developed in parallel or during the sam ## Changelog +- 2025-08-09: **Schema version 1.26.** + + Add `observeTracingMessages` configuration for clients and `expectTracingMessages` for test expectations. + This allows capturing and validating detailed tracing information during test execution. + - 2025-07-28: **Schema version 1.25.** Add alternate form of `csfle`. Previously it was only a bool. Now it can also be an object containing From 452696d31587237ab98d7521f3b3516616d8d33a Mon Sep 17 00:00:00 2001 From: Nabil Hachicha Date: Sat, 9 Aug 2025 16:57:57 +0100 Subject: [PATCH 11/62] moved tests under open-telemtry directroy --- source/{tracing => open-telemetry}/tests/cursor/cursor.json | 0 source/{tracing => open-telemetry}/tests/cursor/cursor.yml | 0 source/{tracing => open-telemetry}/tests/operation/find.json | 0 source/{tracing => open-telemetry}/tests/operation/find.yml | 0 source/{tracing => open-telemetry}/tests/operation/insert.json | 0 source/{tracing => open-telemetry}/tests/operation/insert.yml | 0 .../tests/transaction/transaction.json | 0 .../{tracing => open-telemetry}/tests/transaction/transaction.yml | 0 8 files changed, 0 insertions(+), 0 deletions(-) rename source/{tracing => open-telemetry}/tests/cursor/cursor.json (100%) rename source/{tracing => open-telemetry}/tests/cursor/cursor.yml (100%) rename source/{tracing => open-telemetry}/tests/operation/find.json (100%) rename source/{tracing => open-telemetry}/tests/operation/find.yml (100%) rename source/{tracing => open-telemetry}/tests/operation/insert.json (100%) rename source/{tracing => open-telemetry}/tests/operation/insert.yml (100%) rename source/{tracing => open-telemetry}/tests/transaction/transaction.json (100%) rename source/{tracing => open-telemetry}/tests/transaction/transaction.yml (100%) diff --git a/source/tracing/tests/cursor/cursor.json b/source/open-telemetry/tests/cursor/cursor.json similarity index 100% rename from source/tracing/tests/cursor/cursor.json rename to source/open-telemetry/tests/cursor/cursor.json diff --git a/source/tracing/tests/cursor/cursor.yml b/source/open-telemetry/tests/cursor/cursor.yml similarity index 100% rename from source/tracing/tests/cursor/cursor.yml rename to source/open-telemetry/tests/cursor/cursor.yml diff --git a/source/tracing/tests/operation/find.json b/source/open-telemetry/tests/operation/find.json similarity index 100% rename from source/tracing/tests/operation/find.json rename to source/open-telemetry/tests/operation/find.json diff --git a/source/tracing/tests/operation/find.yml b/source/open-telemetry/tests/operation/find.yml similarity index 100% rename from source/tracing/tests/operation/find.yml rename to source/open-telemetry/tests/operation/find.yml diff --git a/source/tracing/tests/operation/insert.json b/source/open-telemetry/tests/operation/insert.json similarity index 100% rename from source/tracing/tests/operation/insert.json rename to source/open-telemetry/tests/operation/insert.json diff --git a/source/tracing/tests/operation/insert.yml b/source/open-telemetry/tests/operation/insert.yml similarity index 100% rename from source/tracing/tests/operation/insert.yml rename to source/open-telemetry/tests/operation/insert.yml diff --git a/source/tracing/tests/transaction/transaction.json b/source/open-telemetry/tests/transaction/transaction.json similarity index 100% rename from source/tracing/tests/transaction/transaction.json rename to source/open-telemetry/tests/transaction/transaction.json diff --git a/source/tracing/tests/transaction/transaction.yml b/source/open-telemetry/tests/transaction/transaction.yml similarity index 100% rename from source/tracing/tests/transaction/transaction.yml rename to source/open-telemetry/tests/transaction/transaction.yml From 9f05c59fac17a9264b985ebdc9195e82bbdbd54d Mon Sep 17 00:00:00 2001 From: Nabil Hachicha Date: Sat, 9 Aug 2025 17:22:52 +0100 Subject: [PATCH 12/62] Fixing formatting --- source/open-telemetry/open-telemetry.md | 5 ++-- .../unified-test-format.md | 28 +++++++++++++------ 2 files changed, 22 insertions(+), 11 deletions(-) diff --git a/source/open-telemetry/open-telemetry.md b/source/open-telemetry/open-telemetry.md index c762cc9a56..0f29c9c616 100644 --- a/source/open-telemetry/open-telemetry.md +++ b/source/open-telemetry/open-telemetry.md @@ -25,8 +25,7 @@ The keywords "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SH An application that uses the MongoDB driver. - -**Span** +#### Span A Span represents a single operation within a trace. Spans can be nested to form a trace tree. Each trace contains a root span, which typically describes the entire operation and, optionally, one or more sub-spans for its sub-operations. @@ -44,7 +43,7 @@ Spans encapsulate: - A list of timestamped Events - A Status. -**Tracer** +#### Tracer 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. diff --git a/source/unified-test-format/unified-test-format.md b/source/unified-test-format/unified-test-format.md index 2bb28e337e..dd79a81b69 100644 --- a/source/unified-test-format/unified-test-format.md +++ b/source/unified-test-format/unified-test-format.md @@ -523,11 +523,14 @@ The structure of this object is as follows: Messages for unspecified components and/or with lower severity levels than those specified MUST be ignored by this client's log collector(s) and SHOULD NOT be included in [test.expectLogMessages](#test_expectLogMessages) for this client. - - - `observeTracingMessages`: Optional object that configures tracing behavior for the client. The structure of this object is as follows: - - `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. + + - `observeTracingMessages`: Optional object that configures tracing behavior for the client. The structure of this + object is as follows: + + - `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. - `serverApi`: Optional [serverApi](#serverapi) object. @@ -769,16 +772,20 @@ The structure of this object is as follows: Tests SHOULD NOT specify multiple [expectedLogMessagesForClient](#expectedlogmessagesforclient) objects for a single client entity. -- `expectTracingMessages`: Optional object that defines expected - tracing [spans](../open-telemetry/open-telemetry.md#span) for a test. The structure of this object is as - follows: +- `expectTracingMessages`: Optional object that defines expected tracing + [spans](../open-telemetry/open-telemetry.md#span) for a test. The structure of this object is as follows: + - `client`: Required string. The ID of the client entity associated with these tracing spans. + - `ignoreExtraSpans`: Optional boolean. + - If `true`, additional unexpected spans are allowed. - If `false` or omitted, the test runner MUST fail if any unexpected spans are detected. + - `spans`: Required array of span objects. Each span describes an expected tracing event. Span object properties: + - `name`: Required string. The name of the tracing span. - `tags`: Required object. Key-value pairs describing span metadata. - `nested`: Optional array of nested span objects, following the same structure. @@ -3441,6 +3448,11 @@ other specs *and* collating spec changes developed in parallel or during the sam ## Changelog +- 2025-08-09: **Schema version 1.26.** + + Add `observeTracingMessages` configuration for clients and `expectTracingMessages` for test expectations. This allows + capturing and validating detailed tracing information during test execution. + - 2025-08-09: **Schema version 1.26.** Add `observeTracingMessages` configuration for clients and `expectTracingMessages` for test expectations. From 05237517149d280e95a9f487df7ae17df603097d Mon Sep 17 00:00:00 2001 From: Nabil Hachicha Date: Sat, 9 Aug 2025 18:14:57 +0100 Subject: [PATCH 13/62] update formatting using pre-commit mdformat --- .../unified-test-format.md | 64 +++++++++---------- 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/source/unified-test-format/unified-test-format.md b/source/unified-test-format/unified-test-format.md index dd79a81b69..eb7b828f34 100644 --- a/source/unified-test-format/unified-test-format.md +++ b/source/unified-test-format/unified-test-format.md @@ -524,31 +524,31 @@ The structure of this object is as follows: client's log collector(s) and SHOULD NOT be included in [test.expectLogMessages](#test_expectLogMessages) for this client. - - `observeTracingMessages`: Optional object that configures tracing behavior for the client. The structure of this - object is as follows: - - - `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. - - `serverApi`: Optional [serverApi](#serverapi) object. - - - - - `autoEncryptOpts`: Optional object corresponding to - [AutoEncryptionOpts](../client-side-encryption/client-side-encryption.md#mongoclient-changes) with the following - fields: - - `kmsProviders`: The same as in [`clientEncryption`](#entity_clientEncryption). - - `keyVaultNamespace`: The same as in [`clientEncryption`](#entity_clientEncryption). - - `bypassAutoEncryption`: Optional, a boolean to indicate whether or not auto encryption should be bypassed. - - `schemaMap`: Optional object. Maps namespaces to CSFLE schemas. - - `encryptedFieldsMap`: Optional object. Maps namespaces to QE schemas. - - `extraOptions`: Optional object. Configuration options for the encryption library. - - If `extraOptions` is not present or omits `cryptSharedLibPath`, test runners MAY set `cryptSharedLibPath` to the - path of [crypt_shared](../client-side-encryption/client-side-encryption.md#crypt_shared) being tested. This - can avoid test errors loading crypt_shared from different paths. - - `bypassQueryAnalysis`: Optional. Disables analysis of outgoing commands. Defaults to `false`. - - `keyExpirationMS`: The same as in [`clientEncryption`](#entity_clientEncryption). + - `observeTracingMessages`: Optional object that configures tracing behavior for the client. The structure of this + object is as follows: + + - `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. + - `serverApi`: Optional [serverApi](#serverapi) object. + + + + - `autoEncryptOpts`: Optional object corresponding to + [AutoEncryptionOpts](../client-side-encryption/client-side-encryption.md#mongoclient-changes) with the following + fields: + - `kmsProviders`: The same as in [`clientEncryption`](#entity_clientEncryption). + - `keyVaultNamespace`: The same as in [`clientEncryption`](#entity_clientEncryption). + - `bypassAutoEncryption`: Optional, a boolean to indicate whether or not auto encryption should be bypassed. + - `schemaMap`: Optional object. Maps namespaces to CSFLE schemas. + - `encryptedFieldsMap`: Optional object. Maps namespaces to QE schemas. + - `extraOptions`: Optional object. Configuration options for the encryption library. + - If `extraOptions` is not present or omits `cryptSharedLibPath`, test runners MAY set `cryptSharedLibPath` to + the path of [crypt_shared](../client-side-encryption/client-side-encryption.md#crypt_shared) being tested. + This can avoid test errors loading crypt_shared from different paths. + - `bypassQueryAnalysis`: Optional. Disables analysis of outgoing commands. Defaults to `false`. + - `keyExpirationMS`: The same as in [`clientEncryption`](#entity_clientEncryption). @@ -773,7 +773,7 @@ The structure of this object is as follows: client entity. - `expectTracingMessages`: Optional object that defines expected tracing - [spans](../open-telemetry/open-telemetry.md#span) for a test. The structure of this object is as follows: + [spans](../open-telemetry/open-telemetry.md#span) for a test. The structure of this object is as follows: - `client`: Required string. The ID of the client entity associated with these tracing spans. @@ -784,12 +784,12 @@ The structure of this object is as follows: - `spans`: Required array of span objects. Each span describes an expected tracing event. - Span object properties: + Span object properties: - `name`: Required string. The name of the tracing span. - `tags`: Required object. Key-value pairs describing span metadata. - `nested`: Optional array of nested span objects, following the same structure. - + - `outcome`: Optional array of one or more [collectionData](#collectiondata) objects. Data that is expected to exist in @@ -3450,13 +3450,13 @@ other specs *and* collating spec changes developed in parallel or during the sam - 2025-08-09: **Schema version 1.26.** - Add `observeTracingMessages` configuration for clients and `expectTracingMessages` for test expectations. This allows - capturing and validating detailed tracing information during test execution. + Add `observeTracingMessages` configuration for clients and `expectTracingMessages` for test expectations. This allows + capturing and validating detailed tracing information during test execution. - 2025-08-09: **Schema version 1.26.** - Add `observeTracingMessages` configuration for clients and `expectTracingMessages` for test expectations. - This allows capturing and validating detailed tracing information during test execution. + Add `observeTracingMessages` configuration for clients and `expectTracingMessages` for test expectations. This allows + capturing and validating detailed tracing information during test execution. - 2025-07-28: **Schema version 1.25.** From 8466c1b9df5b2c4b293bb9223b55aa16d34e9e0f Mon Sep 17 00:00:00 2001 From: Nabil Hachicha Date: Sat, 9 Aug 2025 19:14:01 +0100 Subject: [PATCH 14/62] Adding Test README --- source/open-telemetry/tests/README.md | 34 ++++++++++++++ .../unified-test-format.md | 44 +++++++++---------- 2 files changed, 55 insertions(+), 23 deletions(-) create mode 100644 source/open-telemetry/tests/README.md diff --git a/source/open-telemetry/tests/README.md b/source/open-telemetry/tests/README.md new file mode 100644 index 0000000000..c3d14f6c93 --- /dev/null +++ b/source/open-telemetry/tests/README.md @@ -0,0 +1,34 @@ +# OpenTelemetry Tests + +______________________________________________________________________ + +## Testing + +### Automated Tests + +The YAML and JSON files in this directory are platform-independent tests meant to exercise a driver's implementation of +the OpenTelemetry specification. These tests utilize the +[Unified Test Format](../../unified-test-format/unified-test-format.md). + +For each test, create a MongoClient, configure it to enable tracing. + +```yaml +createEntities: + - client: + id: client0 + observeTracingMessages: + enableCommandPayload: true +``` + +These tests require the ability to collect tracing [spans](../open-telemetry.md#span) data in a structured form as +described in the +[Unified Test Format specification.expectTracingMessages](../../unified-test-format/unified-test-format.md#expectTracingMessages). +For example the Java driver uses [Micrometer](https://jira.mongodb.org/browse/JAVA-5732) to collect tracing spans. + +```yaml +expectTracingMessages: + client: client0 + ignoreExtraSpans: false + spans: + ... +``` diff --git a/source/unified-test-format/unified-test-format.md b/source/unified-test-format/unified-test-format.md index eb7b828f34..281f6718ef 100644 --- a/source/unified-test-format/unified-test-format.md +++ b/source/unified-test-format/unified-test-format.md @@ -531,24 +531,25 @@ The structure of this object is as follows: 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. - - `serverApi`: Optional [serverApi](#serverapi) object. - - - - - `autoEncryptOpts`: Optional object corresponding to - [AutoEncryptionOpts](../client-side-encryption/client-side-encryption.md#mongoclient-changes) with the following - fields: - - `kmsProviders`: The same as in [`clientEncryption`](#entity_clientEncryption). - - `keyVaultNamespace`: The same as in [`clientEncryption`](#entity_clientEncryption). - - `bypassAutoEncryption`: Optional, a boolean to indicate whether or not auto encryption should be bypassed. - - `schemaMap`: Optional object. Maps namespaces to CSFLE schemas. - - `encryptedFieldsMap`: Optional object. Maps namespaces to QE schemas. - - `extraOptions`: Optional object. Configuration options for the encryption library. - - If `extraOptions` is not present or omits `cryptSharedLibPath`, test runners MAY set `cryptSharedLibPath` to - the path of [crypt_shared](../client-side-encryption/client-side-encryption.md#crypt_shared) being tested. - This can avoid test errors loading crypt_shared from different paths. - - `bypassQueryAnalysis`: Optional. Disables analysis of outgoing commands. Defaults to `false`. - - `keyExpirationMS`: The same as in [`clientEncryption`](#entity_clientEncryption). + + - `serverApi`: Optional [serverApi](#serverapi) object. + + + + - `autoEncryptOpts`: Optional object corresponding to + [AutoEncryptionOpts](../client-side-encryption/client-side-encryption.md#mongoclient-changes) with the following + fields: + - `kmsProviders`: The same as in [`clientEncryption`](#entity_clientEncryption). + - `keyVaultNamespace`: The same as in [`clientEncryption`](#entity_clientEncryption). + - `bypassAutoEncryption`: Optional, a boolean to indicate whether or not auto encryption should be bypassed. + - `schemaMap`: Optional object. Maps namespaces to CSFLE schemas. + - `encryptedFieldsMap`: Optional object. Maps namespaces to QE schemas. + - `extraOptions`: Optional object. Configuration options for the encryption library. + - If `extraOptions` is not present or omits `cryptSharedLibPath`, test runners MAY set `cryptSharedLibPath` to the + path of [crypt_shared](../client-side-encryption/client-side-encryption.md#crypt_shared) being tested. This + can avoid test errors loading crypt_shared from different paths. + - `bypassQueryAnalysis`: Optional. Disables analysis of outgoing commands. Defaults to `false`. + - `keyExpirationMS`: The same as in [`clientEncryption`](#entity_clientEncryption). @@ -772,6 +773,8 @@ The structure of this object is as follows: Tests SHOULD NOT specify multiple [expectedLogMessagesForClient](#expectedlogmessagesforclient) objects for a single client entity. + + - `expectTracingMessages`: Optional object that defines expected tracing [spans](../open-telemetry/open-telemetry.md#span) for a test. The structure of this object is as follows: @@ -3448,11 +3451,6 @@ other specs *and* collating spec changes developed in parallel or during the sam ## Changelog -- 2025-08-09: **Schema version 1.26.** - - Add `observeTracingMessages` configuration for clients and `expectTracingMessages` for test expectations. This allows - capturing and validating detailed tracing information during test execution. - - 2025-08-09: **Schema version 1.26.** Add `observeTracingMessages` configuration for clients and `expectTracingMessages` for test expectations. This allows From 18ad723c10c8c578908fa855d826742c864f5546 Mon Sep 17 00:00:00 2001 From: Nabil Hachicha Date: Thu, 14 Aug 2025 00:33:34 +0100 Subject: [PATCH 15/62] Adding retries test, fixing duplicate exception tag --- .../open-telemetry/tests/cursor/cursor.json | 45 +--- source/open-telemetry/tests/cursor/cursor.yml | 27 +-- .../open-telemetry/tests/operation/find.json | 15 +- .../open-telemetry/tests/operation/find.yml | 9 +- .../tests/operation/find_retries.json | 219 ++++++++++++++++++ .../tests/operation/find_retries.yml | 113 +++++++++ 6 files changed, 356 insertions(+), 72 deletions(-) create mode 100644 source/open-telemetry/tests/operation/find_retries.json create mode 100644 source/open-telemetry/tests/operation/find_retries.yml diff --git a/source/open-telemetry/tests/cursor/cursor.json b/source/open-telemetry/tests/cursor/cursor.json index d3719d0189..cac8e1a194 100644 --- a/source/open-telemetry/tests/cursor/cursor.json +++ b/source/open-telemetry/tests/cursor/cursor.json @@ -114,13 +114,13 @@ "db.response.status_code": { "$$exists": false }, - "error.message": { + "exception.message": { "$$exists": false }, - "error.type": { + "exception.type": { "$$exists": false }, - "error.stacktrace": { + "exception.stacktrace": { "$$exists": false }, "server.address": { @@ -160,15 +160,6 @@ "$$type": [ "string" ] - }, - "exception.message": { - "$$exists": false - }, - "exception.type": { - "$$exists": false - }, - "exception.stacktrace": { - "$$exists": false } } }, @@ -186,13 +177,13 @@ "db.response.status_code": { "$$exists": false }, - "error.message": { + "exception.message": { "$$exists": false }, - "error.type": { + "exception.type": { "$$exists": false }, - "error.stacktrace": { + "exception.stacktrace": { "$$exists": false }, "server.address": { @@ -230,15 +221,6 @@ "$$type": [ "string" ] - }, - "exception.message": { - "$$exists": false - }, - "exception.type": { - "$$exists": false - }, - "exception.stacktrace": { - "$$exists": false } } }, @@ -256,13 +238,13 @@ "db.response.status_code": { "$$exists": false }, - "error.message": { + "exception.message": { "$$exists": false }, - "error.type": { + "exception.type": { "$$exists": false }, - "error.stacktrace": { + "exception.stacktrace": { "$$exists": false }, "server.address": { @@ -300,15 +282,6 @@ "$$type": [ "string" ] - }, - "exception.message": { - "$$exists": false - }, - "exception.type": { - "$$exists": false - }, - "exception.stacktrace": { - "$$exists": false } } } diff --git a/source/open-telemetry/tests/cursor/cursor.yml b/source/open-telemetry/tests/cursor/cursor.yml index 2544c605e5..e14a367b1e 100644 --- a/source/open-telemetry/tests/cursor/cursor.yml +++ b/source/open-telemetry/tests/cursor/cursor.yml @@ -59,9 +59,9 @@ tests: network.transport: tcp db.mongodb.cursor_id: { $$exists: false } db.response.status_code: { $$exists: false } - error.message: { $$exists: false } - error.type: { $$exists: false } - error.stacktrace: { $$exists: false } + exception.message: { $$exists: false } + exception.type: { $$exists: false } + exception.stacktrace: { $$exists: false } server.address: { $$type: string } server.port: { $$type: [ 'long', 'string' ] } server.type: { $$type: string } @@ -77,9 +77,6 @@ tests: $$type: [ 'long', 'string' ] db.mongodb.driver_connection_id: $$type: [ 'string' ] - exception.message: { $$exists: false } - exception.type: { $$exists: false } - exception.stacktrace: { $$exists: false } - name: command getMore tags: @@ -90,9 +87,9 @@ tests: network.transport: tcp db.mongodb.cursor_id: { $$type: string } db.response.status_code: { $$exists: false } - error.message: { $$exists: false } - error.type: { $$exists: false } - error.stacktrace: { $$exists: false } + exception.message: { $$exists: false } + exception.type: { $$exists: false } + exception.stacktrace: { $$exists: false } server.address: { $$type: string } server.port: { $$type: [ 'long', 'string' ] } server.type: { $$type: string } @@ -108,9 +105,6 @@ tests: $$type: [ 'long', 'string' ] db.mongodb.driver_connection_id: $$type: [ 'string' ] - exception.message: { $$exists: false } - exception.type: { $$exists: false } - exception.stacktrace: { $$exists: false } - name: command getMore tags: db.system: mongodb @@ -120,9 +114,9 @@ tests: network.transport: tcp db.mongodb.cursor_id: { $$type: string } db.response.status_code: { $$exists: false } - error.message: { $$exists: false } - error.type: { $$exists: false } - error.stacktrace: { $$exists: false } + exception.message: { $$exists: false } + exception.type: { $$exists: false } + exception.stacktrace: { $$exists: false } server.address: { $$type: string } server.port: { $$type: [ 'long', 'string' ] } server.type: { $$type: string } @@ -138,7 +132,4 @@ tests: $$type: [ 'long', 'string' ] db.mongodb.driver_connection_id: $$type: [ 'string' ] - exception.message: { $$exists: false } - exception.type: { $$exists: false } - exception.stacktrace: { $$exists: false } diff --git a/source/open-telemetry/tests/operation/find.json b/source/open-telemetry/tests/operation/find.json index c6d932c9b8..f0d1f50629 100644 --- a/source/open-telemetry/tests/operation/find.json +++ b/source/open-telemetry/tests/operation/find.json @@ -75,13 +75,13 @@ "db.response.status_code": { "$$exists": false }, - "error.message": { + "exception.message": { "$$exists": false }, - "error.type": { + "exception.type": { "$$exists": false }, - "error.stacktrace": { + "exception.stacktrace": { "$$exists": false }, "server.address": { @@ -118,15 +118,6 @@ "$$type": [ "string" ] - }, - "exception.message": { - "$$exists": false - }, - "exception.type": { - "$$exists": false - }, - "exception.stacktrace": { - "$$exists": false } } } diff --git a/source/open-telemetry/tests/operation/find.yml b/source/open-telemetry/tests/operation/find.yml index 262403a496..9d986344d1 100644 --- a/source/open-telemetry/tests/operation/find.yml +++ b/source/open-telemetry/tests/operation/find.yml @@ -47,9 +47,9 @@ tests: network.transport: tcp db.mongodb.cursor_id: { $$exists: false } db.response.status_code: { $$exists: false } - error.message: { $$exists: false } - error.type: { $$exists: false } - error.stacktrace: { $$exists: false } + exception.message: { $$exists: false } + exception.type: { $$exists: false } + exception.stacktrace: { $$exists: false } server.address: { $$type: string } server.port: { $$type: ['long', 'string'] } server.type: { $$type: string } @@ -65,9 +65,6 @@ tests: $$type: ['long', 'string'] db.mongodb.driver_connection_id: $$type: ['string'] - exception.message: { $$exists: false } - exception.type: { $$exists: false } - exception.stacktrace: { $$exists: false } outcome: - collectionName: test databaseName: operation-find diff --git a/source/open-telemetry/tests/operation/find_retries.json b/source/open-telemetry/tests/operation/find_retries.json new file mode 100644 index 0000000000..081ee6bdd9 --- /dev/null +++ b/source/open-telemetry/tests/operation/find_retries.json @@ -0,0 +1,219 @@ +{ + "description": "operation find retrying failed command", + "schemaVersion": "1.26", + "createEntities": [ + { + "client": { + "id": "client0", + "useMultipleMongoses": false, + "observeTracingMessages": { + "enableCommandPayload": true + } + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "operation-find-retries" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "test" + } + } + ], + "initialData": [ + { + "collectionName": "test", + "databaseName": "operation-find-retries", + "documents": [] + } + ], + "tests": [ + { + "description": "find an element", + "operations": [ + { + "name": "failPoint", + "object": "testRunner", + "arguments": { + "client": "client0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "find" + ], + "errorCode": 89, + "errorLabels": [ + "RetryableWriteError" + ] + } + } + } + }, + { + "name": "find", + "object": "collection0", + "arguments": { + "filter": { + "x": 1 + } + } + } + ], + "expectTracingMessages": { + "client": "client0", + "ignoreExtraSpans": true, + "spans": [ + { + "name": "find operation-find-retries.test", + "tags": { + "db.system": "mongodb", + "db.namespace": "operation-find-retries", + "db.collection.name": "test", + "db.operation.name": "find", + "db.operation.summary": "find operation-find-retries.test" + }, + "nested": [ + { + "name": "command find", + "tags": { + "db.system": "mongodb", + "db.namespace": "operation-find-retries", + "db.collection.name": "operation-find-retries.$cmd", + "db.command.name": "find", + "network.transport": "tcp", + "db.mongodb.cursor_id": { + "$$exists": false + }, + "db.response.status_code": { + "$$exists": false + }, + "exception.message": { + "$$type": "string" + }, + "exception.type": { + "$$type": "string" + }, + "exception.stacktrace": { + "$$type": "string" + }, + "server.address": { + "$$type": "string" + }, + "server.port": { + "$$type": [ + "long", + "string" + ] + }, + "server.type": { + "$$type": "string" + }, + "db.query.summary": "find", + "db.query.text": { + "$$matchAsDocument": { + "$$matchAsRoot": { + "find": "test", + "filter": { + "x": 1 + }, + "$db": "operation-find-retries" + } + } + }, + "db.mongodb.server_connection_id": { + "$$type": [ + "long", + "string" + ] + }, + "db.mongodb.driver_connection_id": { + "$$type": [ + "string" + ] + } + } + }, + { + "name": "command find", + "tags": { + "db.system": "mongodb", + "db.namespace": "operation-find-retries", + "db.collection.name": "operation-find-retries.$cmd", + "db.command.name": "find", + "network.transport": "tcp", + "db.mongodb.cursor_id": { + "$$exists": false + }, + "db.response.status_code": { + "$$exists": false + }, + "exception.message": { + "$$exists": false + }, + "exception.type": { + "$$exists": false + }, + "exception.stacktrace": { + "$$exists": false + }, + "server.address": { + "$$type": "string" + }, + "server.port": { + "$$type": [ + "long", + "string" + ] + }, + "server.type": { + "$$type": "string" + }, + "db.query.summary": "find", + "db.query.text": { + "$$matchAsDocument": { + "$$matchAsRoot": { + "find": "test", + "filter": { + "x": 1 + }, + "$db": "operation-find-retries" + } + } + }, + "db.mongodb.server_connection_id": { + "$$type": [ + "long", + "string" + ] + }, + "db.mongodb.driver_connection_id": { + "$$type": [ + "string" + ] + } + } + } + ] + } + ] + }, + "outcome": [ + { + "collectionName": "test", + "databaseName": "operation-find-retries", + "documents": [] + } + ] + } + ] +} diff --git a/source/open-telemetry/tests/operation/find_retries.yml b/source/open-telemetry/tests/operation/find_retries.yml new file mode 100644 index 0000000000..8ac578233c --- /dev/null +++ b/source/open-telemetry/tests/operation/find_retries.yml @@ -0,0 +1,113 @@ +description: operation find retrying failed command +schemaVersion: '1.26' +createEntities: + - client: + id: client0 + useMultipleMongoses: false + observeTracingMessages: + enableCommandPayload: true + - database: + id: database0 + client: client0 + databaseName: operation-find-retries + - collection: + id: collection0 + database: database0 + collectionName: test +initialData: + - collectionName: test + databaseName: operation-find-retries + documents: [] +tests: + - description: find an element + operations: + - name: failPoint + object: testRunner + arguments: + client: client0 + failPoint: + configureFailPoint: failCommand + mode: + times: 1 + data: + failCommands: + - find + errorCode: 89 + errorLabels: + - RetryableWriteError + - name: find + object: collection0 + arguments: + filter: + x: 1 + expectTracingMessages: + client: client0 + ignoreExtraSpans: true + spans: + - name: find operation-find-retries.test + tags: + db.system: mongodb + db.namespace: operation-find-retries + db.collection.name: test + db.operation.name: find + db.operation.summary: find operation-find-retries.test + nested: + - name: command find + tags: + db.system: mongodb + db.namespace: operation-find-retries + db.collection.name: operation-find-retries.$cmd + db.command.name: find + network.transport: tcp + db.mongodb.cursor_id: { $$exists: false } + db.response.status_code: { $$exists: false } + exception.message: { $$type: string } + exception.type: { $$type: string } + exception.stacktrace: { $$type: string } + server.address: { $$type: string } + server.port: { $$type: ['long', 'string'] } + server.type: { $$type: string } + db.query.summary: find + db.query.text: + $$matchAsDocument: + $$matchAsRoot: + find: test + filter: + x: 1 + $db: operation-find-retries + db.mongodb.server_connection_id: + $$type: ['long', 'string'] + db.mongodb.driver_connection_id: + $$type: ['string'] + - name: command find + tags: + db.system: mongodb + db.namespace: operation-find-retries + db.collection.name: operation-find-retries.$cmd + db.command.name: find + network.transport: tcp + db.mongodb.cursor_id: { $$exists: false } + db.response.status_code: { $$exists: false } + exception.message: { $$exists: false } + exception.type: { $$exists: false } + exception.stacktrace: { $$exists: false } + server.address: { $$type: string } + server.port: { $$type: [ 'long', 'string' ] } + server.type: { $$type: string } + db.query.summary: find + db.query.text: + $$matchAsDocument: + $$matchAsRoot: + find: test + filter: + x: 1 + $db: operation-find-retries + db.mongodb.server_connection_id: + $$type: [ 'long', 'string' ] + db.mongodb.driver_connection_id: + $$type: [ 'string' ] + + outcome: + - collectionName: test + databaseName: operation-find-retries + documents: [] From 04b947a5b7742ee5ed5190dc2e802dd6e8708bbd Mon Sep 17 00:00:00 2001 From: Nabil Hachicha Date: Thu, 14 Aug 2025 17:48:43 +0100 Subject: [PATCH 16/62] Update source/open-telemetry/open-telemetry.md Co-authored-by: Jeremy Mikola --- source/open-telemetry/open-telemetry.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/open-telemetry/open-telemetry.md b/source/open-telemetry/open-telemetry.md index 0f29c9c616..e43b540802 100644 --- a/source/open-telemetry/open-telemetry.md +++ b/source/open-telemetry/open-telemetry.md @@ -51,7 +51,7 @@ responsible for configuration; this should be the responsibility of the TracerPr **OpenTelemetry API and SDK** OpenTelemetry offers two components for implementing instrumentation – API and SDK. The OpenTelemetry API provides all -the necessary types and method signatures. If there is no OpenTelemetry SDK available at runtime, API methods are no-op. +the necessary types and method signatures. If there is no OpenTelemetry SDK available at runtime, API methods are no-ops. OpenTelemetry SDK is an actual implementation of the API. If the SDK is available, API methods do work. ### Implementation Requirements From 88c7be0416ba8564f2ccc070351edb8f4068a867 Mon Sep 17 00:00:00 2001 From: Nabil Hachicha Date: Thu, 14 Aug 2025 17:48:59 +0100 Subject: [PATCH 17/62] Update source/open-telemetry/open-telemetry.md Co-authored-by: Jeremy Mikola --- source/open-telemetry/open-telemetry.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/open-telemetry/open-telemetry.md b/source/open-telemetry/open-telemetry.md index e43b540802..eb84242a79 100644 --- a/source/open-telemetry/open-telemetry.md +++ b/source/open-telemetry/open-telemetry.md @@ -39,7 +39,7 @@ Spans encapsulate: - A start timestamp - An end timestamp - Attributes -- A list of Links to other Spans +- A list of links to other Spans - A list of timestamped Events - A Status. From ced82ebda106b6599638d589452261f3d47a927d Mon Sep 17 00:00:00 2001 From: Nabil Hachicha Date: Fri, 15 Aug 2025 11:15:44 +0100 Subject: [PATCH 18/62] Update source/unified-test-format/tests/invalid/entity-client-observeTracingMessages-additionalProperties.yml Co-authored-by: Jeremy Mikola --- ...tity-client-observeTracingMessages-additionalProperties.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/source/unified-test-format/tests/invalid/entity-client-observeTracingMessages-additionalProperties.yml b/source/unified-test-format/tests/invalid/entity-client-observeTracingMessages-additionalProperties.yml index 85d426a3d5..3ec4cd1691 100644 --- a/source/unified-test-format/tests/invalid/entity-client-observeTracingMessages-additionalProperties.yml +++ b/source/unified-test-format/tests/invalid/entity-client-observeTracingMessages-additionalProperties.yml @@ -5,9 +5,8 @@ schemaVersion: "1.26" createEntities: - client: id: &client0 "client0" - observeTracingMessages: { + observeTracingMessages: foo: "bar" - } tests: - description: "observeTracingMessages must not have additional properties'" From f1804c3d9e90b5e412d9cce542fdbcb3d9eeb4ee Mon Sep 17 00:00:00 2001 From: Nabil Hachicha Date: Fri, 15 Aug 2025 11:23:22 +0100 Subject: [PATCH 19/62] Update source/unified-test-format/tests/invalid/expectedTracingSpans-spanMalformedTagsMustBeObject.yml Co-authored-by: Jeremy Mikola --- .../expectedTracingSpans-spanMalformedTagsMustBeObject.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/source/unified-test-format/tests/invalid/expectedTracingSpans-spanMalformedTagsMustBeObject.yml b/source/unified-test-format/tests/invalid/expectedTracingSpans-spanMalformedTagsMustBeObject.yml index d1e233c45f..1d8f2f8fab 100644 --- a/source/unified-test-format/tests/invalid/expectedTracingSpans-spanMalformedTagsMustBeObject.yml +++ b/source/unified-test-format/tests/invalid/expectedTracingSpans-spanMalformedTagsMustBeObject.yml @@ -14,5 +14,4 @@ tests: spans: - name: "foo" tags: [] - nested: [] From 03d4e3c1d4f94028ed55cfb671c4cd57449aa747 Mon Sep 17 00:00:00 2001 From: Nabil Hachicha Date: Fri, 15 Aug 2025 11:23:48 +0100 Subject: [PATCH 20/62] Update source/unified-test-format/tests/invalid/entity-client-observeTracingMessages-additionalPropertyType.yml Co-authored-by: Jeremy Mikola --- ...ty-client-observeTracingMessages-additionalPropertyType.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/source/unified-test-format/tests/invalid/entity-client-observeTracingMessages-additionalPropertyType.yml b/source/unified-test-format/tests/invalid/entity-client-observeTracingMessages-additionalPropertyType.yml index cda0adf747..8327458aee 100644 --- a/source/unified-test-format/tests/invalid/entity-client-observeTracingMessages-additionalPropertyType.yml +++ b/source/unified-test-format/tests/invalid/entity-client-observeTracingMessages-additionalPropertyType.yml @@ -5,9 +5,8 @@ schemaVersion: "1.26" createEntities: - client: id: &client0 "client0" - observeTracingMessages: { + observeTracingMessages: enableCommandPayload: 0 - } tests: - description: "observeTracingMessages enableCommandPayload must be boolean" From 3c69ed57d716784deaf495f39d9aef4ee2c51ee5 Mon Sep 17 00:00:00 2001 From: Nabil Hachicha Date: Fri, 15 Aug 2025 11:24:31 +0100 Subject: [PATCH 21/62] Update source/unified-test-format/tests/invalid/expectedTracingSpans-missingPropertySpans.yml Co-authored-by: Jeremy Mikola --- .../tests/invalid/expectedTracingSpans-missingPropertySpans.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/unified-test-format/tests/invalid/expectedTracingSpans-missingPropertySpans.yml b/source/unified-test-format/tests/invalid/expectedTracingSpans-missingPropertySpans.yml index b5f7693fea..b58f471189 100644 --- a/source/unified-test-format/tests/invalid/expectedTracingSpans-missingPropertySpans.yml +++ b/source/unified-test-format/tests/invalid/expectedTracingSpans-missingPropertySpans.yml @@ -10,4 +10,4 @@ tests: - description: "missing required property spans" operations: [] expectTracingMessages: - client: client0 + client: *client0 From 240d009a52322cdd53979db27f869be004690092 Mon Sep 17 00:00:00 2001 From: Nabil Hachicha Date: Fri, 15 Aug 2025 11:25:00 +0100 Subject: [PATCH 22/62] Update source/unified-test-format/tests/invalid/expectedTracingSpans-spanMalformedMissingName.yml Co-authored-by: Jeremy Mikola --- .../invalid/expectedTracingSpans-spanMalformedMissingName.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/unified-test-format/tests/invalid/expectedTracingSpans-spanMalformedMissingName.yml b/source/unified-test-format/tests/invalid/expectedTracingSpans-spanMalformedMissingName.yml index 65f6678220..069bfeee67 100644 --- a/source/unified-test-format/tests/invalid/expectedTracingSpans-spanMalformedMissingName.yml +++ b/source/unified-test-format/tests/invalid/expectedTracingSpans-spanMalformedMissingName.yml @@ -10,7 +10,7 @@ tests: - description: "missing required span name" operations: [] expectTracingMessages: - client: client0 + client: *client0 spans: - tags: db.system: mongodb From 6a4d2173f77f1229f3e1a9edb18784019ef85060 Mon Sep 17 00:00:00 2001 From: Nabil Hachicha Date: Fri, 15 Aug 2025 11:25:11 +0100 Subject: [PATCH 23/62] Update source/unified-test-format/tests/invalid/expectedTracingSpans-spanMalformedTagsMustBeObject.yml Co-authored-by: Jeremy Mikola --- .../expectedTracingSpans-spanMalformedTagsMustBeObject.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/unified-test-format/tests/invalid/expectedTracingSpans-spanMalformedTagsMustBeObject.yml b/source/unified-test-format/tests/invalid/expectedTracingSpans-spanMalformedTagsMustBeObject.yml index 1d8f2f8fab..b34bdc2b82 100644 --- a/source/unified-test-format/tests/invalid/expectedTracingSpans-spanMalformedTagsMustBeObject.yml +++ b/source/unified-test-format/tests/invalid/expectedTracingSpans-spanMalformedTagsMustBeObject.yml @@ -10,7 +10,7 @@ tests: - description: "span tags must be an object" operations: [] expectTracingMessages: - client: client0 + client: *client0 spans: - name: "foo" tags: [] From b596f055093a040ddc56fd70f5dc14c6ef8b0933 Mon Sep 17 00:00:00 2001 From: nhachicha <1793238+nhachicha@users.noreply.github.com> Date: Fri, 15 Aug 2025 10:25:44 +0000 Subject: [PATCH 24/62] Update generated files --- .../expectedTracingSpans-spanMalformedTagsMustBeObject.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/source/unified-test-format/tests/invalid/expectedTracingSpans-spanMalformedTagsMustBeObject.json b/source/unified-test-format/tests/invalid/expectedTracingSpans-spanMalformedTagsMustBeObject.json index 7f9812f74a..72af1c29b1 100644 --- a/source/unified-test-format/tests/invalid/expectedTracingSpans-spanMalformedTagsMustBeObject.json +++ b/source/unified-test-format/tests/invalid/expectedTracingSpans-spanMalformedTagsMustBeObject.json @@ -17,8 +17,7 @@ "spans": [ { "name": "foo", - "tags": [], - "nested": [] + "tags": [] } ] } From bbb075b1118993d4a04bec23fbda8249b54fad83 Mon Sep 17 00:00:00 2001 From: Nabil Hachicha Date: Fri, 15 Aug 2025 11:26:28 +0100 Subject: [PATCH 25/62] Update source/unified-test-format/tests/invalid/expectedTracingSpans-spanMalformedAdditionalProperties.yml Co-authored-by: Jeremy Mikola --- .../expectedTracingSpans-spanMalformedAdditionalProperties.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/unified-test-format/tests/invalid/expectedTracingSpans-spanMalformedAdditionalProperties.yml b/source/unified-test-format/tests/invalid/expectedTracingSpans-spanMalformedAdditionalProperties.yml index d5aaeb9d9c..fe209cc82f 100644 --- a/source/unified-test-format/tests/invalid/expectedTracingSpans-spanMalformedAdditionalProperties.yml +++ b/source/unified-test-format/tests/invalid/expectedTracingSpans-spanMalformedAdditionalProperties.yml @@ -10,7 +10,7 @@ tests: - description: "Span must not have additional properties" operations: [] expectTracingMessages: - client: client0 + client: *client0 spans: - name: "foo" tags: {} From a5638daff8ad38853b2f590494618f365fc7c890 Mon Sep 17 00:00:00 2001 From: Nabil Hachicha Date: Fri, 15 Aug 2025 11:27:26 +0100 Subject: [PATCH 26/62] Update source/unified-test-format/tests/invalid/expectedTracingSpans-spanMalformedNestedMustBeArray.yml Co-authored-by: Jeremy Mikola --- .../expectedTracingSpans-spanMalformedNestedMustBeArray.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/unified-test-format/tests/invalid/expectedTracingSpans-spanMalformedNestedMustBeArray.yml b/source/unified-test-format/tests/invalid/expectedTracingSpans-spanMalformedNestedMustBeArray.yml index ba48c4f1b6..c5eed9a491 100644 --- a/source/unified-test-format/tests/invalid/expectedTracingSpans-spanMalformedNestedMustBeArray.yml +++ b/source/unified-test-format/tests/invalid/expectedTracingSpans-spanMalformedNestedMustBeArray.yml @@ -10,7 +10,7 @@ tests: - description: "nested spans must be an array" operations: [] expectTracingMessages: - client: client0 + client: *client0 spans: - name: "foo" tags: {} From 56570a59bbebf54bb9102eaacc5013647814a2ae Mon Sep 17 00:00:00 2001 From: Nabil Hachicha Date: Fri, 15 Aug 2025 11:27:44 +0100 Subject: [PATCH 27/62] Update source/unified-test-format/tests/invalid/expectedTracingSpans-spanMalformedMissingName.yml Co-authored-by: Jeremy Mikola --- .../invalid/expectedTracingSpans-spanMalformedMissingName.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/unified-test-format/tests/invalid/expectedTracingSpans-spanMalformedMissingName.yml b/source/unified-test-format/tests/invalid/expectedTracingSpans-spanMalformedMissingName.yml index 069bfeee67..c2ec340a87 100644 --- a/source/unified-test-format/tests/invalid/expectedTracingSpans-spanMalformedMissingName.yml +++ b/source/unified-test-format/tests/invalid/expectedTracingSpans-spanMalformedMissingName.yml @@ -12,5 +12,5 @@ tests: expectTracingMessages: client: *client0 spans: - - tags: + - tags: {} db.system: mongodb From a4aa513cf02e3c369c214fc0d6f7457a7f769020 Mon Sep 17 00:00:00 2001 From: Nabil Hachicha Date: Fri, 15 Aug 2025 11:42:18 +0100 Subject: [PATCH 28/62] Update source/unified-test-format/tests/invalid/expectedTracingSpans-spanMalformedMissingTags.yml Co-authored-by: Jeremy Mikola --- .../invalid/expectedTracingSpans-spanMalformedMissingTags.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/unified-test-format/tests/invalid/expectedTracingSpans-spanMalformedMissingTags.yml b/source/unified-test-format/tests/invalid/expectedTracingSpans-spanMalformedMissingTags.yml index c1d979a444..5d82e5b360 100644 --- a/source/unified-test-format/tests/invalid/expectedTracingSpans-spanMalformedMissingTags.yml +++ b/source/unified-test-format/tests/invalid/expectedTracingSpans-spanMalformedMissingTags.yml @@ -10,6 +10,6 @@ tests: - description: "missing required span tags" operations: [] expectTracingMessages: - client: client0 + client: *client0 spans: - name: "foo" From cb74b54d107146437c886d038e5d744d17a89377 Mon Sep 17 00:00:00 2001 From: Nabil Hachicha Date: Thu, 14 Aug 2025 18:10:11 +0100 Subject: [PATCH 29/62] Using YAML anchors and references --- source/open-telemetry/tests/cursor/cursor.yml | 14 +++++------ .../open-telemetry/tests/operation/find.yml | 12 +++++----- .../tests/operation/find_retries.yml | 16 ++++++------- .../open-telemetry/tests/operation/insert.yml | 14 +++++------ .../tests/transaction/transaction.yml | 24 +++++++++---------- 5 files changed, 40 insertions(+), 40 deletions(-) diff --git a/source/open-telemetry/tests/cursor/cursor.yml b/source/open-telemetry/tests/cursor/cursor.yml index e14a367b1e..0cb9a40783 100644 --- a/source/open-telemetry/tests/cursor/cursor.yml +++ b/source/open-telemetry/tests/cursor/cursor.yml @@ -2,17 +2,17 @@ description: cursor retrieval schemaVersion: '1.26' createEntities: - client: - id: client0 + id: &client0 client0 useMultipleMongoses: false observeTracingMessages: enableCommandPayload: true - database: - id: database0 - client: client0 + id: &database0 database0 + client: *client0 databaseName: cursor - collection: - id: collection0 - database: database0 + id: &collection0 collection0 + database: *database0 collectionName: test initialData: - collectionName: test @@ -28,7 +28,7 @@ tests: - description: find with a cursor operations: - name: find - object: collection0 + object: *collection0 arguments: filter: { _id: { $gt: 1 } } batchSize: 2 @@ -39,7 +39,7 @@ tests: - { _id: 5 } - { _id: 6 } expectTracingMessages: - client: client0 + client: *client0 ignoreExtraSpans: false spans: - name: find cursor.test diff --git a/source/open-telemetry/tests/operation/find.yml b/source/open-telemetry/tests/operation/find.yml index 9d986344d1..38a05b48df 100644 --- a/source/open-telemetry/tests/operation/find.yml +++ b/source/open-telemetry/tests/operation/find.yml @@ -2,16 +2,16 @@ description: operation find schemaVersion: '1.26' createEntities: - client: - id: client0 + id: &client0 client0 useMultipleMongoses: false observeTracingMessages: enableCommandPayload: true - database: - id: database0 - client: client0 + id: &database0 database0 + client: *client0 databaseName: operation-find - collection: - id: collection0 + id: &collection0 collection0 database: database0 collectionName: test initialData: @@ -22,12 +22,12 @@ tests: - description: find an element operations: - name: find - object: collection0 + object: *collection0 arguments: filter: x: 1 expectTracingMessages: - client: client0 + client: *client0 ignoreExtraSpans: false spans: - name: find operation-find.test diff --git a/source/open-telemetry/tests/operation/find_retries.yml b/source/open-telemetry/tests/operation/find_retries.yml index 8ac578233c..8d985e787f 100644 --- a/source/open-telemetry/tests/operation/find_retries.yml +++ b/source/open-telemetry/tests/operation/find_retries.yml @@ -2,17 +2,17 @@ description: operation find retrying failed command schemaVersion: '1.26' createEntities: - client: - id: client0 + id: &client0 client0 useMultipleMongoses: false observeTracingMessages: enableCommandPayload: true - database: - id: database0 - client: client0 + id: &database0 database0 + client: *client0 databaseName: operation-find-retries - collection: - id: collection0 - database: database0 + id: &collection0 collection0 + database: *database0 collectionName: test initialData: - collectionName: test @@ -24,7 +24,7 @@ tests: - name: failPoint object: testRunner arguments: - client: client0 + client: *client0 failPoint: configureFailPoint: failCommand mode: @@ -36,12 +36,12 @@ tests: errorLabels: - RetryableWriteError - name: find - object: collection0 + object: *collection0 arguments: filter: x: 1 expectTracingMessages: - client: client0 + client: *client0 ignoreExtraSpans: true spans: - name: find operation-find-retries.test diff --git a/source/open-telemetry/tests/operation/insert.yml b/source/open-telemetry/tests/operation/insert.yml index a9895f1e63..702db319fe 100644 --- a/source/open-telemetry/tests/operation/insert.yml +++ b/source/open-telemetry/tests/operation/insert.yml @@ -2,17 +2,17 @@ description: operation insert schemaVersion: '1.26' createEntities: - client: - id: client0 + id: &client0 client0 useMultipleMongoses: false observeTracingMessages: enableCommandPayload: true - database: - id: database0 - client: client0 + id: &database0 database0 + client: *client0 databaseName: operation-insert - collection: - id: collection0 - database: database0 + id: &collection0 collection0 + database: *database0 collectionName: test initialData: - collectionName: test @@ -21,13 +21,13 @@ initialData: tests: - description: insert one element operations: - - object: collection0 + - object: *collection0 name: insertOne arguments: document: _id: 1 expectTracingMessages: - client: client0 + client: *client0 ignoreExtraSpans: false spans: - name: insert operation-insert.test diff --git a/source/open-telemetry/tests/transaction/transaction.yml b/source/open-telemetry/tests/transaction/transaction.yml index 7ac899f61d..e1f7cf6bad 100644 --- a/source/open-telemetry/tests/transaction/transaction.yml +++ b/source/open-telemetry/tests/transaction/transaction.yml @@ -10,20 +10,20 @@ runOnRequirements: - load-balanced createEntities: - client: - id: client0 + id: &client0 client0 useMultipleMongoses: false observeTracingMessages: enableCommandPayload: true - database: - id: database0 - client: client0 + id: &database0 database0 + client: *client0 databaseName: transaction-tests - collection: - id: collection0 - database: database0 + id: &collection0 collection0 + database: *database0 collectionName: test - session: - id: session0 + id: &session0 session0 client: client0 initialData: - collectionName: test @@ -32,23 +32,23 @@ initialData: tests: - description: observeTracingMessages around transaction operations: - - object: session0 + - object: *session0 name: startTransaction - - object: collection0 + - object: *collection0 name: insertOne arguments: - session: session0 + session: *session0 document: _id: 1 - - object: session0 + - object: *session0 name: commitTransaction - name: find - object: collection0 + object: *collection0 arguments: filter: x: 1 expectTracingMessages: - client: client0 + client: *client0 ignoreExtraSpans: false spans: - name: transaction From 3caa87ffbd7a6f70ecacd1f0c7f6b00b9dff8e8f Mon Sep 17 00:00:00 2001 From: Nabil Hachicha Date: Fri, 15 Aug 2025 12:48:15 +0100 Subject: [PATCH 30/62] PR feedback: Updating schema, adding more invalid tests --- .../open-telemetry/tests/cursor/cursor.json | 52 +++++++++++-------- source/open-telemetry/tests/cursor/cursor.yml | 26 ++++------ .../open-telemetry/tests/operation/find.json | 23 +++----- .../open-telemetry/tests/operation/find.yml | 20 +++---- .../tests/operation/find_retries.json | 33 +++++------- .../tests/operation/find_retries.yml | 29 ++++------- .../tests/operation/insert.json | 5 +- .../open-telemetry/tests/operation/insert.yml | 10 ++-- .../tests/transaction/transaction.json | 8 --- .../tests/transaction/transaction.yml | 11 ++-- source/unified-test-format/schema-1.26.json | 1 + source/unified-test-format/schema-latest.json | 1 + ...ctedTracingSpans-additionalProperties.json | 7 ++- ...ectedTracingSpans-additionalProperties.yml | 2 +- .../expectedTracingSpans-clientType.json | 7 ++- .../expectedTracingSpans-clientType.yml | 2 +- .../expectedTracingSpans-emptyNestedSpan.json | 29 +++++++++++ .../expectedTracingSpans-emptyNestedSpan.yml | 14 +++++ ...xpectedTracingSpans-invalidNestedSpan.json | 31 +++++++++++ ...expectedTracingSpans-invalidNestedSpan.yml | 14 +++++ ...tedTracingSpans-missingPropertyClient.json | 7 ++- ...ctedTracingSpans-missingPropertyClient.yml | 2 +- 22 files changed, 197 insertions(+), 137 deletions(-) create mode 100644 source/unified-test-format/tests/invalid/expectedTracingSpans-emptyNestedSpan.json create mode 100644 source/unified-test-format/tests/invalid/expectedTracingSpans-emptyNestedSpan.yml create mode 100644 source/unified-test-format/tests/invalid/expectedTracingSpans-invalidNestedSpan.json create mode 100644 source/unified-test-format/tests/invalid/expectedTracingSpans-invalidNestedSpan.yml diff --git a/source/open-telemetry/tests/cursor/cursor.json b/source/open-telemetry/tests/cursor/cursor.json index cac8e1a194..b0d6eaca15 100644 --- a/source/open-telemetry/tests/cursor/cursor.json +++ b/source/open-telemetry/tests/cursor/cursor.json @@ -128,8 +128,8 @@ }, "server.port": { "$$type": [ - "long", - "string" + "int", + "long" ] }, "server.type": { @@ -145,20 +145,20 @@ "$gt": 1 } }, - "batchSize": 2, - "$db": "cursor" + "batchSize": 2 } } }, "db.mongodb.server_connection_id": { "$$type": [ - "long", - "string" + "int", + "long" ] }, "db.mongodb.driver_connection_id": { "$$type": [ - "string" + "int", + "long" ] } } @@ -172,7 +172,10 @@ "db.command.name": "getMore", "network.transport": "tcp", "db.mongodb.cursor_id": { - "$$type": "string" + "$$type": [ + "int", + "long" + ] }, "db.response.status_code": { "$$exists": false @@ -191,8 +194,8 @@ }, "server.port": { "$$type": [ - "long", - "string" + "int", + "long" ] }, "server.type": { @@ -206,20 +209,20 @@ "$$type": "long" }, "collection": "test", - "batchSize": 2, - "$db": "cursor" + "batchSize": 2 } } }, "db.mongodb.server_connection_id": { "$$type": [ - "long", - "string" + "int", + "long" ] }, "db.mongodb.driver_connection_id": { "$$type": [ - "string" + "int", + "long" ] } } @@ -233,7 +236,10 @@ "db.command.name": "getMore", "network.transport": "tcp", "db.mongodb.cursor_id": { - "$$type": "string" + "$$type": [ + "int", + "long" + ] }, "db.response.status_code": { "$$exists": false @@ -252,8 +258,8 @@ }, "server.port": { "$$type": [ - "long", - "string" + "int", + "long" ] }, "server.type": { @@ -267,20 +273,20 @@ "$$type": "long" }, "collection": "test", - "batchSize": 2, - "$db": "cursor" + "batchSize": 2 } } }, "db.mongodb.server_connection_id": { "$$type": [ - "long", - "string" + "int", + "long" ] }, "db.mongodb.driver_connection_id": { "$$type": [ - "string" + "int", + "long" ] } } diff --git a/source/open-telemetry/tests/cursor/cursor.yml b/source/open-telemetry/tests/cursor/cursor.yml index 0cb9a40783..54675a8a67 100644 --- a/source/open-telemetry/tests/cursor/cursor.yml +++ b/source/open-telemetry/tests/cursor/cursor.yml @@ -63,7 +63,7 @@ tests: exception.type: { $$exists: false } exception.stacktrace: { $$exists: false } server.address: { $$type: string } - server.port: { $$type: [ 'long', 'string' ] } + server.port: { $$type: ['int', 'long'] } server.type: { $$type: string } db.query.summary: find db.query.text: @@ -72,11 +72,10 @@ tests: find: test filter: { _id: { $gt: 1 } } batchSize: 2 - $db: cursor db.mongodb.server_connection_id: - $$type: [ 'long', 'string' ] + $$type: [ 'int', 'long' ] db.mongodb.driver_connection_id: - $$type: [ 'string' ] + $$type: [ 'int', 'long' ] - name: command getMore tags: @@ -85,13 +84,13 @@ tests: db.collection.name: cursor.$cmd db.command.name: getMore network.transport: tcp - db.mongodb.cursor_id: { $$type: string } + db.mongodb.cursor_id: { $$type: [ 'int', 'long' ] } db.response.status_code: { $$exists: false } exception.message: { $$exists: false } exception.type: { $$exists: false } exception.stacktrace: { $$exists: false } server.address: { $$type: string } - server.port: { $$type: [ 'long', 'string' ] } + server.port: { $$type: ['int', 'long'] } server.type: { $$type: string } db.query.summary: getMore db.query.text: @@ -100,11 +99,10 @@ tests: getMore: { $$type: long } collection: test batchSize: 2 - $db: cursor db.mongodb.server_connection_id: - $$type: [ 'long', 'string' ] + $$type: [ 'int', 'long' ] db.mongodb.driver_connection_id: - $$type: [ 'string' ] + $$type: [ 'int', 'long' ] - name: command getMore tags: db.system: mongodb @@ -112,13 +110,13 @@ tests: db.collection.name: cursor.$cmd db.command.name: getMore network.transport: tcp - db.mongodb.cursor_id: { $$type: string } + db.mongodb.cursor_id: { $$type: [ 'int', 'long' ] } db.response.status_code: { $$exists: false } exception.message: { $$exists: false } exception.type: { $$exists: false } exception.stacktrace: { $$exists: false } server.address: { $$type: string } - server.port: { $$type: [ 'long', 'string' ] } + server.port: { $$type: ['int', 'long'] } server.type: { $$type: string } db.query.summary: getMore db.query.text: @@ -127,9 +125,7 @@ tests: getMore: { $$type: long } collection: test batchSize: 2 - $db: cursor db.mongodb.server_connection_id: - $$type: [ 'long', 'string' ] + $$type: [ 'int', 'long' ] db.mongodb.driver_connection_id: - $$type: [ 'string' ] - + $$type: [ 'int', 'long' ] diff --git a/source/open-telemetry/tests/operation/find.json b/source/open-telemetry/tests/operation/find.json index f0d1f50629..bdf493c73f 100644 --- a/source/open-telemetry/tests/operation/find.json +++ b/source/open-telemetry/tests/operation/find.json @@ -89,8 +89,8 @@ }, "server.port": { "$$type": [ - "long", - "string" + "int", + "long" ] }, "server.type": { @@ -103,20 +103,20 @@ "find": "test", "filter": { "x": 1 - }, - "$db": "operation-find" + } } } }, "db.mongodb.server_connection_id": { "$$type": [ - "long", - "string" + "int", + "long" ] }, "db.mongodb.driver_connection_id": { "$$type": [ - "string" + "int", + "long" ] } } @@ -124,14 +124,7 @@ ] } ] - }, - "outcome": [ - { - "collectionName": "test", - "databaseName": "operation-find", - "documents": [] - } - ] + } } ] } diff --git a/source/open-telemetry/tests/operation/find.yml b/source/open-telemetry/tests/operation/find.yml index 38a05b48df..4d5351df64 100644 --- a/source/open-telemetry/tests/operation/find.yml +++ b/source/open-telemetry/tests/operation/find.yml @@ -23,9 +23,8 @@ tests: operations: - name: find object: *collection0 - arguments: - filter: - x: 1 + arguments: { filter: { x: 1 } } + expectTracingMessages: client: *client0 ignoreExtraSpans: false @@ -51,7 +50,7 @@ tests: exception.type: { $$exists: false } exception.stacktrace: { $$exists: false } server.address: { $$type: string } - server.port: { $$type: ['long', 'string'] } + server.port: { $$type: ['int', 'long'] } server.type: { $$type: string } db.query.summary: find db.query.text: @@ -60,12 +59,7 @@ tests: find: test filter: x: 1 - $db: operation-find - db.mongodb.server_connection_id: - $$type: ['long', 'string'] - db.mongodb.driver_connection_id: - $$type: ['string'] - outcome: - - collectionName: test - databaseName: operation-find - documents: [] + db.mongodb.server_connection_id: + $$type: [ 'int', 'long' ] + db.mongodb.driver_connection_id: + $$type: [ 'int', 'long' ] diff --git a/source/open-telemetry/tests/operation/find_retries.json b/source/open-telemetry/tests/operation/find_retries.json index 081ee6bdd9..fe3b6811b2 100644 --- a/source/open-telemetry/tests/operation/find_retries.json +++ b/source/open-telemetry/tests/operation/find_retries.json @@ -125,20 +125,20 @@ "find": "test", "filter": { "x": 1 - }, - "$db": "operation-find-retries" + } } } }, "db.mongodb.server_connection_id": { "$$type": [ - "long", - "string" + "int", + "long" ] }, "db.mongodb.driver_connection_id": { "$$type": [ - "string" + "int", + "long" ] } } @@ -171,8 +171,8 @@ }, "server.port": { "$$type": [ - "long", - "string" + "int", + "long" ] }, "server.type": { @@ -185,20 +185,20 @@ "find": "test", "filter": { "x": 1 - }, - "$db": "operation-find-retries" + } } } }, "db.mongodb.server_connection_id": { "$$type": [ - "long", - "string" + "int", + "long" ] }, "db.mongodb.driver_connection_id": { "$$type": [ - "string" + "int", + "long" ] } } @@ -206,14 +206,7 @@ ] } ] - }, - "outcome": [ - { - "collectionName": "test", - "databaseName": "operation-find-retries", - "documents": [] - } - ] + } } ] } diff --git a/source/open-telemetry/tests/operation/find_retries.yml b/source/open-telemetry/tests/operation/find_retries.yml index 8d985e787f..5daebe5fdb 100644 --- a/source/open-telemetry/tests/operation/find_retries.yml +++ b/source/open-telemetry/tests/operation/find_retries.yml @@ -27,19 +27,16 @@ tests: client: *client0 failPoint: configureFailPoint: failCommand - mode: - times: 1 + mode: { times: 1 } data: - failCommands: - - find + failCommands: [ find ] errorCode: 89 - errorLabels: - - RetryableWriteError + errorLabels: [ RetryableWriteError ] + - name: find object: *collection0 arguments: - filter: - x: 1 + filter: { x: 1 } expectTracingMessages: client: *client0 ignoreExtraSpans: true @@ -74,11 +71,10 @@ tests: find: test filter: x: 1 - $db: operation-find-retries db.mongodb.server_connection_id: - $$type: ['long', 'string'] + $$type: [ 'int', 'long' ] db.mongodb.driver_connection_id: - $$type: ['string'] + $$type: [ 'int', 'long' ] - name: command find tags: db.system: mongodb @@ -92,7 +88,7 @@ tests: exception.type: { $$exists: false } exception.stacktrace: { $$exists: false } server.address: { $$type: string } - server.port: { $$type: [ 'long', 'string' ] } + server.port: { $$type: ['int', 'long'] } server.type: { $$type: string } db.query.summary: find db.query.text: @@ -101,13 +97,8 @@ tests: find: test filter: x: 1 - $db: operation-find-retries db.mongodb.server_connection_id: - $$type: [ 'long', 'string' ] + $$type: [ 'int', 'long' ] db.mongodb.driver_connection_id: - $$type: [ 'string' ] + $$type: [ 'int', 'long' ] - outcome: - - collectionName: test - databaseName: operation-find-retries - documents: [] diff --git a/source/open-telemetry/tests/operation/insert.json b/source/open-telemetry/tests/operation/insert.json index bcbc0e0077..c50391770d 100644 --- a/source/open-telemetry/tests/operation/insert.json +++ b/source/open-telemetry/tests/operation/insert.json @@ -84,10 +84,7 @@ "$$matchAsRoot": { "insert": "test", "ordered": true, - "txnNumber": { - "$$unsetOrMatches": 1 - }, - "$db": "operation-insert", + "txnNumber": 1, "documents": [ { "_id": 1 diff --git a/source/open-telemetry/tests/operation/insert.yml b/source/open-telemetry/tests/operation/insert.yml index 702db319fe..0a02a6128b 100644 --- a/source/open-telemetry/tests/operation/insert.yml +++ b/source/open-telemetry/tests/operation/insert.yml @@ -17,15 +17,14 @@ createEntities: initialData: - collectionName: test databaseName: operation-insert - documents: [] + documents: [ ] tests: - description: insert one element operations: - object: *collection0 name: insertOne - arguments: - document: - _id: 1 + arguments: { document: { _id: 1 } } + expectTracingMessages: client: *client0 ignoreExtraSpans: false @@ -51,8 +50,7 @@ tests: $$matchAsRoot: insert: test ordered: true - txnNumber: { $$unsetOrMatches: 1 } - $db: operation-insert + txnNumber: 1 documents: - _id: 1 diff --git a/source/open-telemetry/tests/transaction/transaction.json b/source/open-telemetry/tests/transaction/transaction.json index 76002922be..bc4e8f9174 100644 --- a/source/open-telemetry/tests/transaction/transaction.json +++ b/source/open-telemetry/tests/transaction/transaction.json @@ -129,10 +129,6 @@ "$$matchAsRoot": { "insert": "test", "ordered": true, - "$db": "transaction-tests", - "lsid": { - "$$sessionLsid": "session0" - }, "txnNumber": 1, "startTransaction": true, "autocommit": false, @@ -165,10 +161,6 @@ "$$matchAsDocument": { "$$matchAsRoot": { "commitTransaction": 1, - "$db": "admin", - "lsid": { - "$$sessionLsid": "session0" - }, "txnNumber": 1, "autocommit": false } diff --git a/source/open-telemetry/tests/transaction/transaction.yml b/source/open-telemetry/tests/transaction/transaction.yml index e1f7cf6bad..eb76cc5fd7 100644 --- a/source/open-telemetry/tests/transaction/transaction.yml +++ b/source/open-telemetry/tests/transaction/transaction.yml @@ -44,9 +44,8 @@ tests: name: commitTransaction - name: find object: *collection0 - arguments: - filter: - x: 1 + arguments: { filter: { x: 1 } } + expectTracingMessages: client: *client0 ignoreExtraSpans: false @@ -76,14 +75,12 @@ tests: $$matchAsRoot: insert: test ordered: true - $db: transaction-tests - lsid: { $$sessionLsid: session0 } txnNumber: 1 startTransaction: true autocommit: false documents: - _id: 1 - db.mongodb.lsid: { $$sessionLsid: session0 } + db.mongodb.lsid: { $$sessionLsid: *session0 } - name: commitTransaction admin.$cmd tags: db.system: mongodb @@ -95,8 +92,6 @@ tests: $$matchAsDocument: $$matchAsRoot: commitTransaction: 1 - $db: admin - lsid: { $$sessionLsid: session0 } txnNumber: 1 autocommit: false - name: find transaction-tests.test diff --git a/source/unified-test-format/schema-1.26.json b/source/unified-test-format/schema-1.26.json index 2ee895419f..25b69c05d8 100644 --- a/source/unified-test-format/schema-1.26.json +++ b/source/unified-test-format/schema-1.26.json @@ -394,6 +394,7 @@ }, "nested": { "type": "array", + "minItems": 1, "items": { "$ref": "#/definitions/spanComponent" } diff --git a/source/unified-test-format/schema-latest.json b/source/unified-test-format/schema-latest.json index 2ee895419f..25b69c05d8 100644 --- a/source/unified-test-format/schema-latest.json +++ b/source/unified-test-format/schema-latest.json @@ -394,6 +394,7 @@ }, "nested": { "type": "array", + "minItems": 1, "items": { "$ref": "#/definitions/spanComponent" } diff --git a/source/unified-test-format/tests/invalid/expectedTracingSpans-additionalProperties.json b/source/unified-test-format/tests/invalid/expectedTracingSpans-additionalProperties.json index 763c914150..5947a286b2 100644 --- a/source/unified-test-format/tests/invalid/expectedTracingSpans-additionalProperties.json +++ b/source/unified-test-format/tests/invalid/expectedTracingSpans-additionalProperties.json @@ -16,7 +16,12 @@ "client": "client0", "ignoreExtraSpans": false, "spans": [ - {} + { + "name": "command", + "tags": { + "db.system": "mongodb" + } + } ], "foo": 0 } diff --git a/source/unified-test-format/tests/invalid/expectedTracingSpans-additionalProperties.yml b/source/unified-test-format/tests/invalid/expectedTracingSpans-additionalProperties.yml index 58c4f7a74d..a00a79f257 100644 --- a/source/unified-test-format/tests/invalid/expectedTracingSpans-additionalProperties.yml +++ b/source/unified-test-format/tests/invalid/expectedTracingSpans-additionalProperties.yml @@ -12,5 +12,5 @@ tests: expectTracingMessages: client: *client0 ignoreExtraSpans: false - spans: [{}] + spans: [ { name: "command", tags: { db.system: mongodb } } ] foo: 0 diff --git a/source/unified-test-format/tests/invalid/expectedTracingSpans-clientType.json b/source/unified-test-format/tests/invalid/expectedTracingSpans-clientType.json index 854180ed1f..2fe7faea34 100644 --- a/source/unified-test-format/tests/invalid/expectedTracingSpans-clientType.json +++ b/source/unified-test-format/tests/invalid/expectedTracingSpans-clientType.json @@ -15,7 +15,12 @@ "expectTracingMessages": { "client": 0, "spans": [ - {} + { + "name": "command", + "tags": { + "db.system": "mongodb" + } + } ] } } diff --git a/source/unified-test-format/tests/invalid/expectedTracingSpans-clientType.yml b/source/unified-test-format/tests/invalid/expectedTracingSpans-clientType.yml index 318f82bff0..41af5de8bc 100644 --- a/source/unified-test-format/tests/invalid/expectedTracingSpans-clientType.yml +++ b/source/unified-test-format/tests/invalid/expectedTracingSpans-clientType.yml @@ -11,4 +11,4 @@ tests: operations: [] expectTracingMessages: client: 0 - spans: [{}] + spans: [ { name: "command", tags: { db.system: mongodb } } ] diff --git a/source/unified-test-format/tests/invalid/expectedTracingSpans-emptyNestedSpan.json b/source/unified-test-format/tests/invalid/expectedTracingSpans-emptyNestedSpan.json new file mode 100644 index 0000000000..8a98d5ba81 --- /dev/null +++ b/source/unified-test-format/tests/invalid/expectedTracingSpans-emptyNestedSpan.json @@ -0,0 +1,29 @@ +{ + "description": "expectedTracingSpans-emptyNestedSpan", + "schemaVersion": "1.26", + "createEntities": [ + { + "client": { + "id": "client0" + } + } + ], + "tests": [ + { + "description": "nested spans must not have fewer than 1 items'", + "operations": [], + "expectTracingMessages": { + "client": "client0", + "spans": [ + { + "name": "command", + "tags": { + "db.system": "mongodb" + }, + "nested": [] + } + ] + } + } + ] +} diff --git a/source/unified-test-format/tests/invalid/expectedTracingSpans-emptyNestedSpan.yml b/source/unified-test-format/tests/invalid/expectedTracingSpans-emptyNestedSpan.yml new file mode 100644 index 0000000000..abc9f8b3b8 --- /dev/null +++ b/source/unified-test-format/tests/invalid/expectedTracingSpans-emptyNestedSpan.yml @@ -0,0 +1,14 @@ +description: "expectedTracingSpans-emptyNestedSpan" + +schemaVersion: "1.26" + +createEntities: + - client: + id: &client0 "client0" + +tests: + - description: "nested spans must not have fewer than 1 items'" + operations: [] + expectTracingMessages: + client: *client0 + spans: [ { name: "command", tags: { db.system: mongodb }, nested:[] } ] diff --git a/source/unified-test-format/tests/invalid/expectedTracingSpans-invalidNestedSpan.json b/source/unified-test-format/tests/invalid/expectedTracingSpans-invalidNestedSpan.json new file mode 100644 index 0000000000..79a86744fb --- /dev/null +++ b/source/unified-test-format/tests/invalid/expectedTracingSpans-invalidNestedSpan.json @@ -0,0 +1,31 @@ +{ + "description": "expectedTracingSpans-invalidNestedSpan", + "schemaVersion": "1.26", + "createEntities": [ + { + "client": { + "id": "client0" + } + } + ], + "tests": [ + { + "description": "nested span must have required property name", + "operations": [], + "expectTracingMessages": { + "client": "client0", + "spans": [ + { + "name": "command", + "tags": { + "db.system": "mongodb" + }, + "nested": [ + {} + ] + } + ] + } + } + ] +} diff --git a/source/unified-test-format/tests/invalid/expectedTracingSpans-invalidNestedSpan.yml b/source/unified-test-format/tests/invalid/expectedTracingSpans-invalidNestedSpan.yml new file mode 100644 index 0000000000..6490c30502 --- /dev/null +++ b/source/unified-test-format/tests/invalid/expectedTracingSpans-invalidNestedSpan.yml @@ -0,0 +1,14 @@ +description: "expectedTracingSpans-invalidNestedSpan" + +schemaVersion: "1.26" + +createEntities: + - client: + id: &client0 "client0" + +tests: + - description: "nested span must have required property name" + operations: [] + expectTracingMessages: + client: *client0 + spans: [ { name: "command", tags: { db.system: mongodb }, nested: [ { } ] } ] diff --git a/source/unified-test-format/tests/invalid/expectedTracingSpans-missingPropertyClient.json b/source/unified-test-format/tests/invalid/expectedTracingSpans-missingPropertyClient.json index ffde2b16fb..2fb1cd5bbc 100644 --- a/source/unified-test-format/tests/invalid/expectedTracingSpans-missingPropertyClient.json +++ b/source/unified-test-format/tests/invalid/expectedTracingSpans-missingPropertyClient.json @@ -14,7 +14,12 @@ "operations": [], "expectTracingMessages": { "spans": [ - {} + { + "name": "command", + "tags": { + "db.system": "mongodb" + } + } ] } } diff --git a/source/unified-test-format/tests/invalid/expectedTracingSpans-missingPropertyClient.yml b/source/unified-test-format/tests/invalid/expectedTracingSpans-missingPropertyClient.yml index 2b908a03c1..cb0a46f1da 100644 --- a/source/unified-test-format/tests/invalid/expectedTracingSpans-missingPropertyClient.yml +++ b/source/unified-test-format/tests/invalid/expectedTracingSpans-missingPropertyClient.yml @@ -10,4 +10,4 @@ tests: - description: "missing required property client" operations: [] expectTracingMessages: - spans: [{}] + spans: [ { name: "command", tags: { db.system: mongodb } } ] From 7a68cbc67e98ba3a03b1bae58e2fe9509a761b76 Mon Sep 17 00:00:00 2001 From: Nabil Hachicha Date: Fri, 15 Aug 2025 13:14:27 +0100 Subject: [PATCH 31/62] Fixing lint errors --- source/open-telemetry/open-telemetry.md | 4 ++-- .../invalid/expectedTracingSpans-spanMalformedMissingName.yml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/source/open-telemetry/open-telemetry.md b/source/open-telemetry/open-telemetry.md index eb84242a79..abf138f680 100644 --- a/source/open-telemetry/open-telemetry.md +++ b/source/open-telemetry/open-telemetry.md @@ -51,8 +51,8 @@ responsible for configuration; this should be the responsibility of the TracerPr **OpenTelemetry API and SDK** OpenTelemetry offers two components for implementing instrumentation – API and SDK. The OpenTelemetry API provides all -the necessary types and method signatures. If there is no OpenTelemetry SDK available at runtime, API methods are no-ops. -OpenTelemetry SDK is an actual implementation of the API. If the SDK is available, API methods do work. +the necessary types and method signatures. If there is no OpenTelemetry SDK available at runtime, API methods are +no-ops. OpenTelemetry SDK is an actual implementation of the API. If the SDK is available, API methods do work. ### Implementation Requirements diff --git a/source/unified-test-format/tests/invalid/expectedTracingSpans-spanMalformedMissingName.yml b/source/unified-test-format/tests/invalid/expectedTracingSpans-spanMalformedMissingName.yml index c2ec340a87..e983a2e074 100644 --- a/source/unified-test-format/tests/invalid/expectedTracingSpans-spanMalformedMissingName.yml +++ b/source/unified-test-format/tests/invalid/expectedTracingSpans-spanMalformedMissingName.yml @@ -12,5 +12,5 @@ tests: expectTracingMessages: client: *client0 spans: - - tags: {} - db.system: mongodb + - tags: { db.system: mongodb } + From 1c2475951dceff246c1175904da7d42451e21288 Mon Sep 17 00:00:00 2001 From: Dmitry Rybakov <160598371+comandeo-mongo@users.noreply.github.com> Date: Mon, 18 Aug 2025 09:40:06 +0200 Subject: [PATCH 32/62] Update source/open-telemetry/open-telemetry.md Co-authored-by: Jeremy Mikola --- source/open-telemetry/open-telemetry.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/open-telemetry/open-telemetry.md b/source/open-telemetry/open-telemetry.md index abf138f680..2dc724ae4c 100644 --- a/source/open-telemetry/open-telemetry.md +++ b/source/open-telemetry/open-telemetry.md @@ -73,7 +73,7 @@ Drivers SHOULD support configuring OpenTelemetry on multiple levels. settings on higher levels. This configuration can be implemented with a `MongoClient` option, for example, `tracing.enabled`. - **Driver Level**: Drivers SHOULD provide a global setting that enables or disables OpenTelemetry for all `MongoClient` - instances (excluding those that explicitly override the setting). This configuration can be implemented with an + instances (excluding those that explicitly override the setting). This configuration SHOULD be implemented with an environment variable `OTEL_#{LANG}_INSTRUMENTATION_MONGODB_ENABLED`. Drivers MAY provide other means to globally disable OpenTelemetry that are more suitable for their language ecosystem. This option MUST override settings on the higher level. From a989a4953d509c466eba59f96d86cdface19abcb Mon Sep 17 00:00:00 2001 From: Dmitry Rybakov <160598371+comandeo-mongo@users.noreply.github.com> Date: Mon, 18 Aug 2025 09:40:20 +0200 Subject: [PATCH 33/62] Update source/open-telemetry/open-telemetry.md Co-authored-by: Jeremy Mikola --- source/open-telemetry/open-telemetry.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/open-telemetry/open-telemetry.md b/source/open-telemetry/open-telemetry.md index 2dc724ae4c..8042c6125f 100644 --- a/source/open-telemetry/open-telemetry.md +++ b/source/open-telemetry/open-telemetry.md @@ -198,7 +198,7 @@ specific; a driver decides what best describes the error. ##### db.query.text -This attribute contains the full database command executed serialized to JSON. If not truncated, the content of this +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`. From c84847c8084a3d13aff5b7756e6af7470e7440d3 Mon Sep 17 00:00:00 2001 From: Nabil Hachicha Date: Wed, 20 Aug 2025 07:57:28 +0100 Subject: [PATCH 34/62] adding more tests for operations --- source/crud/tests/unified/bulkWrite.json | 2 +- source/crud/tests/unified/bulkWrite.yml | 2 +- source/open-telemetry/tests/cursor/cursor.yml | 1 + .../tests/operation/aggregate.json | 131 ++++++++ .../tests/operation/aggregate.yml | 63 ++++ .../tests/operation/atlas_search.json | 234 ++++++++++++++ .../tests/operation/atlas_search.yml | 136 ++++++++ .../tests/operation/bulk_write.json | 302 ++++++++++++++++++ .../tests/operation/bulk_write.yml | 107 +++++++ .../open-telemetry/tests/operation/count.json | 124 +++++++ .../open-telemetry/tests/operation/count.yml | 64 ++++ .../tests/operation/create_collection.json | 112 +++++++ .../tests/operation/create_collection.yml | 57 ++++ .../tests/operation/create_indexes.json | 127 ++++++++ .../tests/operation/create_indexes.yml | 61 ++++ .../tests/operation/create_view.json | 138 ++++++++ .../tests/operation/create_view.yml | 65 ++++ .../tests/operation/delete.json | 103 ++++++ .../open-telemetry/tests/operation/delete.yml | 51 +++ .../tests/operation/distinct.json | 127 ++++++++ .../tests/operation/distinct.yml | 65 ++++ .../tests/operation/drop_collection.json | 118 +++++++ .../tests/operation/drop_collection.yml | 61 ++++ .../tests/operation/drop_indexes.json | 126 ++++++++ .../tests/operation/drop_indexes.yml | 68 ++++ .../tests/operation/find_one_and_update.json | 139 ++++++++ .../tests/operation/find_one_and_update.yml | 68 ++++ .../tests/operation/list_collections.json | 109 +++++++ .../tests/operation/list_collections.yml | 55 ++++ .../tests/operation/list_databases.json | 101 ++++++ .../tests/operation/list_databases.yml | 50 +++ .../tests/operation/list_indexes.json | 122 +++++++ .../tests/operation/list_indexes.yml | 62 ++++ .../tests/operation/map_reduce.json | 178 +++++++++++ .../tests/operation/map_reduce.yml | 99 ++++++ .../{find_retries.json => retries.json} | 4 +- .../{find_retries.yml => retries.yml} | 4 +- .../tests/operation/update.json | 109 +++++++ .../open-telemetry/tests/operation/update.yml | 54 ++++ .../tests/transaction/transaction.json | 100 ++++++ .../tests/transaction/transaction.yml | 55 ++++ 41 files changed, 3748 insertions(+), 6 deletions(-) create mode 100644 source/open-telemetry/tests/operation/aggregate.json create mode 100644 source/open-telemetry/tests/operation/aggregate.yml create mode 100644 source/open-telemetry/tests/operation/atlas_search.json create mode 100644 source/open-telemetry/tests/operation/atlas_search.yml create mode 100644 source/open-telemetry/tests/operation/bulk_write.json create mode 100644 source/open-telemetry/tests/operation/bulk_write.yml create mode 100644 source/open-telemetry/tests/operation/count.json create mode 100644 source/open-telemetry/tests/operation/count.yml create mode 100644 source/open-telemetry/tests/operation/create_collection.json create mode 100644 source/open-telemetry/tests/operation/create_collection.yml create mode 100644 source/open-telemetry/tests/operation/create_indexes.json create mode 100644 source/open-telemetry/tests/operation/create_indexes.yml create mode 100644 source/open-telemetry/tests/operation/create_view.json create mode 100644 source/open-telemetry/tests/operation/create_view.yml create mode 100644 source/open-telemetry/tests/operation/delete.json create mode 100644 source/open-telemetry/tests/operation/delete.yml create mode 100644 source/open-telemetry/tests/operation/distinct.json create mode 100644 source/open-telemetry/tests/operation/distinct.yml create mode 100644 source/open-telemetry/tests/operation/drop_collection.json create mode 100644 source/open-telemetry/tests/operation/drop_collection.yml create mode 100644 source/open-telemetry/tests/operation/drop_indexes.json create mode 100644 source/open-telemetry/tests/operation/drop_indexes.yml create mode 100644 source/open-telemetry/tests/operation/find_one_and_update.json create mode 100644 source/open-telemetry/tests/operation/find_one_and_update.yml create mode 100644 source/open-telemetry/tests/operation/list_collections.json create mode 100644 source/open-telemetry/tests/operation/list_collections.yml create mode 100644 source/open-telemetry/tests/operation/list_databases.json create mode 100644 source/open-telemetry/tests/operation/list_databases.yml create mode 100644 source/open-telemetry/tests/operation/list_indexes.json create mode 100644 source/open-telemetry/tests/operation/list_indexes.yml create mode 100644 source/open-telemetry/tests/operation/map_reduce.json create mode 100644 source/open-telemetry/tests/operation/map_reduce.yml rename source/open-telemetry/tests/operation/{find_retries.json => retries.json} (98%) rename source/open-telemetry/tests/operation/{find_retries.yml => retries.yml} (97%) create mode 100644 source/open-telemetry/tests/operation/update.json create mode 100644 source/open-telemetry/tests/operation/update.yml diff --git a/source/crud/tests/unified/bulkWrite.json b/source/crud/tests/unified/bulkWrite.json index 59b33cbac5..95159bc882 100644 --- a/source/crud/tests/unified/bulkWrite.json +++ b/source/crud/tests/unified/bulkWrite.json @@ -1,5 +1,5 @@ { - "description": "bulkWrite", + "§§description": "bulkWrite", "schemaVersion": "1.0", "runOnRequirements": [ { diff --git a/source/crud/tests/unified/bulkWrite.yml b/source/crud/tests/unified/bulkWrite.yml index 677e6725c4..734482bc21 100644 --- a/source/crud/tests/unified/bulkWrite.yml +++ b/source/crud/tests/unified/bulkWrite.yml @@ -1,4 +1,4 @@ -description: bulkWrite +§§description: bulkWrite schemaVersion: '1.0' diff --git a/source/open-telemetry/tests/cursor/cursor.yml b/source/open-telemetry/tests/cursor/cursor.yml index 54675a8a67..a78d50d01e 100644 --- a/source/open-telemetry/tests/cursor/cursor.yml +++ b/source/open-telemetry/tests/cursor/cursor.yml @@ -38,6 +38,7 @@ tests: - { _id: 4 } - { _id: 5 } - { _id: 6 } + expectTracingMessages: client: *client0 ignoreExtraSpans: false diff --git a/source/open-telemetry/tests/operation/aggregate.json b/source/open-telemetry/tests/operation/aggregate.json new file mode 100644 index 0000000000..a27d52d8cb --- /dev/null +++ b/source/open-telemetry/tests/operation/aggregate.json @@ -0,0 +1,131 @@ +{ + "description": "operation aggregate", + "schemaVersion": "1.26", + "createEntities": [ + { + "client": { + "id": "client0", + "useMultipleMongoses": false, + "observeTracingMessages": { + "enableCommandPayload": true + } + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "operation-aggregate" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "test" + } + } + ], + "tests": [ + { + "description": "aggregation", + "operations": [ + { + "name": "aggregate", + "object": "collection0", + "arguments": { + "pipeline": [ + { + "$match": { + "_id": 1 + } + } + ] + } + } + ], + "expectTracingMessages": { + "client": "client0", + "ignoreExtraSpans": false, + "spans": [ + { + "name": "aggregate operation-aggregate.test", + "tags": { + "db.system": "mongodb", + "db.namespace": "operation-aggregate", + "db.collection.name": "test", + "db.operation.name": "aggregate", + "db.operation.summary": "aggregate operation-aggregate.test" + }, + "nested": [ + { + "name": "command aggregate", + "tags": { + "db.system": "mongodb", + "db.namespace": "operation-aggregate", + "db.collection.name": "operation-aggregate.$cmd", + "db.command.name": "aggregate", + "network.transport": "tcp", + "db.mongodb.cursor_id": { + "$$exists": false + }, + "db.response.status_code": { + "$$exists": false + }, + "exception.message": { + "$$exists": false + }, + "exception.type": { + "$$exists": false + }, + "exception.stacktrace": { + "$$exists": false + }, + "server.address": { + "$$type": "string" + }, + "server.port": { + "$$type": [ + "int", + "long" + ] + }, + "server.type": { + "$$type": "string" + }, + "db.query.summary": "aggregate", + "db.query.text": { + "$$matchAsDocument": { + "$$matchAsRoot": { + "aggregate": "test", + "pipeline": [ + { + "$match": { + "_id": 1 + } + } + ] + } + } + }, + "db.mongodb.server_connection_id": { + "$$type": [ + "int", + "long" + ] + }, + "db.mongodb.driver_connection_id": { + "$$type": [ + "int", + "long" + ] + } + } + } + ] + } + ] + } + } + ] +} diff --git a/source/open-telemetry/tests/operation/aggregate.yml b/source/open-telemetry/tests/operation/aggregate.yml new file mode 100644 index 0000000000..e9e267dfab --- /dev/null +++ b/source/open-telemetry/tests/operation/aggregate.yml @@ -0,0 +1,63 @@ +description: operation aggregate +schemaVersion: '1.26' +createEntities: + - client: + id: &client0 client0 + useMultipleMongoses: false + observeTracingMessages: + enableCommandPayload: true + - database: + id: &database0 database0 + client: *client0 + databaseName: operation-aggregate + - collection: + id: &collection0 collection0 + database: *database0 + collectionName: test + +tests: + - description: aggregation + operations: + - name: aggregate + object: *collection0 + arguments: + pipeline: &pipeline1 + - $match: { _id: 1 } + + expectTracingMessages: + client: *client0 + ignoreExtraSpans: false + spans: + - name: aggregate operation-aggregate.test + tags: + db.system: mongodb + db.namespace: operation-aggregate + db.collection.name: test + db.operation.name: aggregate + db.operation.summary: aggregate operation-aggregate.test + nested: + - name: command aggregate + tags: + db.system: mongodb + db.namespace: operation-aggregate + db.collection.name: operation-aggregate.$cmd + db.command.name: aggregate + network.transport: tcp + db.mongodb.cursor_id: { $$exists: false } + db.response.status_code: { $$exists: false } + exception.message: { $$exists: false } + exception.type: { $$exists: false } + exception.stacktrace: { $$exists: false } + server.address: { $$type: string } + server.port: { $$type: ['int', 'long'] } + server.type: { $$type: string } + db.query.summary: aggregate + db.query.text: + $$matchAsDocument: + $$matchAsRoot: + aggregate: test + pipeline: *pipeline1 + db.mongodb.server_connection_id: + $$type: [ 'int', 'long' ] + db.mongodb.driver_connection_id: + $$type: [ 'int', 'long' ] diff --git a/source/open-telemetry/tests/operation/atlas_search.json b/source/open-telemetry/tests/operation/atlas_search.json new file mode 100644 index 0000000000..6c68b1951a --- /dev/null +++ b/source/open-telemetry/tests/operation/atlas_search.json @@ -0,0 +1,234 @@ +{ + "description": "operation atlas search", + "schemaVersion": "1.26", + "createEntities": [ + { + "client": { + "id": "client0", + "useMultipleMongoses": false, + "observeTracingMessages": { + "enableCommandPayload": true + } + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "operation-atlas-search" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "test" + } + } + ], + "runOnRequirements": [ + { + "minServerVersion": "7.0.5", + "maxServerVersion": "7.0.99", + "topologies": [ + "replicaset", + "load-balanced", + "sharded" + ], + "serverless": "forbid" + }, + { + "minServerVersion": "7.2.0", + "topologies": [ + "replicaset", + "load-balanced", + "sharded" + ], + "serverless": "forbid" + } + ], + "tests": [ + { + "description": "atlas search indexes", + "operations": [ + { + "name": "createSearchIndex", + "object": "collection0", + "arguments": { + "model": { + "definition": { + "mappings": { + "dynamic": true + } + }, + "type": "search" + } + }, + "expectError": { + "isError": true, + "errorContains": "Atlas" + } + }, + { + "name": "updateSearchIndex", + "object": "collection0", + "arguments": { + "name": "test index", + "definition": {} + }, + "expectError": { + "isError": true, + "errorContains": "Atlas" + } + }, + { + "name": "dropSearchIndex", + "object": "collection0", + "arguments": { + "name": "test index" + }, + "expectError": { + "isError": true, + "errorContains": "Atlas" + } + } + ], + "expectTracingMessages": { + "client": "client0", + "ignoreExtraSpans": false, + "spans": [ + { + "name": "createSearchIndexes operation-atlas-search.test", + "tags": { + "db.system": "mongodb", + "db.namespace": "operation-atlas-search", + "db.collection.name": "test", + "db.operation.name": "createSearchIndexes", + "db.operation.summary": "createSearchIndexes operation-atlas-search.test" + }, + "nested": [ + { + "name": "command createSearchIndexes", + "tags": { + "db.system": "mongodb", + "db.namespace": "operation-atlas-search", + "server.address": { + "$$type": "string" + }, + "server.port": { + "$$type": [ + "long", + "string" + ] + }, + "server.type": { + "$$type": "string" + }, + "db.query.summary": "createSearchIndexes", + "db.query.text": { + "$$matchAsDocument": { + "$$matchAsRoot": { + "createSearchIndexes": "test", + "indexes": [ + { + "type": "search", + "definition": { + "mappings": { + "dynamic": true + } + } + } + ] + } + } + } + } + } + ] + }, + { + "name": "updateSearchIndex operation-atlas-search.test", + "tags": { + "db.system": "mongodb", + "db.namespace": "operation-atlas-search", + "db.collection.name": "test", + "db.operation.name": "updateSearchIndex", + "db.operation.summary": "updateSearchIndex operation-atlas-search.test" + }, + "nested": [ + { + "name": "command updateSearchIndex", + "tags": { + "db.system": "mongodb", + "db.namespace": "operation-atlas-search", + "server.address": { + "$$type": "string" + }, + "server.port": { + "$$type": [ + "long", + "string" + ] + }, + "server.type": { + "$$type": "string" + }, + "db.query.summary": "updateSearchIndex", + "db.query.text": { + "$$matchAsDocument": { + "$$matchAsRoot": { + "updateSearchIndex": "test", + "name": "test index", + "definition": {} + } + } + } + } + } + ] + }, + { + "name": "dropSearchIndex operation-atlas-search.test", + "tags": { + "db.system": "mongodb", + "db.namespace": "operation-atlas-search", + "db.collection.name": "test", + "db.operation.name": "dropSearchIndex", + "db.operation.summary": "dropSearchIndex operation-atlas-search.test" + }, + "nested": [ + { + "name": "command dropSearchIndex", + "tags": { + "db.system": "mongodb", + "db.namespace": "operation-atlas-search", + "server.address": { + "$$type": "string" + }, + "server.port": { + "$$type": [ + "long", + "string" + ] + }, + "server.type": { + "$$type": "string" + }, + "db.query.summary": "dropSearchIndex", + "db.query.text": { + "$$matchAsDocument": { + "$$matchAsRoot": { + "dropSearchIndex": "test", + "name": "test index" + } + } + } + } + } + ] + } + ] + } + } + ] +} diff --git a/source/open-telemetry/tests/operation/atlas_search.yml b/source/open-telemetry/tests/operation/atlas_search.yml new file mode 100644 index 0000000000..ab3f85e243 --- /dev/null +++ b/source/open-telemetry/tests/operation/atlas_search.yml @@ -0,0 +1,136 @@ +description: operation atlas search +schemaVersion: '1.26' +createEntities: + - client: + id: &client0 client0 + useMultipleMongoses: false + observeTracingMessages: + enableCommandPayload: true + - database: + id: &database0 database0 + client: *client0 + databaseName: operation-atlas-search + - collection: + id: &collection0 collection0 + database: *database0 + collectionName: test + +runOnRequirements: + # Skip server versions without fix of SERVER-83107 to avoid error message "BSON field 'createSearchIndexes.indexes.type' is an unknown field." + # SERVER-83107 was not backported to 7.1. + - minServerVersion: "7.0.5" + maxServerVersion: "7.0.99" + topologies: [ replicaset, load-balanced, sharded ] + serverless: forbid + - minServerVersion: "7.2.0" + topologies: [ replicaset, load-balanced, sharded ] + serverless: forbid + + +tests: + - description: atlas search indexes + operations: + - name: createSearchIndex + object: *collection0 + arguments: + model: { definition: { mappings: { dynamic: true } } , type: 'search' } + expectError: + # This test always errors in a non-Atlas environment. The test functions as a unit test by asserting + # that the driver constructs and sends the correct command. + # The expected error message was changed in SERVER-83003. Check for the substring "Atlas" shared by both error messages. + isError: true + errorContains: Atlas + + - name: updateSearchIndex + object: *collection0 + arguments: + name: 'test index' + definition: {} + expectError: + # This test always errors in a non-Atlas environment. The test functions as a unit test by asserting + # that the driver constructs and sends the correct command. + # The expected error message was changed in SERVER-83003. Check for the substring "Atlas" shared by both error messages. + isError: true + errorContains: Atlas + + - name: dropSearchIndex + object: *collection0 + arguments: + name: 'test index' + expectError: + # This test always errors in a non-Atlas environment. The test functions as a unit test by asserting + # that the driver constructs and sends the correct command. + # The expected error message was changed in SERVER-83003. Check for the substring "Atlas" shared by both error messages. + isError: true + errorContains: Atlas + + expectTracingMessages: + client: *client0 + ignoreExtraSpans: false + spans: + - name: createSearchIndexes operation-atlas-search.test + tags: + db.system: mongodb + db.namespace: operation-atlas-search + db.collection.name: test + db.operation.name: createSearchIndexes + db.operation.summary: createSearchIndexes operation-atlas-search.test + nested: + - name: command createSearchIndexes + tags: + db.system: mongodb + db.namespace: operation-atlas-search + server.address: { $$type: string } + server.port: { $$type: [ 'long', 'string' ] } + server.type: { $$type: string } + db.query.summary: createSearchIndexes + db.query.text: + $$matchAsDocument: + $$matchAsRoot: + createSearchIndexes: test + indexes: [ { "type": "search", "definition": { "mappings": { "dynamic": true } } } ] + + - name: updateSearchIndex operation-atlas-search.test + tags: + db.system: mongodb + db.namespace: operation-atlas-search + db.collection.name: test + db.operation.name: updateSearchIndex + db.operation.summary: updateSearchIndex operation-atlas-search.test + nested: + - name: command updateSearchIndex + tags: + db.system: mongodb + db.namespace: operation-atlas-search + server.address: { $$type: string } + server.port: { $$type: [ 'long', 'string' ] } + server.type: { $$type: string } + db.query.summary: updateSearchIndex + db.query.text: + $$matchAsDocument: + $$matchAsRoot: + updateSearchIndex: test + name: test index + definition: {} + + - name: dropSearchIndex operation-atlas-search.test + tags: + db.system: mongodb + db.namespace: operation-atlas-search + db.collection.name: test + db.operation.name: dropSearchIndex + db.operation.summary: dropSearchIndex operation-atlas-search.test + nested: + - name: command dropSearchIndex + tags: + db.system: mongodb + db.namespace: operation-atlas-search + server.address: { $$type: string } + server.port: { $$type: [ 'long', 'string' ] } + server.type: { $$type: string } + db.query.summary: dropSearchIndex + db.query.text: + $$matchAsDocument: + $$matchAsRoot: + dropSearchIndex: test + name: test index diff --git a/source/open-telemetry/tests/operation/bulk_write.json b/source/open-telemetry/tests/operation/bulk_write.json new file mode 100644 index 0000000000..ca814e4f99 --- /dev/null +++ b/source/open-telemetry/tests/operation/bulk_write.json @@ -0,0 +1,302 @@ +{ + "description": "operation bulkwrite", + "schemaVersion": "1.26", + "runOnRequirements": [ + { + "minServerVersion": "8.0", + "serverless": "forbid" + } + ], + "createEntities": [ + { + "client": { + "id": "client0", + "useMultipleMongoses": false, + "observeTracingMessages": { + "enableCommandPayload": true + } + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "operation-bulk-write" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "test" + } + } + ], + "initialData": [ + { + "collectionName": "test", + "databaseName": "operation-bulk-write", + "documents": [] + } + ], + "_yamlAnchors": { + "namespace": "operation-bulk-write.test" + }, + "tests": [ + { + "description": "bulkWrite", + "operations": [ + { + "object": "client0", + "name": "clientBulkWrite", + "arguments": { + "models": [ + { + "insertOne": { + "namespace": "operation-bulk-write.test", + "document": { + "_id": 8, + "x": 88 + } + } + }, + { + "updateOne": { + "namespace": "operation-bulk-write.test", + "filter": { + "_id": 1 + }, + "update": { + "$inc": { + "x": 1 + } + } + } + }, + { + "updateMany": { + "namespace": "operation-bulk-write.test", + "filter": { + "$and": [ + { + "_id": { + "$gt": 1 + } + }, + { + "_id": { + "$lte": 3 + } + } + ] + }, + "update": { + "$inc": { + "x": 2 + } + } + } + }, + { + "replaceOne": { + "namespace": "operation-bulk-write.test", + "filter": { + "_id": 4 + }, + "replacement": { + "x": 44 + }, + "upsert": true + } + }, + { + "deleteOne": { + "namespace": "operation-bulk-write.test", + "filter": { + "_id": 5 + } + } + }, + { + "deleteMany": { + "namespace": "operation-bulk-write.test", + "filter": { + "$and": [ + { + "_id": { + "$gt": 5 + } + }, + { + "_id": { + "$lte": 7 + } + } + ] + } + } + } + ] + } + } + ], + "expectTracingMessages": { + "client": "client0", + "ignoreExtraSpans": false, + "spans": [ + { + "name": "bulkWrite operation-bulk-write.test", + "tags": { + "db.system": "mongodb", + "db.namespace": "operation-bulk-write", + "db.collection.name": "test", + "db.operation.name": "bulkWrite", + "db.operation.summary": "bulkWrite operation-bulk-write.test" + }, + "nested": [ + { + "name": "command bulkWrite", + "tags": { + "db.system": "mongodb", + "db.namespace": "admin", + "db.collection.name": "admin.$cmd", + "db.command.name": "bulkWrite", + "network.transport": "tcp", + "db.mongodb.cursor_id": { + "$$exists": false + }, + "db.response.status_code": { + "$$exists": false + }, + "exception.message": { + "$$exists": false + }, + "exception.type": { + "$$exists": false + }, + "exception.stacktrace": { + "$$exists": false + }, + "server.address": { + "$$type": "string" + }, + "server.port": { + "$$type": [ + "int", + "long" + ] + }, + "server.type": { + "$$type": "string" + }, + "db.query.summary": "bulkWrite", + "db.query.text": { + "$$matchAsDocument": { + "$$matchAsRoot": { + "bulkWrite": 1, + "errorsOnly": true, + "ordered": true, + "ops": [ + { + "insert": 0, + "document": { + "_id": 8, + "x": 88 + } + }, + { + "update": 0, + "multi": false, + "filter": { + "_id": 1 + }, + "updateMods": { + "$inc": { + "x": 1 + } + } + }, + { + "update": 0, + "multi": true, + "filter": { + "$and": [ + { + "_id": { + "$gt": 1 + } + }, + { + "_id": { + "$lte": 3 + } + } + ] + }, + "updateMods": { + "$inc": { + "x": 2 + } + } + }, + { + "update": 0, + "multi": false, + "filter": { + "_id": 4 + }, + "updateMods": { + "x": 44 + }, + "upsert": true + }, + { + "delete": 0, + "multi": false, + "filter": { + "_id": 5 + } + }, + { + "delete": 0, + "multi": true, + "filter": { + "$and": [ + { + "_id": { + "$gt": 5 + } + }, + { + "_id": { + "$lte": 7 + } + } + ] + } + } + ] + } + } + }, + "db.mongodb.server_connection_id": { + "$$type": [ + "int", + "long" + ] + }, + "db.mongodb.driver_connection_id": { + "$$type": [ + "int", + "long" + ] + } + } + } + ] + } + ] + } + } + ] +} diff --git a/source/open-telemetry/tests/operation/bulk_write.yml b/source/open-telemetry/tests/operation/bulk_write.yml new file mode 100644 index 0000000000..1f93b9fdff --- /dev/null +++ b/source/open-telemetry/tests/operation/bulk_write.yml @@ -0,0 +1,107 @@ +description: operation bulkwrite +schemaVersion: '1.26' +runOnRequirements: + - minServerVersion: "8.0" + serverless: forbid + +createEntities: + - client: + id: &client0 client0 + useMultipleMongoses: false + observeTracingMessages: + enableCommandPayload: true + - database: + id: &database0 database0 + client: *client0 + databaseName: &databaseName operation-bulk-write + - collection: + id: collection0 + database: *database0 + collectionName: &collectionName test +initialData: + - collectionName: *collectionName + databaseName: *databaseName + documents: [] + +_yamlAnchors: + namespace: &namespace "operation-bulk-write.test" + +tests: + - description: bulkWrite + operations: + - object: *client0 + name: clientBulkWrite + arguments: + models: + - insertOne: + namespace: *namespace + document: { _id: 8, x: 88 } + - updateOne: + namespace: *namespace + filter: { _id: 1 } + update: { $inc: { x: 1 } } + - updateMany: + namespace: *namespace + filter: + $and: [ { _id: { $gt: 1 } }, { _id: { $lte: 3 } } ] + update: { $inc: { x: 2 } } + - replaceOne: + namespace: *namespace + filter: { _id: 4 } + replacement: { x: 44 } + upsert: true + - deleteOne: + namespace: *namespace + filter: { _id: 5 } + - deleteMany: + namespace: *namespace + filter: + $and: [ { _id: { $gt: 5 } }, { _id: { $lte: 7 } } ] + + expectTracingMessages: + client: *client0 + ignoreExtraSpans: false + spans: + - name: bulkWrite operation-bulk-write.test + tags: + db.system: mongodb + db.namespace: operation-bulk-write + db.collection.name: test + db.operation.name: bulkWrite + db.operation.summary: bulkWrite operation-bulk-write.test + nested: + - name: command bulkWrite + tags: + db.system: mongodb + db.namespace: admin + db.collection.name: admin.$cmd + db.command.name: bulkWrite + network.transport: tcp + db.mongodb.cursor_id: { $$exists: false } + db.response.status_code: { $$exists: false } + exception.message: { $$exists: false } + exception.type: { $$exists: false } + exception.stacktrace: { $$exists: false } + server.address: { $$type: string } + server.port: { $$type: ['int', 'long'] } + server.type: { $$type: string } + db.query.summary: bulkWrite + db.query.text: + $$matchAsDocument: + $$matchAsRoot: + bulkWrite: 1 + errorsOnly: true + ordered: true + ops: [ { "insert": 0, "document": { "_id": 8, "x": 88 } }, + { "update": 0, "multi": false, "filter": { "_id": 1 }, "updateMods": { "$inc": { "x": 1 } } }, + { "update": 0, "multi": true, "filter": { "$and": [ { "_id": { "$gt": 1 } }, { "_id": { "$lte": 3 } } ] }, + "updateMods": { "$inc": { "x": 2 } } }, + { "update": 0, "multi": false, "filter": { "_id": 4 }, + "updateMods": { "x": 44 }, "upsert": true }, + { "delete": 0, "multi": false, "filter": { "_id": 5 } }, + { "delete": 0, "multi": true, "filter": { "$and": [ + { "_id": { "$gt": 5 } }, { "_id": { "$lte": 7 } } ] } } ] + db.mongodb.server_connection_id: + $$type: [ 'int', 'long' ] + db.mongodb.driver_connection_id: + $$type: [ 'int', 'long' ] diff --git a/source/open-telemetry/tests/operation/count.json b/source/open-telemetry/tests/operation/count.json new file mode 100644 index 0000000000..507a9e4746 --- /dev/null +++ b/source/open-telemetry/tests/operation/count.json @@ -0,0 +1,124 @@ +{ + "description": "operation count", + "schemaVersion": "1.26", + "createEntities": [ + { + "client": { + "id": "client0", + "useMultipleMongoses": false, + "observeTracingMessages": { + "enableCommandPayload": true + } + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "operation-count" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "test" + } + } + ], + "initialData": [ + { + "collectionName": "test", + "databaseName": "operation-count", + "documents": [] + } + ], + "tests": [ + { + "description": "estimated document count", + "operations": [ + { + "object": "collection0", + "name": "estimatedDocumentCount", + "arguments": {}, + "expectResult": 0 + } + ], + "expectTracingMessages": { + "client": "client0", + "ignoreExtraSpans": false, + "spans": [ + { + "name": "count operation-count.test", + "tags": { + "db.system": "mongodb", + "db.namespace": "operation-count", + "db.collection.name": "test", + "db.operation.name": "count", + "db.operation.summary": "count operation-count.test" + }, + "nested": [ + { + "name": "command count", + "tags": { + "db.system": "mongodb", + "db.namespace": "operation-count", + "db.collection.name": "operation-count.$cmd", + "db.command.name": "count", + "network.transport": "tcp", + "db.mongodb.cursor_id": { + "$$exists": false + }, + "db.response.status_code": { + "$$exists": false + }, + "exception.message": { + "$$exists": false + }, + "exception.type": { + "$$exists": false + }, + "exception.stacktrace": { + "$$exists": false + }, + "server.address": { + "$$type": "string" + }, + "server.port": { + "$$type": [ + "int", + "long" + ] + }, + "server.type": { + "$$type": "string" + }, + "db.query.summary": "count", + "db.query.text": { + "$$matchAsDocument": { + "$$matchAsRoot": { + "count": "test" + } + } + }, + "db.mongodb.server_connection_id": { + "$$type": [ + "int", + "long" + ] + }, + "db.mongodb.driver_connection_id": { + "$$type": [ + "int", + "long" + ] + } + } + } + ] + } + ] + } + } + ] +} diff --git a/source/open-telemetry/tests/operation/count.yml b/source/open-telemetry/tests/operation/count.yml new file mode 100644 index 0000000000..4b0ed558d7 --- /dev/null +++ b/source/open-telemetry/tests/operation/count.yml @@ -0,0 +1,64 @@ +description: operation count +schemaVersion: '1.26' +createEntities: + - client: + id: &client0 client0 + useMultipleMongoses: false + observeTracingMessages: + enableCommandPayload: true + - database: + id: database0 + client: *client0 + databaseName: operation-count + - collection: + id: &collection0 collection0 + database: database0 + collectionName: test +initialData: + - collectionName: test + databaseName: operation-count + documents: [] +tests: + - description: estimated document count + operations: + - object: *collection0 + name: estimatedDocumentCount + arguments: { } + expectResult: 0 + + expectTracingMessages: + client: *client0 + ignoreExtraSpans: false + spans: + - name: count operation-count.test + tags: + db.system: mongodb + db.namespace: operation-count + db.collection.name: test + db.operation.name: count + db.operation.summary: count operation-count.test + nested: + - name: command count + tags: + db.system: mongodb + db.namespace: operation-count + db.collection.name: operation-count.$cmd + db.command.name: count + network.transport: tcp + db.mongodb.cursor_id: { $$exists: false } + db.response.status_code: { $$exists: false } + exception.message: { $$exists: false } + exception.type: { $$exists: false } + exception.stacktrace: { $$exists: false } + server.address: { $$type: string } + server.port: { $$type: ['int', 'long'] } + server.type: { $$type: string } + db.query.summary: count + db.query.text: + $$matchAsDocument: + $$matchAsRoot: + count: test + db.mongodb.server_connection_id: + $$type: [ 'int', 'long' ] + db.mongodb.driver_connection_id: + $$type: [ 'int', 'long' ] diff --git a/source/open-telemetry/tests/operation/create_collection.json b/source/open-telemetry/tests/operation/create_collection.json new file mode 100644 index 0000000000..1b510bebbb --- /dev/null +++ b/source/open-telemetry/tests/operation/create_collection.json @@ -0,0 +1,112 @@ +{ + "description": "operation create collection", + "schemaVersion": "1.26", + "createEntities": [ + { + "client": { + "id": "client0", + "useMultipleMongoses": false, + "observeTracingMessages": { + "enableCommandPayload": true + } + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "operation-create-collection" + } + } + ], + "tests": [ + { + "description": "create collection", + "operations": [ + { + "object": "database0", + "name": "createCollection", + "arguments": { + "collection": "newlyCreatedCollection" + } + } + ], + "expectTracingMessages": { + "client": "client0", + "ignoreExtraSpans": false, + "spans": [ + { + "name": "createCollection operation-create-collection.newlyCreatedCollection", + "tags": { + "db.system": "mongodb", + "db.namespace": "operation-create-collection", + "db.collection.name": "newlyCreatedCollection", + "db.operation.name": "createCollection", + "db.operation.summary": "createCollection operation-create-collection.newlyCreatedCollection" + }, + "nested": [ + { + "name": "command create", + "tags": { + "db.system": "mongodb", + "db.namespace": "operation-create-collection", + "db.collection.name": "operation-create-collection.$cmd", + "db.command.name": "create", + "network.transport": "tcp", + "db.mongodb.cursor_id": { + "$$exists": false + }, + "db.response.status_code": { + "$$exists": false + }, + "exception.message": { + "$$exists": false + }, + "exception.type": { + "$$exists": false + }, + "exception.stacktrace": { + "$$exists": false + }, + "server.address": { + "$$type": "string" + }, + "server.port": { + "$$type": [ + "int", + "long" + ] + }, + "server.type": { + "$$type": "string" + }, + "db.query.summary": "create", + "db.query.text": { + "$$matchAsDocument": { + "$$matchAsRoot": { + "create": "newlyCreatedCollection", + "capped": false + } + } + }, + "db.mongodb.server_connection_id": { + "$$type": [ + "int", + "long" + ] + }, + "db.mongodb.driver_connection_id": { + "$$type": [ + "int", + "long" + ] + } + } + } + ] + } + ] + } + } + ] +} diff --git a/source/open-telemetry/tests/operation/create_collection.yml b/source/open-telemetry/tests/operation/create_collection.yml new file mode 100644 index 0000000000..c3f39e55e5 --- /dev/null +++ b/source/open-telemetry/tests/operation/create_collection.yml @@ -0,0 +1,57 @@ +description: operation create collection +schemaVersion: '1.26' +createEntities: + - client: + id: &client0 client0 + useMultipleMongoses: false + observeTracingMessages: + enableCommandPayload: true + - database: + id: &database0 database0 + client: *client0 + databaseName: operation-create-collection +tests: + - description: create collection + operations: + - object: *database0 + name: createCollection + arguments: + collection: newlyCreatedCollection + + expectTracingMessages: + client: *client0 + ignoreExtraSpans: false + spans: + - name: createCollection operation-create-collection.newlyCreatedCollection + tags: + db.system: mongodb + db.namespace: operation-create-collection + db.collection.name: newlyCreatedCollection + db.operation.name: createCollection + db.operation.summary: createCollection operation-create-collection.newlyCreatedCollection + nested: + - name: command create + tags: + db.system: mongodb + db.namespace: operation-create-collection + db.collection.name: operation-create-collection.$cmd + db.command.name: create + network.transport: tcp + db.mongodb.cursor_id: { $$exists: false } + db.response.status_code: { $$exists: false } + exception.message: { $$exists: false } + exception.type: { $$exists: false } + exception.stacktrace: { $$exists: false } + server.address: { $$type: string } + server.port: { $$type: ['int', 'long'] } + server.type: { $$type: string } + db.query.summary: create + db.query.text: + $$matchAsDocument: + $$matchAsRoot: + create: newlyCreatedCollection + capped: false + db.mongodb.server_connection_id: + $$type: [ 'int', 'long' ] + db.mongodb.driver_connection_id: + $$type: [ 'int', 'long' ] diff --git a/source/open-telemetry/tests/operation/create_indexes.json b/source/open-telemetry/tests/operation/create_indexes.json new file mode 100644 index 0000000000..83dcd89c27 --- /dev/null +++ b/source/open-telemetry/tests/operation/create_indexes.json @@ -0,0 +1,127 @@ +{ + "description": "operation create indexes", + "schemaVersion": "1.26", + "createEntities": [ + { + "client": { + "id": "client0", + "useMultipleMongoses": false, + "observeTracingMessages": { + "enableCommandPayload": true + } + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "operation-create-indexes" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "test" + } + } + ], + "tests": [ + { + "description": "create indexes", + "operations": [ + { + "object": "collection0", + "name": "createIndex", + "arguments": { + "keys": { + "x": 1 + } + } + } + ], + "expectTracingMessages": { + "client": "client0", + "ignoreExtraSpans": false, + "spans": [ + { + "name": "createIndexes operation-create-indexes.test", + "tags": { + "db.system": "mongodb", + "db.namespace": "operation-create-indexes", + "db.collection.name": "test", + "db.operation.name": "createIndexes", + "db.operation.summary": "createIndexes operation-create-indexes.test" + }, + "nested": [ + { + "name": "command createIndexes", + "tags": { + "db.system": "mongodb", + "db.namespace": "operation-create-indexes", + "db.collection.name": "operation-create-indexes.$cmd", + "db.command.name": "createIndexes", + "network.transport": "tcp", + "db.mongodb.cursor_id": { + "$$exists": false + }, + "db.response.status_code": { + "$$exists": false + }, + "exception.message": { + "$$exists": false + }, + "exception.type": { + "$$exists": false + }, + "exception.stacktrace": { + "$$exists": false + }, + "server.address": { + "$$type": "string" + }, + "server.port": { + "$$type": [ + "int", + "long" + ] + }, + "server.type": { + "$$type": "string" + }, + "db.query.summary": "createIndexes", + "db.query.text": { + "$$matchAsDocument": { + "$$matchAsRoot": { + "createIndexes": "test", + "indexes": [ + { + "key": { + "x": 1 + } + } + ] + } + } + }, + "db.mongodb.server_connection_id": { + "$$type": [ + "int", + "long" + ] + }, + "db.mongodb.driver_connection_id": { + "$$type": [ + "int", + "long" + ] + } + } + } + ] + } + ] + } + } + ] +} diff --git a/source/open-telemetry/tests/operation/create_indexes.yml b/source/open-telemetry/tests/operation/create_indexes.yml new file mode 100644 index 0000000000..5a011dd794 --- /dev/null +++ b/source/open-telemetry/tests/operation/create_indexes.yml @@ -0,0 +1,61 @@ +description: operation create indexes +schemaVersion: '1.26' +createEntities: + - client: + id: &client0 client0 + useMultipleMongoses: false + observeTracingMessages: + enableCommandPayload: true + - database: + id: &database0 database0 + client: *client0 + databaseName: operation-create-indexes + - collection: + id: &collection0 collection0 + database: *database0 + collectionName: test +tests: + - description: create indexes + operations: + - object: *collection0 + name: createIndex + arguments: + keys: { x: 1 } + + expectTracingMessages: + client: *client0 + ignoreExtraSpans: false + spans: + - name: createIndexes operation-create-indexes.test + tags: + db.system: mongodb + db.namespace: operation-create-indexes + db.collection.name: test + db.operation.name: createIndexes + db.operation.summary: createIndexes operation-create-indexes.test + nested: + - name: command createIndexes + tags: + db.system: mongodb + db.namespace: operation-create-indexes + db.collection.name: operation-create-indexes.$cmd + db.command.name: createIndexes + network.transport: tcp + db.mongodb.cursor_id: { $$exists: false } + db.response.status_code: { $$exists: false } + exception.message: { $$exists: false } + exception.type: { $$exists: false } + exception.stacktrace: { $$exists: false } + server.address: { $$type: string } + server.port: { $$type: ['int', 'long'] } + server.type: { $$type: string } + db.query.summary: createIndexes + db.query.text: + $$matchAsDocument: + $$matchAsRoot: + createIndexes: test + indexes: [ { key: { x: 1 } } ] + db.mongodb.server_connection_id: + $$type: [ 'int', 'long' ] + db.mongodb.driver_connection_id: + $$type: [ 'int', 'long' ] diff --git a/source/open-telemetry/tests/operation/create_view.json b/source/open-telemetry/tests/operation/create_view.json new file mode 100644 index 0000000000..3d7dbe7f57 --- /dev/null +++ b/source/open-telemetry/tests/operation/create_view.json @@ -0,0 +1,138 @@ +{ + "description": "operation create view", + "schemaVersion": "1.26", + "createEntities": [ + { + "client": { + "id": "client0", + "useMultipleMongoses": false, + "observeTracingMessages": { + "enableCommandPayload": true + } + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "operation-create-view" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "test" + } + } + ], + "tests": [ + { + "description": "create view", + "operations": [ + { + "name": "createCollection", + "object": "database0", + "arguments": { + "collection": "my_view", + "viewOn": "test", + "pipeline": [ + { + "$match": { + "_id": { + "$gt": 1 + } + } + } + ] + } + } + ], + "expectTracingMessages": { + "client": "client0", + "ignoreExtraSpans": false, + "spans": [ + { + "name": "createView operation-create-view.my_view", + "tags": { + "db.system": "mongodb", + "db.namespace": "operation-create-view", + "db.collection.name": "my_view", + "db.operation.name": "createView", + "db.operation.summary": "createView operation-create-view.my_view" + }, + "nested": [ + { + "name": "command create", + "tags": { + "db.system": "mongodb", + "db.namespace": "operation-create-view", + "db.collection.name": "operation-create-view.$cmd", + "db.command.name": "create", + "network.transport": "tcp", + "db.mongodb.cursor_id": { + "$$exists": false + }, + "db.response.status_code": { + "$$exists": false + }, + "exception.message": { + "$$exists": false + }, + "exception.type": { + "$$exists": false + }, + "exception.stacktrace": { + "$$exists": false + }, + "server.address": { + "$$type": "string" + }, + "server.port": { + "$$type": [ + "int", + "long" + ] + }, + "server.type": { + "$$type": "string" + }, + "db.query.summary": "create", + "db.query.text": { + "$$matchAsDocument": { + "$$matchAsRoot": { + "create": "my_view", + "viewOn": "test", + "pipeline": [ + { + "$match": { + "_id": { + "$gt": 1 + } + } + } + ] + } + } + }, + "db.mongodb.server_connection_id": { + "$$type": [ + "int", + "long" + ] + }, + "db.mongodb.driver_connection_id": { + "$$type": [ + "int", + "long" + ] + } + } + } + ] + } + ] + } + } + ] +} diff --git a/source/open-telemetry/tests/operation/create_view.yml b/source/open-telemetry/tests/operation/create_view.yml new file mode 100644 index 0000000000..feb5a67b61 --- /dev/null +++ b/source/open-telemetry/tests/operation/create_view.yml @@ -0,0 +1,65 @@ +description: operation create view +schemaVersion: '1.26' +createEntities: + - client: + id: &client0 client0 + useMultipleMongoses: false + observeTracingMessages: + enableCommandPayload: true + - database: + id: &database0 database0 + client: *client0 + databaseName: operation-create-view + - collection: + id: collection0 + database: *database0 + collectionName: &collection_name test +tests: + - description: create view + operations: + - name: createCollection + object: *database0 + arguments: + collection: my_view + viewOn: *collection_name + pipeline: &pipeline + - { $match: { _id: { $gt: 1 } } } + + expectTracingMessages: + client: *client0 + ignoreExtraSpans: false + spans: + - name: createView operation-create-view.my_view + tags: + db.system: mongodb + db.namespace: operation-create-view + db.collection.name: my_view + db.operation.name: createView + db.operation.summary: createView operation-create-view.my_view + nested: + - name: command create + tags: + db.system: mongodb + db.namespace: operation-create-view + db.collection.name: operation-create-view.$cmd + db.command.name: create + network.transport: tcp + db.mongodb.cursor_id: { $$exists: false } + db.response.status_code: { $$exists: false } + exception.message: { $$exists: false } + exception.type: { $$exists: false } + exception.stacktrace: { $$exists: false } + server.address: { $$type: string } + server.port: { $$type: ['int', 'long'] } + server.type: { $$type: string } + db.query.summary: create + db.query.text: + $$matchAsDocument: + $$matchAsRoot: + create: my_view + viewOn: test + pipeline: *pipeline + db.mongodb.server_connection_id: + $$type: [ 'int', 'long' ] + db.mongodb.driver_connection_id: + $$type: [ 'int', 'long' ] diff --git a/source/open-telemetry/tests/operation/delete.json b/source/open-telemetry/tests/operation/delete.json new file mode 100644 index 0000000000..80f780e905 --- /dev/null +++ b/source/open-telemetry/tests/operation/delete.json @@ -0,0 +1,103 @@ +{ + "description": "operation delete", + "schemaVersion": "1.26", + "createEntities": [ + { + "client": { + "id": "client0", + "useMultipleMongoses": false, + "observeTracingMessages": { + "enableCommandPayload": true + } + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "operation-delete" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "test" + } + } + ], + "tests": [ + { + "description": "delete elements", + "operations": [ + { + "object": "collection0", + "name": "deleteMany", + "arguments": { + "filter": { + "_id": { + "$gt": 1 + } + } + } + } + ], + "expectTracingMessages": { + "client": "client0", + "ignoreExtraSpans": false, + "spans": [ + { + "name": "delete operation-delete.test", + "tags": { + "db.system": "mongodb", + "db.namespace": "operation-delete", + "db.collection.name": "test", + "db.operation.name": "delete", + "db.operation.summary": "delete operation-delete.test" + }, + "nested": [ + { + "name": "command delete", + "tags": { + "db.system": "mongodb", + "db.namespace": "operation-delete", + "server.address": { + "$$type": "string" + }, + "server.port": { + "$$type": [ + "long", + "string" + ] + }, + "server.type": { + "$$type": "string" + }, + "db.query.summary": "delete", + "db.query.text": { + "$$matchAsDocument": { + "$$matchAsRoot": { + "delete": "test", + "ordered": true, + "deletes": [ + { + "q": { + "_id": { + "$gt": 1 + } + }, + "limit": 0 + } + ] + } + } + } + } + } + ] + } + ] + } + } + ] +} diff --git a/source/open-telemetry/tests/operation/delete.yml b/source/open-telemetry/tests/operation/delete.yml new file mode 100644 index 0000000000..6b68324420 --- /dev/null +++ b/source/open-telemetry/tests/operation/delete.yml @@ -0,0 +1,51 @@ +description: operation delete +schemaVersion: '1.26' +createEntities: + - client: + id: &client0 client0 + useMultipleMongoses: false + observeTracingMessages: + enableCommandPayload: true + - database: + id: &database0 database0 + client: *client0 + databaseName: operation-delete + - collection: + id: &collection0 collection0 + database: *database0 + collectionName: test + +tests: + - description: delete elements + operations: + - object: *collection0 + name: deleteMany + arguments: + filter: { _id: { $gt: 1 } } + + expectTracingMessages: + client: *client0 + ignoreExtraSpans: false + spans: + - name: delete operation-delete.test + tags: + db.system: mongodb + db.namespace: operation-delete + db.collection.name: test + db.operation.name: delete + db.operation.summary: delete operation-delete.test + nested: + - name: command delete + tags: + db.system: mongodb + db.namespace: operation-delete + server.address: { $$type: string } + server.port: { $$type: [ 'long', 'string' ] } + server.type: { $$type: string } + db.query.summary: delete + db.query.text: + $$matchAsDocument: + $$matchAsRoot: + delete: test + ordered: true + deletes: [ { q: { _id: { $gt: 1 } }, limit: 0 } ] diff --git a/source/open-telemetry/tests/operation/distinct.json b/source/open-telemetry/tests/operation/distinct.json new file mode 100644 index 0000000000..cc9c9630da --- /dev/null +++ b/source/open-telemetry/tests/operation/distinct.json @@ -0,0 +1,127 @@ +{ + "description": "operation distinct", + "schemaVersion": "1.26", + "createEntities": [ + { + "client": { + "id": "client0", + "useMultipleMongoses": false, + "observeTracingMessages": { + "enableCommandPayload": true + } + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "operation-distinct" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "test" + } + } + ], + "initialData": [ + { + "collectionName": "test", + "databaseName": "operation-distinct", + "documents": [] + } + ], + "tests": [ + { + "description": "distinct on a field", + "operations": [ + { + "object": "collection0", + "name": "distinct", + "arguments": { + "fieldName": "x" + } + } + ], + "expectTracingMessages": { + "client": "client0", + "ignoreExtraSpans": false, + "spans": [ + { + "name": "distinct operation-distinct.test", + "tags": { + "db.system": "mongodb", + "db.namespace": "operation-distinct", + "db.collection.name": "test", + "db.operation.name": "distinct", + "db.operation.summary": "distinct operation-distinct.test" + }, + "nested": [ + { + "name": "command distinct", + "tags": { + "db.system": "mongodb", + "db.namespace": "operation-distinct", + "db.collection.name": "operation-distinct.$cmd", + "db.command.name": "distinct", + "network.transport": "tcp", + "db.mongodb.cursor_id": { + "$$exists": false + }, + "db.response.status_code": { + "$$exists": false + }, + "exception.message": { + "$$exists": false + }, + "exception.type": { + "$$exists": false + }, + "exception.stacktrace": { + "$$exists": false + }, + "server.address": { + "$$type": "string" + }, + "server.port": { + "$$type": [ + "int", + "long" + ] + }, + "server.type": { + "$$type": "string" + }, + "db.query.summary": "distinct", + "db.query.text": { + "$$matchAsDocument": { + "$$matchAsRoot": { + "distinct": "test", + "key": "x", + "query": {} + } + } + }, + "db.mongodb.server_connection_id": { + "$$type": [ + "int", + "long" + ] + }, + "db.mongodb.driver_connection_id": { + "$$type": [ + "int", + "long" + ] + } + } + } + ] + } + ] + } + } + ] +} diff --git a/source/open-telemetry/tests/operation/distinct.yml b/source/open-telemetry/tests/operation/distinct.yml new file mode 100644 index 0000000000..d4bf6d576a --- /dev/null +++ b/source/open-telemetry/tests/operation/distinct.yml @@ -0,0 +1,65 @@ +description: operation distinct +schemaVersion: '1.26' +createEntities: + - client: + id: &client0 client0 + useMultipleMongoses: false + observeTracingMessages: + enableCommandPayload: true + - database: + id: database0 + client: *client0 + databaseName: operation-distinct + - collection: + id: &collection0 collection0 + database: database0 + collectionName: test +initialData: + - collectionName: test + databaseName: operation-distinct + documents: [] +tests: + - description: distinct on a field + operations: + - object: *collection0 + name: distinct + arguments: { fieldName: x } + + expectTracingMessages: + client: *client0 + ignoreExtraSpans: false + spans: + - name: distinct operation-distinct.test + tags: + db.system: mongodb + db.namespace: operation-distinct + db.collection.name: test + db.operation.name: distinct + db.operation.summary: distinct operation-distinct.test + nested: + - name: command distinct + tags: + db.system: mongodb + db.namespace: operation-distinct + db.collection.name: operation-distinct.$cmd + db.command.name: distinct + network.transport: tcp + db.mongodb.cursor_id: { $$exists: false } + db.response.status_code: { $$exists: false } + exception.message: { $$exists: false } + exception.type: { $$exists: false } + exception.stacktrace: { $$exists: false } + server.address: { $$type: string } + server.port: { $$type: ['int', 'long'] } + server.type: { $$type: string } + db.query.summary: distinct + db.query.text: + $$matchAsDocument: + $$matchAsRoot: + distinct: test + key: x + query: { } + db.mongodb.server_connection_id: + $$type: [ 'int', 'long' ] + db.mongodb.driver_connection_id: + $$type: [ 'int', 'long' ] diff --git a/source/open-telemetry/tests/operation/drop_collection.json b/source/open-telemetry/tests/operation/drop_collection.json new file mode 100644 index 0000000000..04d74f852f --- /dev/null +++ b/source/open-telemetry/tests/operation/drop_collection.json @@ -0,0 +1,118 @@ +{ + "description": "operation drop collection", + "schemaVersion": "1.26", + "createEntities": [ + { + "client": { + "id": "client0", + "useMultipleMongoses": false, + "observeTracingMessages": { + "enableCommandPayload": true + } + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "operation-drop-collection" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "test" + } + } + ], + "tests": [ + { + "description": "drop collection", + "operations": [ + { + "object": "database0", + "name": "dropCollection", + "arguments": { + "collection": "test" + } + } + ], + "expectTracingMessages": { + "client": "client0", + "ignoreExtraSpans": false, + "spans": [ + { + "name": "dropCollection operation-drop-collection.test", + "tags": { + "db.system": "mongodb", + "db.namespace": "operation-drop-collection", + "db.collection.name": "test", + "db.operation.name": "dropCollection", + "db.operation.summary": "dropCollection operation-drop-collection.test" + }, + "nested": [ + { + "name": "command drop", + "tags": { + "db.system": "mongodb", + "db.namespace": "operation-drop-collection", + "db.collection.name": "operation-drop-collection.$cmd", + "db.command.name": "drop", + "network.transport": "tcp", + "db.mongodb.cursor_id": { + "$$exists": false + }, + "db.response.status_code": { + "$$exists": false + }, + "exception.message": { + "$$exists": false + }, + "exception.type": { + "$$exists": false + }, + "exception.stacktrace": { + "$$exists": false + }, + "server.address": { + "$$type": "string" + }, + "server.port": { + "$$type": [ + "int", + "long" + ] + }, + "server.type": { + "$$type": "string" + }, + "db.query.summary": "drop", + "db.query.text": { + "$$matchAsDocument": { + "$$matchAsRoot": { + "drop": "test" + } + } + }, + "db.mongodb.server_connection_id": { + "$$type": [ + "int", + "long" + ] + }, + "db.mongodb.driver_connection_id": { + "$$type": [ + "int", + "long" + ] + } + } + } + ] + } + ] + } + } + ] +} diff --git a/source/open-telemetry/tests/operation/drop_collection.yml b/source/open-telemetry/tests/operation/drop_collection.yml new file mode 100644 index 0000000000..f1335c75c4 --- /dev/null +++ b/source/open-telemetry/tests/operation/drop_collection.yml @@ -0,0 +1,61 @@ +description: operation drop collection +schemaVersion: '1.26' +createEntities: + - client: + id: &client0 client0 + useMultipleMongoses: false + observeTracingMessages: + enableCommandPayload: true + - database: + id: &database0 database0 + client: *client0 + databaseName: operation-drop-collection + + - collection: + id: collection0 + database: *database0 + collectionName: &collection_name test +tests: + - description: drop collection + operations: + - object: *database0 + name: dropCollection + arguments: + collection: *collection_name + + expectTracingMessages: + client: *client0 + ignoreExtraSpans: false + spans: + - name: dropCollection operation-drop-collection.test + tags: + db.system: mongodb + db.namespace: operation-drop-collection + db.collection.name: test + db.operation.name: dropCollection + db.operation.summary: dropCollection operation-drop-collection.test + nested: + - name: command drop + tags: + db.system: mongodb + db.namespace: operation-drop-collection + db.collection.name: operation-drop-collection.$cmd + db.command.name: drop + network.transport: tcp + db.mongodb.cursor_id: { $$exists: false } + db.response.status_code: { $$exists: false } + exception.message: { $$exists: false } + exception.type: { $$exists: false } + exception.stacktrace: { $$exists: false } + server.address: { $$type: string } + server.port: { $$type: ['int', 'long'] } + server.type: { $$type: string } + db.query.summary: drop + db.query.text: + $$matchAsDocument: + $$matchAsRoot: + drop: test + db.mongodb.server_connection_id: + $$type: [ 'int', 'long' ] + db.mongodb.driver_connection_id: + $$type: [ 'int', 'long' ] diff --git a/source/open-telemetry/tests/operation/drop_indexes.json b/source/open-telemetry/tests/operation/drop_indexes.json new file mode 100644 index 0000000000..006db8ea0c --- /dev/null +++ b/source/open-telemetry/tests/operation/drop_indexes.json @@ -0,0 +1,126 @@ +{ + "description": "operation drop indexes", + "schemaVersion": "1.26", + "createEntities": [ + { + "client": { + "id": "client0", + "useMultipleMongoses": false, + "observeTracingMessages": { + "enableCommandPayload": true + } + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "operation-drop-indexes" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "test" + } + } + ], + "tests": [ + { + "description": "drop indexes", + "operations": [ + { + "name": "createIndex", + "object": "collection0", + "arguments": { + "keys": { + "x": 1 + }, + "name": "x_1" + } + }, + { + "name": "dropIndexes", + "object": "collection0" + } + ], + "expectTracingMessages": { + "client": "client0", + "ignoreExtraSpans": true, + "spans": [ + { + "name": "dropIndexes operation-drop-indexes.test", + "tags": { + "db.system": "mongodb", + "db.namespace": "operation-drop-indexes", + "db.collection.name": "test", + "db.operation.name": "dropIndexes", + "db.operation.summary": "dropIndexes operation-drop-indexes.test" + }, + "nested": [ + { + "name": "command dropIndexes", + "tags": { + "db.system": "mongodb", + "db.namespace": "operation-drop-indexes", + "db.collection.name": "operation-drop-indexes.$cmd", + "db.command.name": "dropIndexes", + "network.transport": "tcp", + "db.mongodb.cursor_id": { + "$$exists": false + }, + "db.response.status_code": { + "$$exists": false + }, + "exception.message": { + "$$exists": false + }, + "exception.type": { + "$$exists": false + }, + "exception.stacktrace": { + "$$exists": false + }, + "server.address": { + "$$type": "string" + }, + "server.port": { + "$$type": [ + "int", + "long" + ] + }, + "server.type": { + "$$type": "string" + }, + "db.query.summary": "dropIndexes", + "db.query.text": { + "$$matchAsDocument": { + "$$matchAsRoot": { + "dropIndexes": "test", + "index": "*" + } + } + }, + "db.mongodb.server_connection_id": { + "$$type": [ + "int", + "long" + ] + }, + "db.mongodb.driver_connection_id": { + "$$type": [ + "int", + "long" + ] + } + } + } + ] + } + ] + } + } + ] +} diff --git a/source/open-telemetry/tests/operation/drop_indexes.yml b/source/open-telemetry/tests/operation/drop_indexes.yml new file mode 100644 index 0000000000..117a428863 --- /dev/null +++ b/source/open-telemetry/tests/operation/drop_indexes.yml @@ -0,0 +1,68 @@ +description: operation drop indexes +schemaVersion: '1.26' +createEntities: + - client: + id: &client0 client0 + useMultipleMongoses: false + observeTracingMessages: + enableCommandPayload: true + - database: + id: &database0 database0 + client: *client0 + databaseName: operation-drop-indexes + - collection: + id: &collection0 collection0 + database: *database0 + collectionName: test + +tests: + - description: drop indexes + operations: + - name: createIndex + object: *collection0 + arguments: + keys: + x: 1 + name: x_1 + + - name: dropIndexes + object: *collection0 + + + expectTracingMessages: + client: *client0 + ignoreExtraSpans: true + spans: + - name: dropIndexes operation-drop-indexes.test + tags: + db.system: mongodb + db.namespace: operation-drop-indexes + db.collection.name: test + db.operation.name: dropIndexes + db.operation.summary: dropIndexes operation-drop-indexes.test + nested: + - name: command dropIndexes + tags: + db.system: mongodb + db.namespace: operation-drop-indexes + db.collection.name: operation-drop-indexes.$cmd + db.command.name: dropIndexes + network.transport: tcp + db.mongodb.cursor_id: { $$exists: false } + db.response.status_code: { $$exists: false } + exception.message: { $$exists: false } + exception.type: { $$exists: false } + exception.stacktrace: { $$exists: false } + server.address: { $$type: string } + server.port: { $$type: ['int', 'long'] } + server.type: { $$type: string } + db.query.summary: dropIndexes + db.query.text: + $$matchAsDocument: + $$matchAsRoot: + dropIndexes: test + index: '*' + db.mongodb.server_connection_id: + $$type: [ 'int', 'long' ] + db.mongodb.driver_connection_id: + $$type: [ 'int', 'long' ] diff --git a/source/open-telemetry/tests/operation/find_one_and_update.json b/source/open-telemetry/tests/operation/find_one_and_update.json new file mode 100644 index 0000000000..b33c84095b --- /dev/null +++ b/source/open-telemetry/tests/operation/find_one_and_update.json @@ -0,0 +1,139 @@ +{ + "description": "operation findOneAndUpdate", + "schemaVersion": "1.26", + "createEntities": [ + { + "client": { + "id": "client0", + "useMultipleMongoses": false, + "observeTracingMessages": { + "enableCommandPayload": true + } + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "operation-aggregate" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "test" + } + } + ], + "tests": [ + { + "description": "findOneAndUpdate", + "operations": [ + { + "name": "findOneAndUpdate", + "object": "collection0", + "arguments": { + "filter": { + "_id": 1 + }, + "update": [ + { + "$set": { + "x": 5 + } + } + ], + "comment": "comment" + } + } + ], + "expectTracingMessages": { + "client": "client0", + "ignoreExtraSpans": false, + "spans": [ + { + "name": "findAndModify operation-aggregate.test", + "tags": { + "db.system": "mongodb", + "db.namespace": "operation-aggregate", + "db.collection.name": "test", + "db.operation.name": "findAndModify", + "db.operation.summary": "findAndModify operation-aggregate.test" + }, + "nested": [ + { + "name": "command findAndModify", + "tags": { + "db.system": "mongodb", + "db.namespace": "operation-aggregate", + "db.collection.name": "operation-aggregate.$cmd", + "db.command.name": "findAndModify", + "network.transport": "tcp", + "db.mongodb.cursor_id": { + "$$exists": false + }, + "db.response.status_code": { + "$$exists": false + }, + "exception.message": { + "$$exists": false + }, + "exception.type": { + "$$exists": false + }, + "exception.stacktrace": { + "$$exists": false + }, + "server.address": { + "$$type": "string" + }, + "server.port": { + "$$type": [ + "int", + "long" + ] + }, + "server.type": { + "$$type": "string" + }, + "db.query.summary": "findAndModify", + "db.query.text": { + "$$matchAsDocument": { + "$$matchAsRoot": { + "findAndModify": "test", + "query": { + "_id": 1 + }, + "update": [ + { + "$set": { + "x": 5 + } + } + ], + "comment": "comment" + } + } + }, + "db.mongodb.server_connection_id": { + "$$type": [ + "int", + "long" + ] + }, + "db.mongodb.driver_connection_id": { + "$$type": [ + "int", + "long" + ] + } + } + } + ] + } + ] + } + } + ] +} diff --git a/source/open-telemetry/tests/operation/find_one_and_update.yml b/source/open-telemetry/tests/operation/find_one_and_update.yml new file mode 100644 index 0000000000..72e55f3ef5 --- /dev/null +++ b/source/open-telemetry/tests/operation/find_one_and_update.yml @@ -0,0 +1,68 @@ +description: operation findOneAndUpdate +schemaVersion: '1.26' +createEntities: + - client: + id: &client0 client0 + useMultipleMongoses: false + observeTracingMessages: + enableCommandPayload: true + - database: + id: &database0 database0 + client: *client0 + databaseName: operation-aggregate + - collection: + id: &collection0 collection0 + database: *database0 + collectionName: test + +tests: + - description: findOneAndUpdate + operations: + - name: findOneAndUpdate + object: *collection0 + arguments: + filter: &filter + _id: 1 + update: &update + - $set: {x: 5 } + comment: "comment" + + expectTracingMessages: + client: *client0 + ignoreExtraSpans: false + spans: + - name: findAndModify operation-aggregate.test + tags: + db.system: mongodb + db.namespace: operation-aggregate + db.collection.name: test + db.operation.name: findAndModify + db.operation.summary: findAndModify operation-aggregate.test + nested: + - name: command findAndModify + tags: + db.system: mongodb + db.namespace: operation-aggregate + db.collection.name: operation-aggregate.$cmd + db.command.name: findAndModify + network.transport: tcp + db.mongodb.cursor_id: { $$exists: false } + db.response.status_code: { $$exists: false } + exception.message: { $$exists: false } + exception.type: { $$exists: false } + exception.stacktrace: { $$exists: false } + server.address: { $$type: string } + server.port: { $$type: ['int', 'long'] } + server.type: { $$type: string } + db.query.summary: findAndModify + db.query.text: + $$matchAsDocument: + $$matchAsRoot: + findAndModify: test + query: *filter + update: *update + comment: "comment" + db.mongodb.server_connection_id: + $$type: [ 'int', 'long' ] + db.mongodb.driver_connection_id: + $$type: [ 'int', 'long' ] diff --git a/source/open-telemetry/tests/operation/list_collections.json b/source/open-telemetry/tests/operation/list_collections.json new file mode 100644 index 0000000000..7add74857e --- /dev/null +++ b/source/open-telemetry/tests/operation/list_collections.json @@ -0,0 +1,109 @@ +{ + "description": "operation list collections", + "schemaVersion": "1.26", + "createEntities": [ + { + "client": { + "id": "client0", + "useMultipleMongoses": false, + "observeTracingMessages": { + "enableCommandPayload": true + } + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "operation-list-collections" + } + } + ], + "tests": [ + { + "description": "List collections", + "operations": [ + { + "object": "database0", + "name": "listCollections" + } + ], + "expectTracingMessages": { + "client": "client0", + "ignoreExtraSpans": false, + "spans": [ + { + "name": "listCollections operation-list-collections.$cmd", + "tags": { + "db.system": "mongodb", + "db.namespace": "operation-list-collections", + "db.collection.name": "$cmd", + "db.operation.name": "listCollections", + "db.operation.summary": "listCollections operation-list-collections.$cmd" + }, + "nested": [ + { + "name": "command listCollections", + "tags": { + "db.system": "mongodb", + "db.namespace": "operation-list-collections", + "db.collection.name": "operation-list-collections.$cmd", + "db.command.name": "listCollections", + "network.transport": "tcp", + "db.mongodb.cursor_id": { + "$$exists": false + }, + "db.response.status_code": { + "$$exists": false + }, + "exception.message": { + "$$exists": false + }, + "exception.type": { + "$$exists": false + }, + "exception.stacktrace": { + "$$exists": false + }, + "server.address": { + "$$type": "string" + }, + "server.port": { + "$$type": [ + "int", + "long" + ] + }, + "server.type": { + "$$type": "string" + }, + "db.query.summary": "listCollections", + "db.query.text": { + "$$matchAsDocument": { + "$$matchAsRoot": { + "listCollections": 1, + "cursor": {} + } + } + }, + "db.mongodb.server_connection_id": { + "$$type": [ + "int", + "long" + ] + }, + "db.mongodb.driver_connection_id": { + "$$type": [ + "int", + "long" + ] + } + } + } + ] + } + ] + } + } + ] +} diff --git a/source/open-telemetry/tests/operation/list_collections.yml b/source/open-telemetry/tests/operation/list_collections.yml new file mode 100644 index 0000000000..0280fa90ee --- /dev/null +++ b/source/open-telemetry/tests/operation/list_collections.yml @@ -0,0 +1,55 @@ +description: operation list collections +schemaVersion: '1.26' +createEntities: + - client: + id: &client0 client0 + useMultipleMongoses: false + observeTracingMessages: + enableCommandPayload: true + - database: + id: &database0 database0 + client: *client0 + databaseName: operation-list-collections +tests: + - description: List collections + operations: + - object: *database0 + name: listCollections + + expectTracingMessages: + client: *client0 + ignoreExtraSpans: false + spans: + - name: listCollections operation-list-collections.$cmd + tags: + db.system: mongodb + db.namespace: operation-list-collections + db.collection.name: $cmd + db.operation.name: listCollections + db.operation.summary: listCollections operation-list-collections.$cmd + nested: + - name: command listCollections + tags: + db.system: mongodb + db.namespace: operation-list-collections + db.collection.name: operation-list-collections.$cmd + db.command.name: listCollections + network.transport: tcp + db.mongodb.cursor_id: { $$exists: false } + db.response.status_code: { $$exists: false } + exception.message: { $$exists: false } + exception.type: { $$exists: false } + exception.stacktrace: { $$exists: false } + server.address: { $$type: string } + server.port: { $$type: ['int', 'long'] } + server.type: { $$type: string } + db.query.summary: listCollections + db.query.text: + $$matchAsDocument: + $$matchAsRoot: + listCollections: 1 + cursor: {} + db.mongodb.server_connection_id: + $$type: [ 'int', 'long' ] + db.mongodb.driver_connection_id: + $$type: [ 'int', 'long' ] diff --git a/source/open-telemetry/tests/operation/list_databases.json b/source/open-telemetry/tests/operation/list_databases.json new file mode 100644 index 0000000000..4b8d48b562 --- /dev/null +++ b/source/open-telemetry/tests/operation/list_databases.json @@ -0,0 +1,101 @@ +{ + "description": "operation list databases", + "schemaVersion": "1.26", + "createEntities": [ + { + "client": { + "id": "client0", + "useMultipleMongoses": false, + "observeTracingMessages": { + "enableCommandPayload": true + } + } + } + ], + "tests": [ + { + "description": "list databases", + "operations": [ + { + "object": "client0", + "name": "listDatabases" + } + ], + "expectTracingMessages": { + "client": "client0", + "ignoreExtraSpans": false, + "spans": [ + { + "name": "listDatabases admin.$cmd", + "tags": { + "db.system": "mongodb", + "db.namespace": "admin", + "db.collection.name": "$cmd", + "db.operation.name": "listDatabases", + "db.operation.summary": "listDatabases admin.$cmd" + }, + "nested": [ + { + "name": "command listDatabases", + "tags": { + "db.system": "mongodb", + "db.namespace": "admin", + "db.collection.name": "admin.$cmd", + "db.command.name": "listDatabases", + "network.transport": "tcp", + "db.mongodb.cursor_id": { + "$$exists": false + }, + "db.response.status_code": { + "$$exists": false + }, + "exception.message": { + "$$exists": false + }, + "exception.type": { + "$$exists": false + }, + "exception.stacktrace": { + "$$exists": false + }, + "server.address": { + "$$type": "string" + }, + "server.port": { + "$$type": [ + "int", + "long" + ] + }, + "server.type": { + "$$type": "string" + }, + "db.query.summary": "listDatabases", + "db.query.text": { + "$$matchAsDocument": { + "$$matchAsRoot": { + "listDatabases": 1 + } + } + }, + "db.mongodb.server_connection_id": { + "$$type": [ + "int", + "long" + ] + }, + "db.mongodb.driver_connection_id": { + "$$type": [ + "int", + "long" + ] + } + } + } + ] + } + ] + } + } + ] +} diff --git a/source/open-telemetry/tests/operation/list_databases.yml b/source/open-telemetry/tests/operation/list_databases.yml new file mode 100644 index 0000000000..471d7e7390 --- /dev/null +++ b/source/open-telemetry/tests/operation/list_databases.yml @@ -0,0 +1,50 @@ +description: operation list databases +schemaVersion: '1.26' +createEntities: + - client: + id: &client0 client0 + useMultipleMongoses: false + observeTracingMessages: + enableCommandPayload: true +tests: + - description: list databases + operations: + - object: *client0 + name: listDatabases + + expectTracingMessages: + client: *client0 + ignoreExtraSpans: false + spans: + - name: listDatabases admin.$cmd + tags: + db.system: mongodb + db.namespace: admin + db.collection.name: $cmd + db.operation.name: listDatabases + db.operation.summary: listDatabases admin.$cmd + nested: + - name: command listDatabases + tags: + db.system: mongodb + db.namespace: admin + db.collection.name: admin.$cmd + db.command.name: listDatabases + network.transport: tcp + db.mongodb.cursor_id: { $$exists: false } + db.response.status_code: { $$exists: false } + exception.message: { $$exists: false } + exception.type: { $$exists: false } + exception.stacktrace: { $$exists: false } + server.address: { $$type: string } + server.port: { $$type: ['int', 'long'] } + server.type: { $$type: string } + db.query.summary: listDatabases + db.query.text: + $$matchAsDocument: + $$matchAsRoot: + listDatabases: 1 + db.mongodb.server_connection_id: + $$type: [ 'int', 'long' ] + db.mongodb.driver_connection_id: + $$type: [ 'int', 'long' ] diff --git a/source/open-telemetry/tests/operation/list_indexes.json b/source/open-telemetry/tests/operation/list_indexes.json new file mode 100644 index 0000000000..10ddf3ab25 --- /dev/null +++ b/source/open-telemetry/tests/operation/list_indexes.json @@ -0,0 +1,122 @@ +{ + "description": "operation list indexes", + "schemaVersion": "1.26", + "createEntities": [ + { + "client": { + "id": "client0", + "useMultipleMongoses": false, + "observeTracingMessages": { + "enableCommandPayload": true + } + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "operation-list-indexes" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "test" + } + } + ], + "initialData": [ + { + "collectionName": "test", + "databaseName": "operation-list-indexes", + "documents": [] + } + ], + "tests": [ + { + "description": "List indexes", + "operations": [ + { + "object": "collection0", + "name": "listIndexes" + } + ], + "expectTracingMessages": { + "client": "client0", + "ignoreExtraSpans": false, + "spans": [ + { + "name": "listIndexes operation-list-indexes.test", + "tags": { + "db.system": "mongodb", + "db.namespace": "operation-list-indexes", + "db.collection.name": "test", + "db.operation.name": "listIndexes", + "db.operation.summary": "listIndexes operation-list-indexes.test" + }, + "nested": [ + { + "name": "command listIndexes", + "tags": { + "db.system": "mongodb", + "db.namespace": "operation-list-indexes", + "db.collection.name": "operation-list-indexes.$cmd", + "db.command.name": "listIndexes", + "network.transport": "tcp", + "db.mongodb.cursor_id": { + "$$exists": false + }, + "db.response.status_code": { + "$$exists": false + }, + "exception.message": { + "$$exists": false + }, + "exception.type": { + "$$exists": false + }, + "exception.stacktrace": { + "$$exists": false + }, + "server.address": { + "$$type": "string" + }, + "server.port": { + "$$type": [ + "int", + "long" + ] + }, + "server.type": { + "$$type": "string" + }, + "db.query.summary": "listIndexes", + "db.query.text": { + "$$matchAsDocument": { + "$$matchAsRoot": { + "listIndexes": "test" + } + } + }, + "db.mongodb.server_connection_id": { + "$$type": [ + "int", + "long" + ] + }, + "db.mongodb.driver_connection_id": { + "$$type": [ + "int", + "long" + ] + } + } + } + ] + } + ] + } + } + ] +} diff --git a/source/open-telemetry/tests/operation/list_indexes.yml b/source/open-telemetry/tests/operation/list_indexes.yml new file mode 100644 index 0000000000..f7796e07da --- /dev/null +++ b/source/open-telemetry/tests/operation/list_indexes.yml @@ -0,0 +1,62 @@ +description: operation list indexes +schemaVersion: '1.26' +createEntities: + - client: + id: &client0 client0 + useMultipleMongoses: false + observeTracingMessages: + enableCommandPayload: true + - database: + id: &database0 database0 + client: *client0 + databaseName: operation-list-indexes + - collection: + id: &collection0 collection0 + database: database0 + collectionName: test +initialData: + - collectionName: test + databaseName: operation-list-indexes + documents: [] +tests: + - description: List indexes + operations: + - object: *collection0 + name: listIndexes + + expectTracingMessages: + client: *client0 + ignoreExtraSpans: false + spans: + - name: listIndexes operation-list-indexes.test + tags: + db.system: mongodb + db.namespace: operation-list-indexes + db.collection.name: test + db.operation.name: listIndexes + db.operation.summary: listIndexes operation-list-indexes.test + nested: + - name: command listIndexes + tags: + db.system: mongodb + db.namespace: operation-list-indexes + db.collection.name: operation-list-indexes.$cmd + db.command.name: listIndexes + network.transport: tcp + db.mongodb.cursor_id: { $$exists: false } + db.response.status_code: { $$exists: false } + exception.message: { $$exists: false } + exception.type: { $$exists: false } + exception.stacktrace: { $$exists: false } + server.address: { $$type: string } + server.port: { $$type: ['int', 'long'] } + server.type: { $$type: string } + db.query.summary: listIndexes + db.query.text: + $$matchAsDocument: + $$matchAsRoot: + listIndexes: test + db.mongodb.server_connection_id: + $$type: [ 'int', 'long' ] + db.mongodb.driver_connection_id: + $$type: [ 'int', 'long' ] diff --git a/source/open-telemetry/tests/operation/map_reduce.json b/source/open-telemetry/tests/operation/map_reduce.json new file mode 100644 index 0000000000..705973e754 --- /dev/null +++ b/source/open-telemetry/tests/operation/map_reduce.json @@ -0,0 +1,178 @@ +{ + "description": "operation map_reduce", + "schemaVersion": "1.26", + "runOnRequirements": [ + { + "minServerVersion": "4.0", + "topologies": [ + "single", + "replicaset" + ] + }, + { + "minServerVersion": "4.1.7", + "serverless": "forbid", + "topologies": [ + "sharded", + "load-balanced" + ] + } + ], + "createEntities": [ + { + "client": { + "id": "client0", + "useMultipleMongoses": false, + "observeTracingMessages": { + "enableCommandPayload": true + } + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "operation-map-reduce" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "test" + } + } + ], + "initialData": [ + { + "collectionName": "test", + "databaseName": "operation-map-reduce", + "documents": [ + { + "_id": 1, + "x": 0 + }, + { + "_id": 2, + "x": 1 + }, + { + "_id": 3, + "x": 2 + } + ] + } + ], + "tests": [ + { + "description": "mapReduce", + "operations": [ + { + "object": "collection0", + "name": "mapReduce", + "arguments": { + "map": { + "$code": "function inc() { return emit(0, this.x + 1) }" + }, + "reduce": { + "$code": "function sum(key, values) { return values.reduce((acc, x) => acc + x); }" + }, + "out": { + "inline": 1 + } + }, + "expectResult": [ + { + "_id": 0, + "value": 6 + } + ] + } + ], + "expectTracingMessages": { + "client": "client0", + "ignoreExtraSpans": false, + "spans": [ + { + "name": "mapReduce operation-map-reduce.test", + "tags": { + "db.system": "mongodb", + "db.namespace": "operation-map-reduce", + "db.collection.name": "test", + "db.operation.name": "mapReduce", + "db.operation.summary": "mapReduce operation-map-reduce.test" + }, + "nested": [ + { + "name": "command mapReduce", + "tags": { + "db.system": "mongodb", + "db.namespace": "operation-map-reduce", + "db.collection.name": "operation-map-reduce.$cmd", + "db.command.name": "mapReduce", + "network.transport": "tcp", + "db.mongodb.cursor_id": { + "$$exists": false + }, + "db.response.status_code": { + "$$exists": false + }, + "exception.message": { + "$$exists": false + }, + "exception.type": { + "$$exists": false + }, + "exception.stacktrace": { + "$$exists": false + }, + "server.address": { + "$$type": "string" + }, + "server.port": { + "$$type": [ + "int", + "long" + ] + }, + "server.type": { + "$$type": "string" + }, + "db.query.summary": "mapReduce", + "db.query.text": { + "$$matchAsDocument": { + "$$matchAsRoot": { + "mapReduce": "test", + "map": { + "$code": "function inc() { return emit(0, this.x + 1) }" + }, + "reduce": { + "$code": "function sum(key, values) { return values.reduce((acc, x) => acc + x); }" + }, + "out": { + "inline": 1 + } + } + } + }, + "db.mongodb.server_connection_id": { + "$$type": [ + "int", + "long" + ] + }, + "db.mongodb.driver_connection_id": { + "$$type": [ + "int", + "long" + ] + } + } + } + ] + } + ] + } + } + ] +} diff --git a/source/open-telemetry/tests/operation/map_reduce.yml b/source/open-telemetry/tests/operation/map_reduce.yml new file mode 100644 index 0000000000..33f119e6b8 --- /dev/null +++ b/source/open-telemetry/tests/operation/map_reduce.yml @@ -0,0 +1,99 @@ +description: operation map_reduce +schemaVersion: '1.26' +runOnRequirements: + - + minServerVersion: '4.0' + topologies: + - single + - replicaset + - + minServerVersion: 4.1.7 + # serverless proxy does not support mapReduce operation + serverless: forbid + topologies: + - sharded + - load-balanced + +createEntities: + - client: + id: &client0 client0 + useMultipleMongoses: false + observeTracingMessages: + enableCommandPayload: true + - database: + id: &database0 database0 + client: *client0 + databaseName: operation-map-reduce + - collection: + id: &collection0 collection0 + database: *database0 + collectionName: test +initialData: + - + collectionName: test + databaseName: operation-map-reduce + documents: + - + _id: 1 + x: 0 + - + _id: 2 + x: 1 + - + _id: 3 + x: 2 +tests: + - description: mapReduce + operations: + - object: *collection0 + name: mapReduce + arguments: + map: + $code: 'function inc() { return emit(0, this.x + 1) }' + reduce: + $code: 'function sum(key, values) { return values.reduce((acc, x) => acc + x); }' + out: + inline: 1 + expectResult: + - + _id: 0 + value: 6 + expectTracingMessages: + client: *client0 + ignoreExtraSpans: false + spans: + - name: mapReduce operation-map-reduce.test + tags: + db.system: mongodb + db.namespace: operation-map-reduce + db.collection.name: test + db.operation.name: mapReduce + db.operation.summary: mapReduce operation-map-reduce.test + nested: + - name: command mapReduce + tags: + db.system: mongodb + db.namespace: operation-map-reduce + db.collection.name: operation-map-reduce.$cmd + db.command.name: mapReduce + network.transport: tcp + db.mongodb.cursor_id: { $$exists: false } + db.response.status_code: { $$exists: false } + exception.message: { $$exists: false } + exception.type: { $$exists: false } + exception.stacktrace: { $$exists: false } + server.address: { $$type: string } + server.port: { $$type: ['int', 'long'] } + server.type: { $$type: string } + db.query.summary: mapReduce + db.query.text: + $$matchAsDocument: + $$matchAsRoot: + mapReduce: test + map: { $code: 'function inc() { return emit(0, this.x + 1) }' } + reduce: { $code: 'function sum(key, values) { return values.reduce((acc, x) => acc + x); }' } + out: { inline: 1 } + db.mongodb.server_connection_id: + $$type: [ 'int', 'long' ] + db.mongodb.driver_connection_id: + $$type: [ 'int', 'long' ] diff --git a/source/open-telemetry/tests/operation/find_retries.json b/source/open-telemetry/tests/operation/retries.json similarity index 98% rename from source/open-telemetry/tests/operation/find_retries.json rename to source/open-telemetry/tests/operation/retries.json index fe3b6811b2..6a00ea920f 100644 --- a/source/open-telemetry/tests/operation/find_retries.json +++ b/source/open-telemetry/tests/operation/retries.json @@ -1,5 +1,5 @@ { - "description": "operation find retrying failed command", + "description": "retrying failed command", "schemaVersion": "1.26", "createEntities": [ { @@ -35,7 +35,7 @@ ], "tests": [ { - "description": "find an element", + "description": "find an element with retries", "operations": [ { "name": "failPoint", diff --git a/source/open-telemetry/tests/operation/find_retries.yml b/source/open-telemetry/tests/operation/retries.yml similarity index 97% rename from source/open-telemetry/tests/operation/find_retries.yml rename to source/open-telemetry/tests/operation/retries.yml index 5daebe5fdb..520f8c9d9d 100644 --- a/source/open-telemetry/tests/operation/find_retries.yml +++ b/source/open-telemetry/tests/operation/retries.yml @@ -1,4 +1,4 @@ -description: operation find retrying failed command +description: retrying failed command schemaVersion: '1.26' createEntities: - client: @@ -19,7 +19,7 @@ initialData: databaseName: operation-find-retries documents: [] tests: - - description: find an element + - description: find an element with retries operations: - name: failPoint object: testRunner diff --git a/source/open-telemetry/tests/operation/update.json b/source/open-telemetry/tests/operation/update.json new file mode 100644 index 0000000000..df26a7902e --- /dev/null +++ b/source/open-telemetry/tests/operation/update.json @@ -0,0 +1,109 @@ +{ + "description": "operation update", + "schemaVersion": "1.26", + "createEntities": [ + { + "client": { + "id": "client0", + "useMultipleMongoses": false, + "observeTracingMessages": { + "enableCommandPayload": true + } + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "operation-update" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "test" + } + } + ], + "tests": [ + { + "description": "update one element", + "operations": [ + { + "object": "collection0", + "name": "updateOne", + "arguments": { + "filter": { + "_id": 1 + }, + "update": { + "$inc": { + "x": 1 + } + } + } + } + ], + "expectTracingMessages": { + "client": "client0", + "ignoreExtraSpans": false, + "spans": [ + { + "name": "update operation-update.test", + "tags": { + "db.system": "mongodb", + "db.namespace": "operation-update", + "db.collection.name": "test", + "db.operation.name": "update", + "db.operation.summary": "update operation-update.test" + }, + "nested": [ + { + "name": "command update", + "tags": { + "db.system": "mongodb", + "db.namespace": "operation-update", + "server.address": { + "$$type": "string" + }, + "server.port": { + "$$type": [ + "long", + "string" + ] + }, + "server.type": { + "$$type": "string" + }, + "db.query.summary": "update", + "db.query.text": { + "$$matchAsDocument": { + "$$matchAsRoot": { + "update": "test", + "ordered": true, + "txnNumber": 1, + "updates": [ + { + "q": { + "_id": 1 + }, + "u": { + "$inc": { + "x": 1 + } + } + } + ] + } + } + } + } + } + ] + } + ] + } + } + ] +} diff --git a/source/open-telemetry/tests/operation/update.yml b/source/open-telemetry/tests/operation/update.yml new file mode 100644 index 0000000000..faa0dbb3a3 --- /dev/null +++ b/source/open-telemetry/tests/operation/update.yml @@ -0,0 +1,54 @@ +description: operation update +schemaVersion: '1.26' +createEntities: + - client: + id: &client0 client0 + useMultipleMongoses: false + observeTracingMessages: + enableCommandPayload: true + - database: + id: &database0 database0 + client: *client0 + databaseName: operation-update + - collection: + id: &collection0 collection0 + database: *database0 + collectionName: test + +tests: + - description: update one element + operations: + - + object: *collection0 + name: updateOne + arguments: + filter: { _id: 1 } + update: { $inc: { x: 1 } } + + expectTracingMessages: + client: *client0 + ignoreExtraSpans: false + spans: + - name: update operation-update.test + tags: + db.system: mongodb + db.namespace: operation-update + db.collection.name: test + db.operation.name: update + db.operation.summary: update operation-update.test + nested: + - name: command update + tags: + db.system: mongodb + db.namespace: operation-update + server.address: { $$type: string } + server.port: { $$type: [ 'long', 'string' ] } + server.type: { $$type: string } + db.query.summary: update + db.query.text: + $$matchAsDocument: + $$matchAsRoot: + update: test + ordered: true + txnNumber: 1 + updates: [ { "q": { "_id": 1 }, "u": { "$inc": { "x": 1 } } } ] diff --git a/source/open-telemetry/tests/transaction/transaction.json b/source/open-telemetry/tests/transaction/transaction.json index bc4e8f9174..248b0a24df 100644 --- a/source/open-telemetry/tests/transaction/transaction.json +++ b/source/open-telemetry/tests/transaction/transaction.json @@ -84,6 +84,24 @@ "x": 1 } } + }, + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 2 + } + } + }, + { + "object": "session0", + "name": "abortTransaction" } ], "expectTracingMessages": { @@ -197,6 +215,88 @@ } } ] + }, + { + "name": "transaction", + "tags": { + "db.system": "mongodb" + }, + "nested": [ + { + "name": "insert transaction-tests.test", + "tags": { + "db.system": "mongodb", + "db.namespace": "transaction-tests", + "db.collection.name": "test", + "db.operation.name": "insert", + "db.operation.summary": "insert transaction-tests.test" + }, + "nested": [ + { + "name": "command insert", + "tags": { + "db.system": "mongodb", + "db.namespace": "transaction-tests", + "server.address": { + "$$type": "string" + }, + "server.port": { + "$$type": [ + "long", + "string" + ] + }, + "server.type": { + "$$type": "string" + }, + "db.query.summary": "insert", + "db.query.text": { + "$$matchAsDocument": { + "$$matchAsRoot": { + "insert": "test", + "ordered": true, + "txnNumber": 2, + "startTransaction": true, + "autocommit": false, + "documents": [ + { + "_id": 2 + } + ] + } + } + }, + "db.mongodb.lsid": { + "$$sessionLsid": "session0" + } + } + } + ] + }, + { + "name": "abortTransaction admin.$cmd", + "tags": { + "db.system": "mongodb" + }, + "nested": [ + { + "name": "command abortTransaction", + "tags": { + "db.system": "mongodb", + "db.query.text": { + "$$matchAsDocument": { + "$$matchAsRoot": { + "abortTransaction": 1, + "txnNumber": 2, + "autocommit": false + } + } + } + } + } + ] + } + ] } ] }, diff --git a/source/open-telemetry/tests/transaction/transaction.yml b/source/open-telemetry/tests/transaction/transaction.yml index eb76cc5fd7..6387792a88 100644 --- a/source/open-telemetry/tests/transaction/transaction.yml +++ b/source/open-telemetry/tests/transaction/transaction.yml @@ -46,6 +46,17 @@ tests: object: *collection0 arguments: { filter: { x: 1 } } + - object: *session0 + name: startTransaction + - object: *collection0 + name: insertOne + arguments: + session: *session0 + document: + _id: 2 + - object: *session0 + name: abortTransaction + expectTracingMessages: client: *client0 ignoreExtraSpans: false @@ -105,6 +116,50 @@ tests: server.port: { $$type: ['long', 'string'] } server.type: { $$type: string } db.query.summary: find + - name: transaction + tags: + db.system: mongodb + nested: + - name: insert transaction-tests.test + tags: + db.system: mongodb + db.namespace: transaction-tests + db.collection.name: test + db.operation.name: insert + db.operation.summary: insert transaction-tests.test + nested: + - name: command insert + tags: + db.system: mongodb + db.namespace: transaction-tests + server.address: { $$type: string } + server.port: { $$type: ['long', 'string'] } + server.type: { $$type: string } + db.query.summary: insert + db.query.text: + $$matchAsDocument: + $$matchAsRoot: + insert: test + ordered: true + txnNumber: 2 + startTransaction: true + autocommit: false + documents: + - _id: 2 + db.mongodb.lsid: { $$sessionLsid: *session0 } + - name: abortTransaction admin.$cmd + tags: + db.system: mongodb + nested: + - name: command abortTransaction + tags: + db.system: mongodb + db.query.text: + $$matchAsDocument: + $$matchAsRoot: + abortTransaction: 1 + txnNumber: 2 + autocommit: false outcome: - collectionName: test databaseName: transaction-tests From a8089928f603e5df41ede99bd5eb1a59b229f66a Mon Sep 17 00:00:00 2001 From: Nabil Hachicha Date: Wed, 20 Aug 2025 08:17:22 +0100 Subject: [PATCH 35/62] update list of supported operations --- source/crud/tests/unified/bulkWrite.json | 2 +- source/crud/tests/unified/bulkWrite.yml | 2 +- source/open-telemetry/open-telemetry.md | 39 +++++++++++++++++++++--- 3 files changed, 37 insertions(+), 6 deletions(-) diff --git a/source/crud/tests/unified/bulkWrite.json b/source/crud/tests/unified/bulkWrite.json index 95159bc882..59b33cbac5 100644 --- a/source/crud/tests/unified/bulkWrite.json +++ b/source/crud/tests/unified/bulkWrite.json @@ -1,5 +1,5 @@ { - "§§description": "bulkWrite", + "description": "bulkWrite", "schemaVersion": "1.0", "runOnRequirements": [ { diff --git a/source/crud/tests/unified/bulkWrite.yml b/source/crud/tests/unified/bulkWrite.yml index 734482bc21..677e6725c4 100644 --- a/source/crud/tests/unified/bulkWrite.yml +++ b/source/crud/tests/unified/bulkWrite.yml @@ -1,4 +1,4 @@ -§§description: bulkWrite +description: bulkWrite schemaVersion: '1.0' diff --git a/source/open-telemetry/open-telemetry.md b/source/open-telemetry/open-telemetry.md index 8042c6125f..4cdeca84bb 100644 --- a/source/open-telemetry/open-telemetry.md +++ b/source/open-telemetry/open-telemetry.md @@ -198,9 +198,9 @@ specific; a driver decides what best describes the error. ##### db.query.text -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`. +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`. Drivers MUST NOT add this attribute by default. Drivers MUST provide a toggle to enable this attribute. This configuration can be implemented with an environment variable @@ -233,7 +233,38 @@ of drivers for our internal teams, and improve our documentation around troubles ## Test Plan -TODO +See [OpenTelemetry Tests](tests/README.md) for the test plan. + +## Covered operations + +The OpenTelemetry specification covers the following operations: + +| Operation | Test | +| :----------------------- | :----------------------------------------------------------------------------------- | +| `aggregate` | [tests/transaction/aggregate.yml](tests/operation/aggregate.yml) | +| `findAndModify` | [tests/transaction/find_one_and_update.yml](tests/operation/find_one_and_update.yml) | +| `bulkWrite` | [tests/transaction/bulk_write.yml](tests/operation/bulk_write.yml) | +| `commitTransaction` | [tests/transaction/transaction.yml](tests/transaction/transaction.yml) | +| `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) | +| `distinct` | [tests/transaction/distinct.yml](tests/operation/distinct.yml) | +| `dropCollection` | [tests/transaction/drop_collection.yml](tests/operation/drop_collection.yml) | +| `dropIndexes` | [tests/transaction/drop_indexes.yml](tests/operation/drop_indexes.yml) | +| `find` | [tests/transaction/find.yml](tests/operation/find.yml) | +| `listCollections` | [tests/transaction/list_collections.yml](tests/operation/list_collections.yml) | +| `listDatabases` | [tests/transaction/list_databases.yml](tests/operation/list_databases.yml) | +| `listIndexes` | [tests/transaction/list_indexes.yml](tests/operation/list_indexes.yml) | +| `mapReduce` | [tests/transaction/map_reduce.yml](tests/operation/map_reduce.yml) | +| `estimatedDocumentCount` | [tests/transaction/count.yml](tests/operation/count.yml) | +| `insert` | [tests/transaction/insert.yml](tests/operation/insert.yml) | +| `delete` | [tests/transaction/delete.yml](tests/operation/delete.yml) | +| `update` | [tests/transaction/update.yml](tests/operation/update.yml) | +| `createSearchIndexes` | [tests/transaction/atlas_search.yml](tests/operation/atlas_search.yml) | +| `dropSearchIndex` | [tests/transaction/atlas_search.yml](tests/operation/atlas_search.yml) | +| `updateSearchIndex` | [tests/transaction/delete.yml](tests/operation/delete.yml) | +| `delete` | [tests/transaction/atlas_search.yml](tests/operation/atlas_search.yml) | ## Backwards Compatibility From f78b54186ef6a8e7ea74abd5d117dd581bcf2622 Mon Sep 17 00:00:00 2001 From: Dmitry Rybakov Date: Tue, 2 Sep 2025 17:40:09 +0200 Subject: [PATCH 36/62] Adjust spec format --- source/open-telemetry/open-telemetry.md | 4 +- .../open-telemetry/tests/cursor/cursor.json | 389 +++++++++--------- source/open-telemetry/tests/cursor/cursor.yml | 179 ++++---- .../tests/operation/aggregate.json | 153 ++++--- .../tests/operation/aggregate.yml | 73 ++-- .../tests/operation/atlas_search.json | 84 ++-- .../tests/operation/atlas_search.yml | 52 +-- .../tests/operation/bulk_write.json | 42 +- .../tests/operation/bulk_write.yml | 36 +- .../open-telemetry/tests/operation/count.json | 141 ++++--- .../open-telemetry/tests/operation/count.yml | 77 ++-- .../tests/operation/create_collection.json | 142 ++++--- .../tests/operation/create_collection.yml | 74 ++-- .../tests/operation/create_indexes.json | 154 +++---- .../tests/operation/create_indexes.yml | 75 ++-- .../tests/operation/create_view.json | 4 +- .../tests/operation/create_view.yml | 4 +- .../tests/operation/delete.json | 103 +++-- .../open-telemetry/tests/operation/delete.yml | 53 ++- .../tests/operation/distinct.json | 148 +++---- .../tests/operation/distinct.yml | 77 ++-- .../tests/operation/drop_collection.json | 141 ++++--- .../tests/operation/drop_collection.yml | 69 ++-- .../tests/operation/drop_indexes.json | 165 ++++---- .../tests/operation/drop_indexes.yml | 84 ++-- .../open-telemetry/tests/operation/find.json | 148 +++---- .../open-telemetry/tests/operation/find.yml | 76 ++-- .../tests/operation/find_one_and_update.json | 161 ++++---- .../tests/operation/find_one_and_update.yml | 75 ++-- .../tests/operation/find_retries.json | 212 ++++++++++ .../tests/operation/find_retries.yml | 103 +++++ .../tests/operation/insert.json | 4 +- .../open-telemetry/tests/operation/insert.yml | 4 +- .../tests/operation/list_collections.json | 47 +-- .../tests/operation/list_collections.yml | 69 ++-- .../tests/operation/list_databases.json | 135 +++--- .../tests/operation/list_databases.yml | 63 ++- .../tests/operation/list_indexes.json | 47 ++- .../tests/operation/list_indexes.yml | 23 +- .../tests/operation/map_reduce.json | 160 +++---- .../tests/operation/map_reduce.yml | 76 ++-- .../tests/operation/retries.json | 268 ++++++------ .../tests/operation/retries.yml | 136 +++--- .../tests/operation/update.json | 105 +++-- .../open-telemetry/tests/operation/update.yml | 55 ++- .../tests/transaction/transaction.json | 238 ++++------- .../tests/transaction/transaction.yml | 131 ++---- source/unified-test-format/schema-1.26.json | 51 ++- source/unified-test-format/schema-latest.json | 51 ++- 49 files changed, 2572 insertions(+), 2389 deletions(-) create mode 100644 source/open-telemetry/tests/operation/find_retries.json create mode 100644 source/open-telemetry/tests/operation/find_retries.yml diff --git a/source/open-telemetry/open-telemetry.md b/source/open-telemetry/open-telemetry.md index 4cdeca84bb..0ce4281105 100644 --- a/source/open-telemetry/open-telemetry.md +++ b/source/open-telemetry/open-telemetry.md @@ -117,7 +117,7 @@ The span name SHOULD be: - `driver_operation_name db.collection_name` if the command is executed on a collection (e.g., `findOneAndDelete warehouse.users`). -- `db.driver_operation_name` if there is no specific collection for the command (e.g., `warehouse.runCommand`). +- `driver_operation_name db` if there is no specific collection for the command (e.g., `runCommand warehouse`). ##### Span Kind @@ -164,7 +164,7 @@ The span name SHOULD be: - `server_command db.collection_name` if the command is executed on a collection (e.g., `findAndModify warehouse.users`). -- `db.server_command` if there is no specific collection for the command. +- `server_command db` if there is no specific collection for the command. ##### Span Kind diff --git a/source/open-telemetry/tests/cursor/cursor.json b/source/open-telemetry/tests/cursor/cursor.json index b0d6eaca15..11bf9105e2 100644 --- a/source/open-telemetry/tests/cursor/cursor.json +++ b/source/open-telemetry/tests/cursor/cursor.json @@ -86,215 +86,208 @@ ] } ], - "expectTracingMessages": { - "client": "client0", - "ignoreExtraSpans": false, - "spans": [ - { - "name": "find cursor.test", - "tags": { - "db.system": "mongodb", - "db.namespace": "cursor", - "db.collection.name": "test", - "db.operation.name": "find", - "db.operation.summary": "find cursor.test" - }, - "nested": [ - { - "name": "command find", - "tags": { - "db.system": "mongodb", - "db.namespace": "cursor", - "db.collection.name": "cursor.$cmd", - "db.command.name": "find", - "network.transport": "tcp", - "db.mongodb.cursor_id": { - "$$exists": false - }, - "db.response.status_code": { - "$$exists": false - }, - "exception.message": { - "$$exists": false - }, - "exception.type": { - "$$exists": false - }, - "exception.stacktrace": { - "$$exists": false - }, - "server.address": { - "$$type": "string" - }, - "server.port": { - "$$type": [ - "int", - "long" - ] - }, - "server.type": { - "$$type": "string" - }, - "db.query.summary": "find", - "db.query.text": { - "$$matchAsDocument": { - "$$matchAsRoot": { - "find": "test", - "filter": { - "_id": { - "$gt": 1 - } - }, - "batchSize": 2 + "expectTracingMessages": [ + { + "client": "client0", + "ignoreExtraSpans": false, + "spans": [ + { + "name": "find cursor.test", + "attributes": { + "db.system": "mongodb", + "db.namespace": "cursor", + "db.collection.name": "test", + "db.operation.name": "find", + "db.operation.summary": "find cursor.test" + }, + "nested": [ + { + "name": "find cursor.test", + "attributes": { + "db.system": "mongodb", + "db.namespace": "cursor", + "db.collection.name": "test", + "db.command.name": "find", + "network.transport": "tcp", + "db.mongodb.cursor_id": { + "$$exists": false + }, + "db.response.status_code": { + "$$exists": false + }, + "exception.message": { + "$$exists": false + }, + "exception.type": { + "$$exists": false + }, + "exception.stacktrace": { + "$$exists": false + }, + "server.address": { + "$$type": "string" + }, + "server.port": { + "$$type": [ + "int", + "long" + ] + }, + "db.query.summary": "find", + "db.query.text": { + "$$matchAsDocument": { + "$$matchAsRoot": { + "find": "test", + "filter": { + "_id": { + "$gt": 1 + } + }, + "batchSize": 2 + } } + }, + "db.mongodb.server_connection_id": { + "$$type": [ + "int", + "long" + ] + }, + "db.mongodb.driver_connection_id": { + "$$type": [ + "int", + "long" + ] } - }, - "db.mongodb.server_connection_id": { - "$$type": [ - "int", - "long" - ] - }, - "db.mongodb.driver_connection_id": { - "$$type": [ - "int", - "long" - ] } } - }, - { - "name": "command getMore", - "tags": { - "db.system": "mongodb", - "db.namespace": "cursor", - "db.collection.name": "cursor.$cmd", - "db.command.name": "getMore", - "network.transport": "tcp", - "db.mongodb.cursor_id": { - "$$type": [ - "int", - "long" - ] - }, - "db.response.status_code": { - "$$exists": false - }, - "exception.message": { - "$$exists": false - }, - "exception.type": { - "$$exists": false - }, - "exception.stacktrace": { - "$$exists": false - }, - "server.address": { - "$$type": "string" - }, - "server.port": { - "$$type": [ - "int", - "long" - ] - }, - "server.type": { - "$$type": "string" - }, - "db.query.summary": "getMore", - "db.query.text": { - "$$matchAsDocument": { - "$$matchAsRoot": { - "getMore": { - "$$type": "long" - }, - "collection": "test", - "batchSize": 2 - } + ] + }, + { + "name": "getMore cursor.test", + "attributes": { + "db.system": "mongodb", + "db.namespace": "cursor", + "db.collection.name": "test", + "db.command.name": "getMore", + "network.transport": "tcp", + "db.mongodb.cursor_id": { + "$$type": [ + "int", + "long" + ] + }, + "db.response.status_code": { + "$$exists": false + }, + "exception.message": { + "$$exists": false + }, + "exception.type": { + "$$exists": false + }, + "exception.stacktrace": { + "$$exists": false + }, + "server.address": { + "$$type": "string" + }, + "server.port": { + "$$type": [ + "int", + "long" + ] + }, + "db.query.summary": "getMore", + "db.query.text": { + "$$matchAsDocument": { + "$$matchAsRoot": { + "getMore": { + "$$type": "long" + }, + "collection": "test", + "batchSize": 2 } - }, - "db.mongodb.server_connection_id": { - "$$type": [ - "int", - "long" - ] - }, - "db.mongodb.driver_connection_id": { - "$$type": [ - "int", - "long" - ] } + }, + "db.mongodb.server_connection_id": { + "$$type": [ + "int", + "long" + ] + }, + "db.mongodb.driver_connection_id": { + "$$type": [ + "int", + "long" + ] } - }, - { - "name": "command getMore", - "tags": { - "db.system": "mongodb", - "db.namespace": "cursor", - "db.collection.name": "cursor.$cmd", - "db.command.name": "getMore", - "network.transport": "tcp", - "db.mongodb.cursor_id": { - "$$type": [ - "int", - "long" - ] - }, - "db.response.status_code": { - "$$exists": false - }, - "exception.message": { - "$$exists": false - }, - "exception.type": { - "$$exists": false - }, - "exception.stacktrace": { - "$$exists": false - }, - "server.address": { - "$$type": "string" - }, - "server.port": { - "$$type": [ - "int", - "long" - ] - }, - "server.type": { - "$$type": "string" - }, - "db.query.summary": "getMore", - "db.query.text": { - "$$matchAsDocument": { - "$$matchAsRoot": { - "getMore": { - "$$type": "long" - }, - "collection": "test", - "batchSize": 2 - } + } + }, + { + "name": "getMore cursor.test", + "attributes": { + "db.system": "mongodb", + "db.namespace": "cursor", + "db.collection.name": "test", + "db.command.name": "getMore", + "network.transport": "tcp", + "db.mongodb.cursor_id": { + "$$type": [ + "int", + "long" + ] + }, + "db.response.status_code": { + "$$exists": false + }, + "exception.message": { + "$$exists": false + }, + "exception.type": { + "$$exists": false + }, + "exception.stacktrace": { + "$$exists": false + }, + "server.address": { + "$$type": "string" + }, + "server.port": { + "$$type": [ + "int", + "long" + ] + }, + "db.query.summary": "getMore", + "db.query.text": { + "$$matchAsDocument": { + "$$matchAsRoot": { + "getMore": { + "$$type": "long" + }, + "collection": "test", + "batchSize": 2 } - }, - "db.mongodb.server_connection_id": { - "$$type": [ - "int", - "long" - ] - }, - "db.mongodb.driver_connection_id": { - "$$type": [ - "int", - "long" - ] } + }, + "db.mongodb.server_connection_id": { + "$$type": [ + "int", + "long" + ] + }, + "db.mongodb.driver_connection_id": { + "$$type": [ + "int", + "long" + ] } } - ] - } - ] - } + } + ] + } + ] } ] } diff --git a/source/open-telemetry/tests/cursor/cursor.yml b/source/open-telemetry/tests/cursor/cursor.yml index a78d50d01e..9b160122bf 100644 --- a/source/open-telemetry/tests/cursor/cursor.yml +++ b/source/open-telemetry/tests/cursor/cursor.yml @@ -13,7 +13,7 @@ createEntities: - collection: id: &collection0 collection0 database: *database0 - collectionName: test + collectionName: &collectionName0 test initialData: - collectionName: test databaseName: cursor @@ -38,95 +38,92 @@ tests: - { _id: 4 } - { _id: 5 } - { _id: 6 } - expectTracingMessages: - client: *client0 - ignoreExtraSpans: false - spans: - - name: find cursor.test - tags: - db.system: mongodb - db.namespace: cursor - db.collection.name: test - db.operation.name: find - db.operation.summary: find cursor.test - nested: - - name: command find - tags: - db.system: mongodb - db.namespace: cursor - db.collection.name: cursor.$cmd - db.command.name: find - network.transport: tcp - db.mongodb.cursor_id: { $$exists: false } - db.response.status_code: { $$exists: false } - exception.message: { $$exists: false } - exception.type: { $$exists: false } - exception.stacktrace: { $$exists: false } - server.address: { $$type: string } - server.port: { $$type: ['int', 'long'] } - server.type: { $$type: string } - db.query.summary: find - db.query.text: - $$matchAsDocument: - $$matchAsRoot: - find: test - filter: { _id: { $gt: 1 } } - batchSize: 2 - db.mongodb.server_connection_id: - $$type: [ 'int', 'long' ] - db.mongodb.driver_connection_id: - $$type: [ 'int', 'long' ] + - client: *client0 + ignoreExtraSpans: false + spans: + - name: find cursor.test + attributes: + db.system: mongodb + db.namespace: cursor + db.collection.name: test + db.operation.name: find + db.operation.summary: find cursor.test + nested: + - name: find cursor.test + attributes: + db.system: mongodb + db.namespace: cursor + db.collection.name: *collectionName0 + db.command.name: find + network.transport: tcp + db.mongodb.cursor_id: { $$exists: false } + db.response.status_code: { $$exists: false } + exception.message: { $$exists: false } + exception.type: { $$exists: false } + exception.stacktrace: { $$exists: false } + server.address: { $$type: string } + server.port: { $$type: ['int', 'long'] } + db.query.summary: find + db.query.text: + $$matchAsDocument: + $$matchAsRoot: + find: test + filter: { _id: { $gt: 1 } } + batchSize: 2 + db.mongodb.server_connection_id: + $$type: [ 'int', 'long' ] + db.mongodb.driver_connection_id: + $$type: [ 'int', 'long' ] + + - name: getMore cursor.test + attributes: + db.system: mongodb + db.namespace: cursor + db.collection.name: *collectionName0 + db.command.name: getMore + network.transport: tcp + db.mongodb.cursor_id: { $$type: [ 'int', 'long' ] } + db.response.status_code: { $$exists: false } + exception.message: { $$exists: false } + exception.type: { $$exists: false } + exception.stacktrace: { $$exists: false } + server.address: { $$type: string } + server.port: { $$type: ['int', 'long'] } + db.query.summary: getMore + db.query.text: + $$matchAsDocument: + $$matchAsRoot: + getMore: { $$type: long } + collection: test + batchSize: 2 + db.mongodb.server_connection_id: + $$type: [ 'int', 'long' ] + db.mongodb.driver_connection_id: + $$type: [ 'int', 'long' ] - - name: command getMore - tags: - db.system: mongodb - db.namespace: cursor - db.collection.name: cursor.$cmd - db.command.name: getMore - network.transport: tcp - db.mongodb.cursor_id: { $$type: [ 'int', 'long' ] } - db.response.status_code: { $$exists: false } - exception.message: { $$exists: false } - exception.type: { $$exists: false } - exception.stacktrace: { $$exists: false } - server.address: { $$type: string } - server.port: { $$type: ['int', 'long'] } - server.type: { $$type: string } - db.query.summary: getMore - db.query.text: - $$matchAsDocument: - $$matchAsRoot: - getMore: { $$type: long } - collection: test - batchSize: 2 - db.mongodb.server_connection_id: - $$type: [ 'int', 'long' ] - db.mongodb.driver_connection_id: - $$type: [ 'int', 'long' ] - - name: command getMore - tags: - db.system: mongodb - db.namespace: cursor - db.collection.name: cursor.$cmd - db.command.name: getMore - network.transport: tcp - db.mongodb.cursor_id: { $$type: [ 'int', 'long' ] } - db.response.status_code: { $$exists: false } - exception.message: { $$exists: false } - exception.type: { $$exists: false } - exception.stacktrace: { $$exists: false } - server.address: { $$type: string } - server.port: { $$type: ['int', 'long'] } - server.type: { $$type: string } - db.query.summary: getMore - db.query.text: - $$matchAsDocument: - $$matchAsRoot: - getMore: { $$type: long } - collection: test - batchSize: 2 - db.mongodb.server_connection_id: - $$type: [ 'int', 'long' ] - db.mongodb.driver_connection_id: - $$type: [ 'int', 'long' ] + - name: getMore cursor.test + attributes: + db.system: mongodb + db.namespace: cursor + db.collection.name: *collectionName0 + db.command.name: getMore + network.transport: tcp + db.mongodb.cursor_id: { $$type: [ 'int', 'long' ] } + db.response.status_code: { $$exists: false } + exception.message: { $$exists: false } + exception.type: { $$exists: false } + exception.stacktrace: { $$exists: false } + server.address: { $$type: string } + server.port: { $$type: ['int', 'long'] } + db.query.summary: getMore + db.query.text: + $$matchAsDocument: + $$matchAsRoot: + getMore: { $$type: long } + collection: test + batchSize: 2 + db.mongodb.server_connection_id: + $$type: [ 'int', 'long' ] + db.mongodb.driver_connection_id: + $$type: [ 'int', 'long' ] diff --git a/source/open-telemetry/tests/operation/aggregate.json b/source/open-telemetry/tests/operation/aggregate.json index a27d52d8cb..c99bc2bcfd 100644 --- a/source/open-telemetry/tests/operation/aggregate.json +++ b/source/open-telemetry/tests/operation/aggregate.json @@ -44,88 +44,87 @@ } } ], - "expectTracingMessages": { - "client": "client0", - "ignoreExtraSpans": false, - "spans": [ - { - "name": "aggregate operation-aggregate.test", - "tags": { - "db.system": "mongodb", - "db.namespace": "operation-aggregate", - "db.collection.name": "test", - "db.operation.name": "aggregate", - "db.operation.summary": "aggregate operation-aggregate.test" - }, - "nested": [ - { - "name": "command aggregate", - "tags": { - "db.system": "mongodb", - "db.namespace": "operation-aggregate", - "db.collection.name": "operation-aggregate.$cmd", - "db.command.name": "aggregate", - "network.transport": "tcp", - "db.mongodb.cursor_id": { - "$$exists": false - }, - "db.response.status_code": { - "$$exists": false - }, - "exception.message": { - "$$exists": false - }, - "exception.type": { - "$$exists": false - }, - "exception.stacktrace": { - "$$exists": false - }, - "server.address": { - "$$type": "string" - }, - "server.port": { - "$$type": [ - "int", - "long" - ] - }, - "server.type": { - "$$type": "string" - }, - "db.query.summary": "aggregate", - "db.query.text": { - "$$matchAsDocument": { - "$$matchAsRoot": { - "aggregate": "test", - "pipeline": [ - { - "$match": { - "_id": 1 + "expectTracingMessages": [ + { + "client": "client0", + "ignoreExtraSpans": false, + "spans": [ + { + "name": "aggregate operation-aggregate.test", + "attributes": { + "db.system": "mongodb", + "db.namespace": "operation-aggregate", + "db.collection.name": "test", + "db.operation.name": "aggregate", + "db.operation.summary": "aggregate operation-aggregate.test" + }, + "nested": [ + { + "name": "aggregate operation-aggregate.test", + "attributes": { + "db.system": "mongodb", + "db.namespace": "operation-aggregate", + "db.collection.name": "test", + "db.command.name": "aggregate", + "network.transport": "tcp", + "db.mongodb.cursor_id": { + "$$exists": false + }, + "db.response.status_code": { + "$$exists": false + }, + "exception.message": { + "$$exists": false + }, + "exception.type": { + "$$exists": false + }, + "exception.stacktrace": { + "$$exists": false + }, + "server.address": { + "$$type": "string" + }, + "server.port": { + "$$type": [ + "int", + "long" + ] + }, + "db.query.summary": "aggregate", + "db.query.text": { + "$$matchAsDocument": { + "$$matchAsRoot": { + "aggregate": "test", + "pipeline": [ + { + "$match": { + "_id": 1 + } } - } - ] + ] + } } + }, + "db.mongodb.server_connection_id": { + "$$type": [ + "int", + "long" + ] + }, + "db.mongodb.driver_connection_id": { + "$$type": [ + "int", + "long" + ] } - }, - "db.mongodb.server_connection_id": { - "$$type": [ - "int", - "long" - ] - }, - "db.mongodb.driver_connection_id": { - "$$type": [ - "int", - "long" - ] } } - } - ] - } - ] - } + ] + } + ] + } + ] } ] } diff --git a/source/open-telemetry/tests/operation/aggregate.yml b/source/open-telemetry/tests/operation/aggregate.yml index e9e267dfab..0652a13e76 100644 --- a/source/open-telemetry/tests/operation/aggregate.yml +++ b/source/open-telemetry/tests/operation/aggregate.yml @@ -13,7 +13,7 @@ createEntities: - collection: id: &collection0 collection0 database: *database0 - collectionName: test + collectionName: &collectionName0 test tests: - description: aggregation @@ -25,39 +25,38 @@ tests: - $match: { _id: 1 } expectTracingMessages: - client: *client0 - ignoreExtraSpans: false - spans: - - name: aggregate operation-aggregate.test - tags: - db.system: mongodb - db.namespace: operation-aggregate - db.collection.name: test - db.operation.name: aggregate - db.operation.summary: aggregate operation-aggregate.test - nested: - - name: command aggregate - tags: - db.system: mongodb - db.namespace: operation-aggregate - db.collection.name: operation-aggregate.$cmd - db.command.name: aggregate - network.transport: tcp - db.mongodb.cursor_id: { $$exists: false } - db.response.status_code: { $$exists: false } - exception.message: { $$exists: false } - exception.type: { $$exists: false } - exception.stacktrace: { $$exists: false } - server.address: { $$type: string } - server.port: { $$type: ['int', 'long'] } - server.type: { $$type: string } - db.query.summary: aggregate - db.query.text: - $$matchAsDocument: - $$matchAsRoot: - aggregate: test - pipeline: *pipeline1 - db.mongodb.server_connection_id: - $$type: [ 'int', 'long' ] - db.mongodb.driver_connection_id: - $$type: [ 'int', 'long' ] + - client: *client0 + ignoreExtraSpans: false + spans: + - name: aggregate operation-aggregate.test + attributes: + db.system: mongodb + db.namespace: operation-aggregate + db.collection.name: test + db.operation.name: aggregate + db.operation.summary: aggregate operation-aggregate.test + nested: + - name: aggregate operation-aggregate.test + attributes: + db.system: mongodb + db.namespace: operation-aggregate + db.collection.name: *collectionName0 + db.command.name: aggregate + network.transport: tcp + db.mongodb.cursor_id: { $$exists: false } + db.response.status_code: { $$exists: false } + exception.message: { $$exists: false } + exception.type: { $$exists: false } + exception.stacktrace: { $$exists: false } + server.address: { $$type: string } + server.port: { $$type: ['int', 'long'] } + db.query.summary: aggregate + db.query.text: + $$matchAsDocument: + $$matchAsRoot: + aggregate: test + pipeline: *pipeline1 + db.mongodb.server_connection_id: + $$type: [ 'int', 'long' ] + db.mongodb.driver_connection_id: + $$type: [ 'int', 'long' ] diff --git a/source/open-telemetry/tests/operation/atlas_search.json b/source/open-telemetry/tests/operation/atlas_search.json index 6c68b1951a..15ee71de09 100644 --- a/source/open-telemetry/tests/operation/atlas_search.json +++ b/source/open-telemetry/tests/operation/atlas_search.json @@ -93,24 +93,26 @@ } } ], - "expectTracingMessages": { - "client": "client0", - "ignoreExtraSpans": false, - "spans": [ - { - "name": "createSearchIndexes operation-atlas-search.test", - "tags": { - "db.system": "mongodb", + "expectTracingMessages": [ + { + "client": "client0", + "ignoreExtraSpans": false, + "spans": [ + { + "name": "createSearchIndexes operation-atlas-search.test", + "attributes": { + "db.system": "mongodb" + }, "db.namespace": "operation-atlas-search", "db.collection.name": "test", "db.operation.name": "createSearchIndexes", - "db.operation.summary": "createSearchIndexes operation-atlas-search.test" - }, - "nested": [ - { - "name": "command createSearchIndexes", - "tags": { - "db.system": "mongodb", + "db.operation.summary": "createSearchIndexes operation-atlas-search.test", + "nested": [ + { + "name": "command createSearchIndexes", + "attributes": { + "db.system": "mongodb" + }, "db.namespace": "operation-atlas-search", "server.address": { "$$type": "string" @@ -143,22 +145,22 @@ } } } - } - ] - }, - { - "name": "updateSearchIndex operation-atlas-search.test", - "tags": { - "db.system": "mongodb", - "db.namespace": "operation-atlas-search", - "db.collection.name": "test", - "db.operation.name": "updateSearchIndex", - "db.operation.summary": "updateSearchIndex operation-atlas-search.test" - }, + ] + } + ] + }, + { + "name": "updateSearchIndex operation-atlas-search.test", + "attributes": { + "db.system": "mongodb", + "db.namespace": "operation-atlas-search", + "db.collection.name": "test", + "db.operation.name": "updateSearchIndex", + "db.operation.summary": "updateSearchIndex operation-atlas-search.test", "nested": [ { "name": "command updateSearchIndex", - "tags": { + "attributes": { "db.system": "mongodb", "db.namespace": "operation-atlas-search", "server.address": { @@ -186,20 +188,20 @@ } } ] - }, - { - "name": "dropSearchIndex operation-atlas-search.test", - "tags": { - "db.system": "mongodb", - "db.namespace": "operation-atlas-search", - "db.collection.name": "test", - "db.operation.name": "dropSearchIndex", - "db.operation.summary": "dropSearchIndex operation-atlas-search.test" - }, + } + }, + { + "name": "dropSearchIndex operation-atlas-search.test", + "attributes": { + "db.system": "mongodb", + "db.namespace": "operation-atlas-search", + "db.collection.name": "test", + "db.operation.name": "dropSearchIndex", + "db.operation.summary": "dropSearchIndex operation-atlas-search.test", "nested": [ { "name": "command dropSearchIndex", - "tags": { + "attributes": { "db.system": "mongodb", "db.namespace": "operation-atlas-search", "server.address": { @@ -227,8 +229,8 @@ } ] } - ] - } + } + ] } ] } diff --git a/source/open-telemetry/tests/operation/atlas_search.yml b/source/open-telemetry/tests/operation/atlas_search.yml index ab3f85e243..9fd7f05994 100644 --- a/source/open-telemetry/tests/operation/atlas_search.yml +++ b/source/open-telemetry/tests/operation/atlas_search.yml @@ -65,20 +65,20 @@ tests: errorContains: Atlas expectTracingMessages: - client: *client0 - ignoreExtraSpans: false - spans: - - name: createSearchIndexes operation-atlas-search.test - tags: - db.system: mongodb + - client: *client0 + ignoreExtraSpans: false + spans: + - name: createSearchIndexes operation-atlas-search.test + attributes: + db.system: mongodb db.namespace: operation-atlas-search db.collection.name: test db.operation.name: createSearchIndexes db.operation.summary: createSearchIndexes operation-atlas-search.test - nested: - - name: command createSearchIndexes - tags: - db.system: mongodb + nested: + - name: command createSearchIndexes + attributes: + db.system: mongodb db.namespace: operation-atlas-search server.address: { $$type: string } server.port: { $$type: [ 'long', 'string' ] } @@ -90,16 +90,16 @@ tests: createSearchIndexes: test indexes: [ { "type": "search", "definition": { "mappings": { "dynamic": true } } } ] - - name: updateSearchIndex operation-atlas-search.test - tags: - db.system: mongodb - db.namespace: operation-atlas-search - db.collection.name: test - db.operation.name: updateSearchIndex - db.operation.summary: updateSearchIndex operation-atlas-search.test + - name: updateSearchIndex operation-atlas-search.test + attributes: + db.system: mongodb + db.namespace: operation-atlas-search + db.collection.name: test + db.operation.name: updateSearchIndex + db.operation.summary: updateSearchIndex operation-atlas-search.test nested: - name: command updateSearchIndex - tags: + attributes: db.system: mongodb db.namespace: operation-atlas-search server.address: { $$type: string } @@ -113,16 +113,16 @@ tests: name: test index definition: {} - - name: dropSearchIndex operation-atlas-search.test - tags: - db.system: mongodb - db.namespace: operation-atlas-search - db.collection.name: test - db.operation.name: dropSearchIndex - db.operation.summary: dropSearchIndex operation-atlas-search.test + - name: dropSearchIndex operation-atlas-search.test + attributes: + db.system: mongodb + db.namespace: operation-atlas-search + db.collection.name: test + db.operation.name: dropSearchIndex + db.operation.summary: dropSearchIndex operation-atlas-search.test nested: - name: command dropSearchIndex - tags: + attributes: db.system: mongodb db.namespace: operation-atlas-search server.address: { $$type: string } diff --git a/source/open-telemetry/tests/operation/bulk_write.json b/source/open-telemetry/tests/operation/bulk_write.json index ca814e4f99..1646af4012 100644 --- a/source/open-telemetry/tests/operation/bulk_write.json +++ b/source/open-telemetry/tests/operation/bulk_write.json @@ -140,24 +140,26 @@ } } ], - "expectTracingMessages": { - "client": "client0", - "ignoreExtraSpans": false, - "spans": [ - { - "name": "bulkWrite operation-bulk-write.test", - "tags": { - "db.system": "mongodb", + "expectTracingMessages": [ + { + "client": "client0", + "ignoreExtraSpans": false, + "spans": [ + { + "name": "bulkWrite operation-bulk-write.test", + "attributes": { + "db.system": "mongodb" + }, "db.namespace": "operation-bulk-write", "db.collection.name": "test", "db.operation.name": "bulkWrite", - "db.operation.summary": "bulkWrite operation-bulk-write.test" - }, - "nested": [ - { - "name": "command bulkWrite", - "tags": { - "db.system": "mongodb", + "db.operation.summary": "bulkWrite operation-bulk-write.test", + "nested": [ + { + "name": "command bulkWrite", + "attributes": { + "db.system": "mongodb" + }, "db.namespace": "admin", "db.collection.name": "admin.$cmd", "db.command.name": "bulkWrite", @@ -292,11 +294,11 @@ ] } } - } - ] - } - ] - } + ] + } + ] + } + ] } ] } diff --git a/source/open-telemetry/tests/operation/bulk_write.yml b/source/open-telemetry/tests/operation/bulk_write.yml index 1f93b9fdff..66ccc09e5a 100644 --- a/source/open-telemetry/tests/operation/bulk_write.yml +++ b/source/open-telemetry/tests/operation/bulk_write.yml @@ -59,20 +59,20 @@ tests: $and: [ { _id: { $gt: 5 } }, { _id: { $lte: 7 } } ] expectTracingMessages: - client: *client0 - ignoreExtraSpans: false - spans: - - name: bulkWrite operation-bulk-write.test - tags: - db.system: mongodb + - client: *client0 + ignoreExtraSpans: false + spans: + - name: bulkWrite operation-bulk-write.test + attributes: + db.system: mongodb db.namespace: operation-bulk-write db.collection.name: test db.operation.name: bulkWrite db.operation.summary: bulkWrite operation-bulk-write.test - nested: - - name: command bulkWrite - tags: - db.system: mongodb + nested: + - name: command bulkWrite + attributes: + db.system: mongodb db.namespace: admin db.collection.name: admin.$cmd db.command.name: bulkWrite @@ -93,14 +93,14 @@ tests: errorsOnly: true ordered: true ops: [ { "insert": 0, "document": { "_id": 8, "x": 88 } }, - { "update": 0, "multi": false, "filter": { "_id": 1 }, "updateMods": { "$inc": { "x": 1 } } }, - { "update": 0, "multi": true, "filter": { "$and": [ { "_id": { "$gt": 1 } }, { "_id": { "$lte": 3 } } ] }, - "updateMods": { "$inc": { "x": 2 } } }, - { "update": 0, "multi": false, "filter": { "_id": 4 }, - "updateMods": { "x": 44 }, "upsert": true }, - { "delete": 0, "multi": false, "filter": { "_id": 5 } }, - { "delete": 0, "multi": true, "filter": { "$and": [ - { "_id": { "$gt": 5 } }, { "_id": { "$lte": 7 } } ] } } ] + { "update": 0, "multi": false, "filter": { "_id": 1 }, "updateMods": { "$inc": { "x": 1 } } }, + { "update": 0, "multi": true, "filter": { "$and": [ { "_id": { "$gt": 1 } }, { "_id": { "$lte": 3 } } ] }, + "updateMods": { "$inc": { "x": 2 } } }, + { "update": 0, "multi": false, "filter": { "_id": 4 }, + "updateMods": { "x": 44 }, "upsert": true }, + { "delete": 0, "multi": false, "filter": { "_id": 5 } }, + { "delete": 0, "multi": true, "filter": { "$and": [ + { "_id": { "$gt": 5 } }, { "_id": { "$lte": 7 } } ] } } ] db.mongodb.server_connection_id: $$type: [ 'int', 'long' ] db.mongodb.driver_connection_id: diff --git a/source/open-telemetry/tests/operation/count.json b/source/open-telemetry/tests/operation/count.json index 507a9e4746..6083ffc7e5 100644 --- a/source/open-telemetry/tests/operation/count.json +++ b/source/open-telemetry/tests/operation/count.json @@ -44,81 +44,80 @@ "expectResult": 0 } ], - "expectTracingMessages": { - "client": "client0", - "ignoreExtraSpans": false, - "spans": [ - { - "name": "count operation-count.test", - "tags": { - "db.system": "mongodb", - "db.namespace": "operation-count", - "db.collection.name": "test", - "db.operation.name": "count", - "db.operation.summary": "count operation-count.test" - }, - "nested": [ - { - "name": "command count", - "tags": { - "db.system": "mongodb", - "db.namespace": "operation-count", - "db.collection.name": "operation-count.$cmd", - "db.command.name": "count", - "network.transport": "tcp", - "db.mongodb.cursor_id": { - "$$exists": false - }, - "db.response.status_code": { - "$$exists": false - }, - "exception.message": { - "$$exists": false - }, - "exception.type": { - "$$exists": false - }, - "exception.stacktrace": { - "$$exists": false - }, - "server.address": { - "$$type": "string" - }, - "server.port": { - "$$type": [ - "int", - "long" - ] - }, - "server.type": { - "$$type": "string" - }, - "db.query.summary": "count", - "db.query.text": { - "$$matchAsDocument": { - "$$matchAsRoot": { - "count": "test" + "expectTracingMessages": [ + { + "client": "client0", + "ignoreExtraSpans": false, + "spans": [ + { + "name": "estimatedDocumentCount operation-count.test", + "attributes": { + "db.system": "mongodb", + "db.namespace": "operation-count", + "db.collection.name": "test", + "db.operation.name": "estimatedDocumentCount", + "db.operation.summary": "estimatedDocumentCount operation-count.test" + }, + "nested": [ + { + "name": "count operation-count.test", + "attributes": { + "db.system": "mongodb", + "db.namespace": "operation-count", + "db.collection.name": "test", + "db.command.name": "count", + "network.transport": "tcp", + "db.mongodb.cursor_id": { + "$$exists": false + }, + "db.response.status_code": { + "$$exists": false + }, + "exception.message": { + "$$exists": false + }, + "exception.type": { + "$$exists": false + }, + "exception.stacktrace": { + "$$exists": false + }, + "server.address": { + "$$type": "string" + }, + "server.port": { + "$$type": [ + "int", + "long" + ] + }, + "db.query.summary": "count", + "db.query.text": { + "$$matchAsDocument": { + "$$matchAsRoot": { + "count": "test" + } } + }, + "db.mongodb.server_connection_id": { + "$$type": [ + "int", + "long" + ] + }, + "db.mongodb.driver_connection_id": { + "$$type": [ + "int", + "long" + ] } - }, - "db.mongodb.server_connection_id": { - "$$type": [ - "int", - "long" - ] - }, - "db.mongodb.driver_connection_id": { - "$$type": [ - "int", - "long" - ] } } - } - ] - } - ] - } + ] + } + ] + } + ] } ] } diff --git a/source/open-telemetry/tests/operation/count.yml b/source/open-telemetry/tests/operation/count.yml index 4b0ed558d7..0c5147bc36 100644 --- a/source/open-telemetry/tests/operation/count.yml +++ b/source/open-telemetry/tests/operation/count.yml @@ -9,14 +9,14 @@ createEntities: - database: id: database0 client: *client0 - databaseName: operation-count + databaseName: &database0Name operation-count - collection: id: &collection0 collection0 database: database0 - collectionName: test + collectionName: &collection0Name test initialData: - - collectionName: test - databaseName: operation-count + - collectionName: *collection0Name + databaseName: *database0Name documents: [] tests: - description: estimated document count @@ -27,38 +27,37 @@ tests: expectResult: 0 expectTracingMessages: - client: *client0 - ignoreExtraSpans: false - spans: - - name: count operation-count.test - tags: - db.system: mongodb - db.namespace: operation-count - db.collection.name: test - db.operation.name: count - db.operation.summary: count operation-count.test - nested: - - name: command count - tags: - db.system: mongodb - db.namespace: operation-count - db.collection.name: operation-count.$cmd - db.command.name: count - network.transport: tcp - db.mongodb.cursor_id: { $$exists: false } - db.response.status_code: { $$exists: false } - exception.message: { $$exists: false } - exception.type: { $$exists: false } - exception.stacktrace: { $$exists: false } - server.address: { $$type: string } - server.port: { $$type: ['int', 'long'] } - server.type: { $$type: string } - db.query.summary: count - db.query.text: - $$matchAsDocument: - $$matchAsRoot: - count: test - db.mongodb.server_connection_id: - $$type: [ 'int', 'long' ] - db.mongodb.driver_connection_id: - $$type: [ 'int', 'long' ] + - client: *client0 + ignoreExtraSpans: false + spans: + - name: estimatedDocumentCount operation-count.test + attributes: + db.system: mongodb + db.namespace: *database0Name + db.collection.name: *collection0Name + db.operation.name: estimatedDocumentCount + db.operation.summary: estimatedDocumentCount operation-count.test + nested: + - name: count operation-count.test + attributes: + db.system: mongodb + db.namespace: *database0Name + db.collection.name: *collection0Name + db.command.name: count + network.transport: tcp + db.mongodb.cursor_id: { $$exists: false } + db.response.status_code: { $$exists: false } + exception.message: { $$exists: false } + exception.type: { $$exists: false } + exception.stacktrace: { $$exists: false } + server.address: { $$type: string } + server.port: { $$type: ['int', 'long'] } + db.query.summary: count + db.query.text: + $$matchAsDocument: + $$matchAsRoot: + count: test + db.mongodb.server_connection_id: + $$type: [ 'int', 'long' ] + db.mongodb.driver_connection_id: + $$type: [ 'int', 'long' ] diff --git a/source/open-telemetry/tests/operation/create_collection.json b/source/open-telemetry/tests/operation/create_collection.json index 1b510bebbb..c6b521d37b 100644 --- a/source/open-telemetry/tests/operation/create_collection.json +++ b/source/open-telemetry/tests/operation/create_collection.json @@ -31,82 +31,80 @@ } } ], - "expectTracingMessages": { - "client": "client0", - "ignoreExtraSpans": false, - "spans": [ - { - "name": "createCollection operation-create-collection.newlyCreatedCollection", - "tags": { - "db.system": "mongodb", - "db.namespace": "operation-create-collection", - "db.collection.name": "newlyCreatedCollection", - "db.operation.name": "createCollection", - "db.operation.summary": "createCollection operation-create-collection.newlyCreatedCollection" - }, - "nested": [ - { - "name": "command create", - "tags": { - "db.system": "mongodb", - "db.namespace": "operation-create-collection", - "db.collection.name": "operation-create-collection.$cmd", - "db.command.name": "create", - "network.transport": "tcp", - "db.mongodb.cursor_id": { - "$$exists": false - }, - "db.response.status_code": { - "$$exists": false - }, - "exception.message": { - "$$exists": false - }, - "exception.type": { - "$$exists": false - }, - "exception.stacktrace": { - "$$exists": false - }, - "server.address": { - "$$type": "string" - }, - "server.port": { - "$$type": [ - "int", - "long" - ] - }, - "server.type": { - "$$type": "string" - }, - "db.query.summary": "create", - "db.query.text": { - "$$matchAsDocument": { - "$$matchAsRoot": { - "create": "newlyCreatedCollection", - "capped": false + "expectTracingMessages": [ + { + "client": "client0", + "ignoreExtraSpans": false, + "spans": [ + { + "name": "createCollection operation-create-collection.newlyCreatedCollection", + "attributes": { + "db.system": "mongodb", + "db.namespace": "operation-create-collection", + "db.collection.name": "newlyCreatedCollection", + "db.operation.name": "createCollection", + "db.operation.summary": "createCollection operation-create-collection.newlyCreatedCollection" + }, + "nested": [ + { + "name": "create operation-create-collection.newlyCreatedCollection", + "attributes": { + "db.system": "mongodb", + "db.namespace": "operation-create-collection", + "db.collection.name": "newlyCreatedCollection", + "db.command.name": "create", + "network.transport": "tcp", + "db.mongodb.cursor_id": { + "$$exists": false + }, + "db.response.status_code": { + "$$exists": false + }, + "exception.message": { + "$$exists": false + }, + "exception.type": { + "$$exists": false + }, + "exception.stacktrace": { + "$$exists": false + }, + "server.address": { + "$$type": "string" + }, + "server.port": { + "$$type": [ + "int", + "long" + ] + }, + "db.query.summary": "create", + "db.query.text": { + "$$matchAsDocument": { + "$$matchAsRoot": { + "create": "newlyCreatedCollection" + } } + }, + "db.mongodb.server_connection_id": { + "$$type": [ + "int", + "long" + ] + }, + "db.mongodb.driver_connection_id": { + "$$type": [ + "int", + "long" + ] } - }, - "db.mongodb.server_connection_id": { - "$$type": [ - "int", - "long" - ] - }, - "db.mongodb.driver_connection_id": { - "$$type": [ - "int", - "long" - ] } } - } - ] - } - ] - } + ] + } + ] + } + ] } ] } diff --git a/source/open-telemetry/tests/operation/create_collection.yml b/source/open-telemetry/tests/operation/create_collection.yml index c3f39e55e5..da65a6b262 100644 --- a/source/open-telemetry/tests/operation/create_collection.yml +++ b/source/open-telemetry/tests/operation/create_collection.yml @@ -9,49 +9,47 @@ createEntities: - database: id: &database0 database0 client: *client0 - databaseName: operation-create-collection + databaseName: &database0Name operation-create-collection tests: - description: create collection operations: - object: *database0 name: createCollection arguments: - collection: newlyCreatedCollection + collection: &collectionName newlyCreatedCollection expectTracingMessages: - client: *client0 - ignoreExtraSpans: false - spans: - - name: createCollection operation-create-collection.newlyCreatedCollection - tags: - db.system: mongodb - db.namespace: operation-create-collection - db.collection.name: newlyCreatedCollection - db.operation.name: createCollection - db.operation.summary: createCollection operation-create-collection.newlyCreatedCollection - nested: - - name: command create - tags: - db.system: mongodb - db.namespace: operation-create-collection - db.collection.name: operation-create-collection.$cmd - db.command.name: create - network.transport: tcp - db.mongodb.cursor_id: { $$exists: false } - db.response.status_code: { $$exists: false } - exception.message: { $$exists: false } - exception.type: { $$exists: false } - exception.stacktrace: { $$exists: false } - server.address: { $$type: string } - server.port: { $$type: ['int', 'long'] } - server.type: { $$type: string } - db.query.summary: create - db.query.text: - $$matchAsDocument: - $$matchAsRoot: - create: newlyCreatedCollection - capped: false - db.mongodb.server_connection_id: - $$type: [ 'int', 'long' ] - db.mongodb.driver_connection_id: - $$type: [ 'int', 'long' ] + - client: *client0 + ignoreExtraSpans: false + spans: + - name: createCollection operation-create-collection.newlyCreatedCollection + attributes: + db.system: mongodb + db.namespace: *database0Name + db.collection.name: *collectionName + db.operation.name: createCollection + db.operation.summary: createCollection operation-create-collection.newlyCreatedCollection + nested: + - name: create operation-create-collection.newlyCreatedCollection + attributes: + db.system: mongodb + db.namespace: *database0Name + db.collection.name: *collectionName + db.command.name: create + network.transport: tcp + db.mongodb.cursor_id: { $$exists: false } + db.response.status_code: { $$exists: false } + exception.message: { $$exists: false } + exception.type: { $$exists: false } + exception.stacktrace: { $$exists: false } + server.address: { $$type: string } + server.port: { $$type: ['int', 'long'] } + db.query.summary: create + db.query.text: + $$matchAsDocument: + $$matchAsRoot: + create: newlyCreatedCollection + db.mongodb.server_connection_id: + $$type: [ 'int', 'long' ] + db.mongodb.driver_connection_id: + $$type: [ 'int', 'long' ] diff --git a/source/open-telemetry/tests/operation/create_indexes.json b/source/open-telemetry/tests/operation/create_indexes.json index 83dcd89c27..d572f857fe 100644 --- a/source/open-telemetry/tests/operation/create_indexes.json +++ b/source/open-telemetry/tests/operation/create_indexes.json @@ -40,88 +40,88 @@ } } ], - "expectTracingMessages": { - "client": "client0", - "ignoreExtraSpans": false, - "spans": [ - { - "name": "createIndexes operation-create-indexes.test", - "tags": { - "db.system": "mongodb", - "db.namespace": "operation-create-indexes", - "db.collection.name": "test", - "db.operation.name": "createIndexes", - "db.operation.summary": "createIndexes operation-create-indexes.test" - }, - "nested": [ - { - "name": "command createIndexes", - "tags": { - "db.system": "mongodb", - "db.namespace": "operation-create-indexes", - "db.collection.name": "operation-create-indexes.$cmd", - "db.command.name": "createIndexes", - "network.transport": "tcp", - "db.mongodb.cursor_id": { - "$$exists": false - }, - "db.response.status_code": { - "$$exists": false - }, - "exception.message": { - "$$exists": false - }, - "exception.type": { - "$$exists": false - }, - "exception.stacktrace": { - "$$exists": false - }, - "server.address": { - "$$type": "string" - }, - "server.port": { - "$$type": [ - "int", - "long" - ] - }, - "server.type": { - "$$type": "string" - }, - "db.query.summary": "createIndexes", - "db.query.text": { - "$$matchAsDocument": { - "$$matchAsRoot": { - "createIndexes": "test", - "indexes": [ - { - "key": { - "x": 1 + "expectTracingMessages": [ + { + "client": "client0", + "ignoreExtraSpans": false, + "spans": [ + { + "name": "createIndexes operation-create-indexes.test", + "attributes": { + "db.system": "mongodb", + "db.namespace": "operation-create-indexes", + "db.collection.name": "test", + "db.operation.name": "createIndexes", + "db.operation.summary": "createIndexes operation-create-indexes.test" + }, + "nested": [ + { + "name": "createIndexes operation-create-indexes.test", + "attributes": { + "db.system": "mongodb", + "db.namespace": "operation-create-indexes", + "db.collection.name": "test", + "db.command.name": "createIndexes", + "network.transport": "tcp", + "db.mongodb.cursor_id": { + "$$exists": false + }, + "db.response.status_code": { + "$$exists": false + }, + "exception.message": { + "$$exists": false + }, + "exception.type": { + "$$exists": false + }, + "exception.stacktrace": { + "$$exists": false + }, + "server.address": { + "$$type": "string" + }, + "server.port": { + "$$type": [ + "int", + "long" + ] + }, + "db.query.summary": "createIndexes", + "db.query.text": { + "$$matchAsDocument": { + "$$matchAsRoot": { + "createIndexes": "test", + "indexes": [ + { + "key": { + "x": 1 + }, + "name": "x_1" } - } - ] + ] + } } + }, + "db.mongodb.server_connection_id": { + "$$type": [ + "int", + "long" + ] + }, + "db.mongodb.driver_connection_id": { + "$$type": [ + "int", + "long" + ] } - }, - "db.mongodb.server_connection_id": { - "$$type": [ - "int", - "long" - ] - }, - "db.mongodb.driver_connection_id": { - "$$type": [ - "int", - "long" - ] } } - } - ] - } - ] - } + ] + } + ] + } + ] } ] } diff --git a/source/open-telemetry/tests/operation/create_indexes.yml b/source/open-telemetry/tests/operation/create_indexes.yml index 5a011dd794..d2c2ae5d69 100644 --- a/source/open-telemetry/tests/operation/create_indexes.yml +++ b/source/open-telemetry/tests/operation/create_indexes.yml @@ -9,11 +9,11 @@ createEntities: - database: id: &database0 database0 client: *client0 - databaseName: operation-create-indexes + databaseName: &database0Name operation-create-indexes - collection: id: &collection0 collection0 database: *database0 - collectionName: test + collectionName: &collection0Name test tests: - description: create indexes operations: @@ -23,39 +23,38 @@ tests: keys: { x: 1 } expectTracingMessages: - client: *client0 - ignoreExtraSpans: false - spans: - - name: createIndexes operation-create-indexes.test - tags: - db.system: mongodb - db.namespace: operation-create-indexes - db.collection.name: test - db.operation.name: createIndexes - db.operation.summary: createIndexes operation-create-indexes.test - nested: - - name: command createIndexes - tags: - db.system: mongodb - db.namespace: operation-create-indexes - db.collection.name: operation-create-indexes.$cmd - db.command.name: createIndexes - network.transport: tcp - db.mongodb.cursor_id: { $$exists: false } - db.response.status_code: { $$exists: false } - exception.message: { $$exists: false } - exception.type: { $$exists: false } - exception.stacktrace: { $$exists: false } - server.address: { $$type: string } - server.port: { $$type: ['int', 'long'] } - server.type: { $$type: string } - db.query.summary: createIndexes - db.query.text: - $$matchAsDocument: - $$matchAsRoot: - createIndexes: test - indexes: [ { key: { x: 1 } } ] - db.mongodb.server_connection_id: - $$type: [ 'int', 'long' ] - db.mongodb.driver_connection_id: - $$type: [ 'int', 'long' ] + - client: *client0 + ignoreExtraSpans: false + spans: + - name: createIndexes operation-create-indexes.test + attributes: + db.system: mongodb + db.namespace: *database0Name + db.collection.name: *collection0Name + db.operation.name: createIndexes + db.operation.summary: createIndexes operation-create-indexes.test + nested: + - name: createIndexes operation-create-indexes.test + attributes: + db.system: mongodb + db.namespace: *database0Name + db.collection.name: *collection0Name + db.command.name: createIndexes + network.transport: tcp + db.mongodb.cursor_id: { $$exists: false } + db.response.status_code: { $$exists: false } + exception.message: { $$exists: false } + exception.type: { $$exists: false } + exception.stacktrace: { $$exists: false } + server.address: { $$type: string } + server.port: { $$type: ['int', 'long'] } + db.query.summary: createIndexes + db.query.text: + $$matchAsDocument: + $$matchAsRoot: + createIndexes: test + indexes: [ { key: { x: 1 }, name: "x_1" } ] + db.mongodb.server_connection_id: + $$type: [ 'int', 'long' ] + db.mongodb.driver_connection_id: + $$type: [ 'int', 'long' ] diff --git a/source/open-telemetry/tests/operation/create_view.json b/source/open-telemetry/tests/operation/create_view.json index 3d7dbe7f57..2d4a73c49d 100644 --- a/source/open-telemetry/tests/operation/create_view.json +++ b/source/open-telemetry/tests/operation/create_view.json @@ -54,7 +54,7 @@ "spans": [ { "name": "createView operation-create-view.my_view", - "tags": { + "attributes": { "db.system": "mongodb", "db.namespace": "operation-create-view", "db.collection.name": "my_view", @@ -64,7 +64,7 @@ "nested": [ { "name": "command create", - "tags": { + "attributes": { "db.system": "mongodb", "db.namespace": "operation-create-view", "db.collection.name": "operation-create-view.$cmd", diff --git a/source/open-telemetry/tests/operation/create_view.yml b/source/open-telemetry/tests/operation/create_view.yml index feb5a67b61..ce0375af42 100644 --- a/source/open-telemetry/tests/operation/create_view.yml +++ b/source/open-telemetry/tests/operation/create_view.yml @@ -30,7 +30,7 @@ tests: ignoreExtraSpans: false spans: - name: createView operation-create-view.my_view - tags: + attributes: db.system: mongodb db.namespace: operation-create-view db.collection.name: my_view @@ -38,7 +38,7 @@ tests: db.operation.summary: createView operation-create-view.my_view nested: - name: command create - tags: + attributes: db.system: mongodb db.namespace: operation-create-view db.collection.name: operation-create-view.$cmd diff --git a/source/open-telemetry/tests/operation/delete.json b/source/open-telemetry/tests/operation/delete.json index 80f780e905..888515d0dc 100644 --- a/source/open-telemetry/tests/operation/delete.json +++ b/source/open-telemetry/tests/operation/delete.json @@ -42,62 +42,61 @@ } } ], - "expectTracingMessages": { - "client": "client0", - "ignoreExtraSpans": false, - "spans": [ - { - "name": "delete operation-delete.test", - "tags": { - "db.system": "mongodb", - "db.namespace": "operation-delete", - "db.collection.name": "test", - "db.operation.name": "delete", - "db.operation.summary": "delete operation-delete.test" - }, - "nested": [ - { - "name": "command delete", - "tags": { - "db.system": "mongodb", - "db.namespace": "operation-delete", - "server.address": { - "$$type": "string" - }, - "server.port": { - "$$type": [ - "long", - "string" - ] - }, - "server.type": { - "$$type": "string" - }, - "db.query.summary": "delete", - "db.query.text": { - "$$matchAsDocument": { - "$$matchAsRoot": { - "delete": "test", - "ordered": true, - "deletes": [ - { - "q": { - "_id": { - "$gt": 1 - } - }, - "limit": 0 - } - ] + "expectTracingMessages": [ + { + "client": "client0", + "ignoreExtraSpans": false, + "spans": [ + { + "name": "deleteMany operation-delete.test", + "attributes": { + "db.system": "mongodb", + "db.namespace": "operation-delete", + "db.collection.name": "test", + "db.operation.name": "deleteMany", + "db.operation.summary": "deleteMany operation-delete.test" + }, + "nested": [ + { + "name": "delete operation-delete.test", + "attributes": { + "db.system": "mongodb", + "db.namespace": "operation-delete", + "server.address": { + "$$type": "string" + }, + "server.port": { + "$$type": [ + "long", + "string" + ] + }, + "db.query.summary": "delete", + "db.query.text": { + "$$matchAsDocument": { + "$$matchAsRoot": { + "delete": "test", + "ordered": true, + "deletes": [ + { + "q": { + "_id": { + "$gt": 1 + } + }, + "limit": 0 + } + ] + } } } } } - } - ] - } - ] - } + ] + } + ] + } + ] } ] } diff --git a/source/open-telemetry/tests/operation/delete.yml b/source/open-telemetry/tests/operation/delete.yml index 6b68324420..796787fe24 100644 --- a/source/open-telemetry/tests/operation/delete.yml +++ b/source/open-telemetry/tests/operation/delete.yml @@ -9,11 +9,11 @@ createEntities: - database: id: &database0 database0 client: *client0 - databaseName: operation-delete + databaseName: &databaseName0 operation-delete - collection: id: &collection0 collection0 database: *database0 - collectionName: test + collectionName: &collectionName0 test tests: - description: delete elements @@ -24,28 +24,27 @@ tests: filter: { _id: { $gt: 1 } } expectTracingMessages: - client: *client0 - ignoreExtraSpans: false - spans: - - name: delete operation-delete.test - tags: - db.system: mongodb - db.namespace: operation-delete - db.collection.name: test - db.operation.name: delete - db.operation.summary: delete operation-delete.test - nested: - - name: command delete - tags: - db.system: mongodb - db.namespace: operation-delete - server.address: { $$type: string } - server.port: { $$type: [ 'long', 'string' ] } - server.type: { $$type: string } - db.query.summary: delete - db.query.text: - $$matchAsDocument: - $$matchAsRoot: - delete: test - ordered: true - deletes: [ { q: { _id: { $gt: 1 } }, limit: 0 } ] + - client: *client0 + ignoreExtraSpans: false + spans: + - name: deleteMany operation-delete.test + attributes: + db.system: mongodb + db.namespace: *databaseName0 + db.collection.name: *collectionName0 + db.operation.name: deleteMany + db.operation.summary: deleteMany operation-delete.test + nested: + - name: delete operation-delete.test + attributes: + db.system: mongodb + db.namespace: operation-delete + server.address: { $$type: string } + server.port: { $$type: [ 'long', 'string' ] } + db.query.summary: delete + db.query.text: + $$matchAsDocument: + $$matchAsRoot: + delete: test + ordered: true + deletes: [ { q: { _id: { $gt: 1 } }, limit: 0 } ] diff --git a/source/open-telemetry/tests/operation/distinct.json b/source/open-telemetry/tests/operation/distinct.json index cc9c9630da..d9d9ea7841 100644 --- a/source/open-telemetry/tests/operation/distinct.json +++ b/source/open-telemetry/tests/operation/distinct.json @@ -41,87 +41,87 @@ "object": "collection0", "name": "distinct", "arguments": { - "fieldName": "x" + "fieldName": "x", + "filter": {} } } ], - "expectTracingMessages": { - "client": "client0", - "ignoreExtraSpans": false, - "spans": [ - { - "name": "distinct operation-distinct.test", - "tags": { - "db.system": "mongodb", - "db.namespace": "operation-distinct", - "db.collection.name": "test", - "db.operation.name": "distinct", - "db.operation.summary": "distinct operation-distinct.test" - }, - "nested": [ - { - "name": "command distinct", - "tags": { - "db.system": "mongodb", - "db.namespace": "operation-distinct", - "db.collection.name": "operation-distinct.$cmd", - "db.command.name": "distinct", - "network.transport": "tcp", - "db.mongodb.cursor_id": { - "$$exists": false - }, - "db.response.status_code": { - "$$exists": false - }, - "exception.message": { - "$$exists": false - }, - "exception.type": { - "$$exists": false - }, - "exception.stacktrace": { - "$$exists": false - }, - "server.address": { - "$$type": "string" - }, - "server.port": { - "$$type": [ - "int", - "long" - ] - }, - "server.type": { - "$$type": "string" - }, - "db.query.summary": "distinct", - "db.query.text": { - "$$matchAsDocument": { - "$$matchAsRoot": { - "distinct": "test", - "key": "x", - "query": {} + "expectTracingMessages": [ + { + "client": "client0", + "ignoreExtraSpans": false, + "spans": [ + { + "name": "distinct operation-distinct.test", + "attributes": { + "db.system": "mongodb", + "db.namespace": "operation-distinct", + "db.collection.name": "test", + "db.operation.name": "distinct", + "db.operation.summary": "distinct operation-distinct.test" + }, + "nested": [ + { + "name": "distinct operation-distinct.test", + "attributes": { + "db.system": "mongodb", + "db.namespace": "operation-distinct", + "db.collection.name": "test", + "db.command.name": "distinct", + "network.transport": "tcp", + "db.mongodb.cursor_id": { + "$$exists": false + }, + "db.response.status_code": { + "$$exists": false + }, + "exception.message": { + "$$exists": false + }, + "exception.type": { + "$$exists": false + }, + "exception.stacktrace": { + "$$exists": false + }, + "server.address": { + "$$type": "string" + }, + "server.port": { + "$$type": [ + "int", + "long" + ] + }, + "db.query.summary": "distinct", + "db.query.text": { + "$$matchAsDocument": { + "$$matchAsRoot": { + "distinct": "test", + "key": "x", + "query": {} + } } + }, + "db.mongodb.server_connection_id": { + "$$type": [ + "int", + "long" + ] + }, + "db.mongodb.driver_connection_id": { + "$$type": [ + "int", + "long" + ] } - }, - "db.mongodb.server_connection_id": { - "$$type": [ - "int", - "long" - ] - }, - "db.mongodb.driver_connection_id": { - "$$type": [ - "int", - "long" - ] } } - } - ] - } - ] - } + ] + } + ] + } + ] } ] } diff --git a/source/open-telemetry/tests/operation/distinct.yml b/source/open-telemetry/tests/operation/distinct.yml index d4bf6d576a..fd493c14bd 100644 --- a/source/open-telemetry/tests/operation/distinct.yml +++ b/source/open-telemetry/tests/operation/distinct.yml @@ -23,43 +23,44 @@ tests: operations: - object: *collection0 name: distinct - arguments: { fieldName: x } + arguments: + fieldName: x + filter: {} expectTracingMessages: - client: *client0 - ignoreExtraSpans: false - spans: - - name: distinct operation-distinct.test - tags: - db.system: mongodb - db.namespace: operation-distinct - db.collection.name: test - db.operation.name: distinct - db.operation.summary: distinct operation-distinct.test - nested: - - name: command distinct - tags: - db.system: mongodb - db.namespace: operation-distinct - db.collection.name: operation-distinct.$cmd - db.command.name: distinct - network.transport: tcp - db.mongodb.cursor_id: { $$exists: false } - db.response.status_code: { $$exists: false } - exception.message: { $$exists: false } - exception.type: { $$exists: false } - exception.stacktrace: { $$exists: false } - server.address: { $$type: string } - server.port: { $$type: ['int', 'long'] } - server.type: { $$type: string } - db.query.summary: distinct - db.query.text: - $$matchAsDocument: - $$matchAsRoot: - distinct: test - key: x - query: { } - db.mongodb.server_connection_id: - $$type: [ 'int', 'long' ] - db.mongodb.driver_connection_id: - $$type: [ 'int', 'long' ] + - client: *client0 + ignoreExtraSpans: false + spans: + - name: distinct operation-distinct.test + attributes: + db.system: mongodb + db.namespace: operation-distinct + db.collection.name: test + db.operation.name: distinct + db.operation.summary: distinct operation-distinct.test + nested: + - name: distinct operation-distinct.test + attributes: + db.system: mongodb + db.namespace: operation-distinct + db.collection.name: test + db.command.name: distinct + network.transport: tcp + db.mongodb.cursor_id: { $$exists: false } + db.response.status_code: { $$exists: false } + exception.message: { $$exists: false } + exception.type: { $$exists: false } + exception.stacktrace: { $$exists: false } + server.address: { $$type: string } + server.port: { $$type: ['int', 'long'] } + db.query.summary: distinct + db.query.text: + $$matchAsDocument: + $$matchAsRoot: + distinct: test + key: x + query: { } + db.mongodb.server_connection_id: + $$type: [ 'int', 'long' ] + db.mongodb.driver_connection_id: + $$type: [ 'int', 'long' ] diff --git a/source/open-telemetry/tests/operation/drop_collection.json b/source/open-telemetry/tests/operation/drop_collection.json index 04d74f852f..2acf785487 100644 --- a/source/open-telemetry/tests/operation/drop_collection.json +++ b/source/open-telemetry/tests/operation/drop_collection.json @@ -38,81 +38,80 @@ } } ], - "expectTracingMessages": { - "client": "client0", - "ignoreExtraSpans": false, - "spans": [ - { - "name": "dropCollection operation-drop-collection.test", - "tags": { - "db.system": "mongodb", - "db.namespace": "operation-drop-collection", - "db.collection.name": "test", - "db.operation.name": "dropCollection", - "db.operation.summary": "dropCollection operation-drop-collection.test" - }, - "nested": [ - { - "name": "command drop", - "tags": { - "db.system": "mongodb", - "db.namespace": "operation-drop-collection", - "db.collection.name": "operation-drop-collection.$cmd", - "db.command.name": "drop", - "network.transport": "tcp", - "db.mongodb.cursor_id": { - "$$exists": false - }, - "db.response.status_code": { - "$$exists": false - }, - "exception.message": { - "$$exists": false - }, - "exception.type": { - "$$exists": false - }, - "exception.stacktrace": { - "$$exists": false - }, - "server.address": { - "$$type": "string" - }, - "server.port": { - "$$type": [ - "int", - "long" - ] - }, - "server.type": { - "$$type": "string" - }, - "db.query.summary": "drop", - "db.query.text": { - "$$matchAsDocument": { - "$$matchAsRoot": { - "drop": "test" + "expectTracingMessages": [ + { + "client": "client0", + "ignoreExtraSpans": false, + "spans": [ + { + "name": "dropCollection operation-drop-collection.test", + "attributes": { + "db.system": "mongodb", + "db.namespace": "operation-drop-collection", + "db.collection.name": "test", + "db.operation.name": "dropCollection", + "db.operation.summary": "dropCollection operation-drop-collection.test" + }, + "nested": [ + { + "name": "drop operation-drop-collection.test", + "attributes": { + "db.system": "mongodb", + "db.namespace": "operation-drop-collection", + "db.collection.name": "test", + "db.command.name": "drop", + "network.transport": "tcp", + "db.mongodb.cursor_id": { + "$$exists": false + }, + "db.response.status_code": { + "$$exists": false + }, + "exception.message": { + "$$exists": false + }, + "exception.type": { + "$$exists": false + }, + "exception.stacktrace": { + "$$exists": false + }, + "server.address": { + "$$type": "string" + }, + "server.port": { + "$$type": [ + "int", + "long" + ] + }, + "db.query.summary": "drop", + "db.query.text": { + "$$matchAsDocument": { + "$$matchAsRoot": { + "drop": "test" + } } + }, + "db.mongodb.server_connection_id": { + "$$type": [ + "int", + "long" + ] + }, + "db.mongodb.driver_connection_id": { + "$$type": [ + "int", + "long" + ] } - }, - "db.mongodb.server_connection_id": { - "$$type": [ - "int", - "long" - ] - }, - "db.mongodb.driver_connection_id": { - "$$type": [ - "int", - "long" - ] } } - } - ] - } - ] - } + ] + } + ] + } + ] } ] } diff --git a/source/open-telemetry/tests/operation/drop_collection.yml b/source/open-telemetry/tests/operation/drop_collection.yml index f1335c75c4..e254a8f913 100644 --- a/source/open-telemetry/tests/operation/drop_collection.yml +++ b/source/open-telemetry/tests/operation/drop_collection.yml @@ -24,38 +24,37 @@ tests: collection: *collection_name expectTracingMessages: - client: *client0 - ignoreExtraSpans: false - spans: - - name: dropCollection operation-drop-collection.test - tags: - db.system: mongodb - db.namespace: operation-drop-collection - db.collection.name: test - db.operation.name: dropCollection - db.operation.summary: dropCollection operation-drop-collection.test - nested: - - name: command drop - tags: - db.system: mongodb - db.namespace: operation-drop-collection - db.collection.name: operation-drop-collection.$cmd - db.command.name: drop - network.transport: tcp - db.mongodb.cursor_id: { $$exists: false } - db.response.status_code: { $$exists: false } - exception.message: { $$exists: false } - exception.type: { $$exists: false } - exception.stacktrace: { $$exists: false } - server.address: { $$type: string } - server.port: { $$type: ['int', 'long'] } - server.type: { $$type: string } - db.query.summary: drop - db.query.text: - $$matchAsDocument: - $$matchAsRoot: - drop: test - db.mongodb.server_connection_id: - $$type: [ 'int', 'long' ] - db.mongodb.driver_connection_id: - $$type: [ 'int', 'long' ] + - client: *client0 + ignoreExtraSpans: false + spans: + - name: dropCollection operation-drop-collection.test + attributes: + db.system: mongodb + db.namespace: operation-drop-collection + db.collection.name: test + db.operation.name: dropCollection + db.operation.summary: dropCollection operation-drop-collection.test + nested: + - name: drop operation-drop-collection.test + attributes: + db.system: mongodb + db.namespace: operation-drop-collection + db.collection.name: test + db.command.name: drop + network.transport: tcp + db.mongodb.cursor_id: { $$exists: false } + db.response.status_code: { $$exists: false } + exception.message: { $$exists: false } + exception.type: { $$exists: false } + exception.stacktrace: { $$exists: false } + server.address: { $$type: string } + server.port: { $$type: ['int', 'long'] } + db.query.summary: drop + db.query.text: + $$matchAsDocument: + $$matchAsRoot: + drop: test + db.mongodb.server_connection_id: + $$type: [ 'int', 'long' ] + db.mongodb.driver_connection_id: + $$type: [ 'int', 'long' ] diff --git a/source/open-telemetry/tests/operation/drop_indexes.json b/source/open-telemetry/tests/operation/drop_indexes.json index 006db8ea0c..79a1d0cd3a 100644 --- a/source/open-telemetry/tests/operation/drop_indexes.json +++ b/source/open-telemetry/tests/operation/drop_indexes.json @@ -24,6 +24,26 @@ "database": "database0", "collectionName": "test" } + }, + { + "client": { + "id": "clientWithoutTracing", + "useMultipleMongoses": false + } + }, + { + "database": { + "id": "databaseWithoutTracing", + "client": "clientWithoutTracing", + "databaseName": "operation-drop-indexes" + } + }, + { + "collection": { + "id": "collectionWithoutTracing", + "database": "databaseWithoutTracing", + "collectionName": "test" + } } ], "tests": [ @@ -32,7 +52,7 @@ "operations": [ { "name": "createIndex", - "object": "collection0", + "object": "collectionWithoutTracing", "arguments": { "keys": { "x": 1 @@ -45,82 +65,81 @@ "object": "collection0" } ], - "expectTracingMessages": { - "client": "client0", - "ignoreExtraSpans": true, - "spans": [ - { - "name": "dropIndexes operation-drop-indexes.test", - "tags": { - "db.system": "mongodb", - "db.namespace": "operation-drop-indexes", - "db.collection.name": "test", - "db.operation.name": "dropIndexes", - "db.operation.summary": "dropIndexes operation-drop-indexes.test" - }, - "nested": [ - { - "name": "command dropIndexes", - "tags": { - "db.system": "mongodb", - "db.namespace": "operation-drop-indexes", - "db.collection.name": "operation-drop-indexes.$cmd", - "db.command.name": "dropIndexes", - "network.transport": "tcp", - "db.mongodb.cursor_id": { - "$$exists": false - }, - "db.response.status_code": { - "$$exists": false - }, - "exception.message": { - "$$exists": false - }, - "exception.type": { - "$$exists": false - }, - "exception.stacktrace": { - "$$exists": false - }, - "server.address": { - "$$type": "string" - }, - "server.port": { - "$$type": [ - "int", - "long" - ] - }, - "server.type": { - "$$type": "string" - }, - "db.query.summary": "dropIndexes", - "db.query.text": { - "$$matchAsDocument": { - "$$matchAsRoot": { - "dropIndexes": "test", - "index": "*" + "expectTracingMessages": [ + { + "client": "client0", + "ignoreExtraSpans": true, + "spans": [ + { + "name": "dropIndexes operation-drop-indexes.test", + "attributes": { + "db.system": "mongodb", + "db.namespace": "operation-drop-indexes", + "db.collection.name": "test", + "db.operation.name": "dropIndexes", + "db.operation.summary": "dropIndexes operation-drop-indexes.test" + }, + "nested": [ + { + "name": "dropIndexes operation-drop-indexes.test", + "attributes": { + "db.system": "mongodb", + "db.namespace": "operation-drop-indexes", + "db.collection.name": "test", + "db.command.name": "dropIndexes", + "network.transport": "tcp", + "db.mongodb.cursor_id": { + "$$exists": false + }, + "db.response.status_code": { + "$$exists": false + }, + "exception.message": { + "$$exists": false + }, + "exception.type": { + "$$exists": false + }, + "exception.stacktrace": { + "$$exists": false + }, + "server.address": { + "$$type": "string" + }, + "server.port": { + "$$type": [ + "int", + "long" + ] + }, + "db.query.summary": "dropIndexes", + "db.query.text": { + "$$matchAsDocument": { + "$$matchAsRoot": { + "dropIndexes": "test", + "index": "*" + } } + }, + "db.mongodb.server_connection_id": { + "$$type": [ + "int", + "long" + ] + }, + "db.mongodb.driver_connection_id": { + "$$type": [ + "int", + "long" + ] } - }, - "db.mongodb.server_connection_id": { - "$$type": [ - "int", - "long" - ] - }, - "db.mongodb.driver_connection_id": { - "$$type": [ - "int", - "long" - ] } } - } - ] - } - ] - } + ] + } + ] + } + ] } ] } diff --git a/source/open-telemetry/tests/operation/drop_indexes.yml b/source/open-telemetry/tests/operation/drop_indexes.yml index 117a428863..8dd3f5daef 100644 --- a/source/open-telemetry/tests/operation/drop_indexes.yml +++ b/source/open-telemetry/tests/operation/drop_indexes.yml @@ -14,12 +14,23 @@ createEntities: id: &collection0 collection0 database: *database0 collectionName: test + - client: + id: &clientWithoutTracing clientWithoutTracing + useMultipleMongoses: false + - database: + id: &databaseWithoutTracing databaseWithoutTracing + client: *clientWithoutTracing + databaseName: operation-drop-indexes + - collection: + id: &collectionWithoutTracing collectionWithoutTracing + database: *databaseWithoutTracing + collectionName: test tests: - description: drop indexes operations: - name: createIndex - object: *collection0 + object: *collectionWithoutTracing arguments: keys: x: 1 @@ -30,39 +41,38 @@ tests: expectTracingMessages: - client: *client0 - ignoreExtraSpans: true - spans: - - name: dropIndexes operation-drop-indexes.test - tags: - db.system: mongodb - db.namespace: operation-drop-indexes - db.collection.name: test - db.operation.name: dropIndexes - db.operation.summary: dropIndexes operation-drop-indexes.test - nested: - - name: command dropIndexes - tags: - db.system: mongodb - db.namespace: operation-drop-indexes - db.collection.name: operation-drop-indexes.$cmd - db.command.name: dropIndexes - network.transport: tcp - db.mongodb.cursor_id: { $$exists: false } - db.response.status_code: { $$exists: false } - exception.message: { $$exists: false } - exception.type: { $$exists: false } - exception.stacktrace: { $$exists: false } - server.address: { $$type: string } - server.port: { $$type: ['int', 'long'] } - server.type: { $$type: string } - db.query.summary: dropIndexes - db.query.text: - $$matchAsDocument: - $$matchAsRoot: - dropIndexes: test - index: '*' - db.mongodb.server_connection_id: - $$type: [ 'int', 'long' ] - db.mongodb.driver_connection_id: - $$type: [ 'int', 'long' ] + - client: *client0 + ignoreExtraSpans: true + spans: + - name: dropIndexes operation-drop-indexes.test + attributes: + db.system: mongodb + db.namespace: operation-drop-indexes + db.collection.name: test + db.operation.name: dropIndexes + db.operation.summary: dropIndexes operation-drop-indexes.test + nested: + - name: dropIndexes operation-drop-indexes.test + attributes: + db.system: mongodb + db.namespace: operation-drop-indexes + db.collection.name: test + db.command.name: dropIndexes + network.transport: tcp + db.mongodb.cursor_id: { $$exists: false } + db.response.status_code: { $$exists: false } + exception.message: { $$exists: false } + exception.type: { $$exists: false } + exception.stacktrace: { $$exists: false } + server.address: { $$type: string } + server.port: { $$type: ['int', 'long'] } + db.query.summary: dropIndexes + db.query.text: + $$matchAsDocument: + $$matchAsRoot: + dropIndexes: test + index: '*' + db.mongodb.server_connection_id: + $$type: [ 'int', 'long' ] + db.mongodb.driver_connection_id: + $$type: [ 'int', 'long' ] diff --git a/source/open-telemetry/tests/operation/find.json b/source/open-telemetry/tests/operation/find.json index bdf493c73f..dbee338ae2 100644 --- a/source/open-telemetry/tests/operation/find.json +++ b/source/open-telemetry/tests/operation/find.json @@ -47,84 +47,86 @@ } } ], - "expectTracingMessages": { - "client": "client0", - "ignoreExtraSpans": false, - "spans": [ - { - "name": "find operation-find.test", - "tags": { - "db.system": "mongodb", - "db.namespace": "operation-find", - "db.collection.name": "test", - "db.operation.name": "find", - "db.operation.summary": "find operation-find.test" - }, - "nested": [ - { - "name": "command find", - "tags": { - "db.system": "mongodb", - "db.namespace": "operation-find", - "db.collection.name": "operation-find.$cmd", - "db.command.name": "find", - "network.transport": "tcp", - "db.mongodb.cursor_id": { - "$$exists": false - }, - "db.response.status_code": { - "$$exists": false - }, - "exception.message": { - "$$exists": false - }, - "exception.type": { - "$$exists": false - }, - "exception.stacktrace": { - "$$exists": false - }, - "server.address": { - "$$type": "string" - }, - "server.port": { - "$$type": [ - "int", - "long" - ] - }, - "server.type": { - "$$type": "string" - }, - "db.query.summary": "find", - "db.query.text": { - "$$matchAsDocument": { - "$$matchAsRoot": { - "find": "test", - "filter": { - "x": 1 + "expectTracingMessages": [ + { + "client": "client0", + "ignoreExtraSpans": false, + "spans": [ + { + "name": "find operation-find.test", + "attributes": { + "db.system": "mongodb", + "db.namespace": "operation-find", + "db.collection.name": "test", + "db.operation.name": "find", + "db.operation.summary": "find operation-find.test" + }, + "nested": [ + { + "name": "find operation-find.test", + "attributes": { + "db.system": "mongodb", + "db.namespace": "operation-find", + "db.collection.name": "operation-find.$cmd", + "db.command.name": "find", + "network.transport": "tcp", + "db.mongodb.cursor_id": { + "$$exists": false + }, + "db.response.status_code": { + "$$exists": false + }, + "exception.message": { + "$$exists": false + }, + "exception.type": { + "$$exists": false + }, + "exception.stacktrace": { + "$$exists": false + }, + "server.address": { + "$$type": "string" + }, + "server.port": { + "$$type": [ + "int", + "long" + ] + }, + "server.type": { + "$$type": "string" + }, + "db.query.summary": "find", + "db.query.text": { + "$$matchAsDocument": { + "$$matchAsRoot": { + "find": "test", + "filter": { + "x": 1 + } } } + }, + "db.mongodb.server_connection_id": { + "$$type": [ + "int", + "long" + ] + }, + "db.mongodb.driver_connection_id": { + "$$type": [ + "int", + "long" + ] } - }, - "db.mongodb.server_connection_id": { - "$$type": [ - "int", - "long" - ] - }, - "db.mongodb.driver_connection_id": { - "$$type": [ - "int", - "long" - ] } } - } - ] - } - ] - } + ] + } + ] + } + ] } ] } diff --git a/source/open-telemetry/tests/operation/find.yml b/source/open-telemetry/tests/operation/find.yml index 4d5351df64..c92a70fcc2 100644 --- a/source/open-telemetry/tests/operation/find.yml +++ b/source/open-telemetry/tests/operation/find.yml @@ -13,7 +13,7 @@ createEntities: - collection: id: &collection0 collection0 database: database0 - collectionName: test + collectionName: &collection0Name test initialData: - collectionName: test databaseName: operation-find @@ -26,40 +26,40 @@ tests: arguments: { filter: { x: 1 } } expectTracingMessages: - client: *client0 - ignoreExtraSpans: false - spans: - - name: find operation-find.test - tags: - db.system: mongodb - db.namespace: operation-find - db.collection.name: test - db.operation.name: find - db.operation.summary: find operation-find.test - nested: - - name: command find - tags: - db.system: mongodb - db.namespace: operation-find - db.collection.name: operation-find.$cmd - db.command.name: find - network.transport: tcp - db.mongodb.cursor_id: { $$exists: false } - db.response.status_code: { $$exists: false } - exception.message: { $$exists: false } - exception.type: { $$exists: false } - exception.stacktrace: { $$exists: false } - server.address: { $$type: string } - server.port: { $$type: ['int', 'long'] } - server.type: { $$type: string } - db.query.summary: find - db.query.text: - $$matchAsDocument: - $$matchAsRoot: - find: test - filter: - x: 1 - db.mongodb.server_connection_id: - $$type: [ 'int', 'long' ] - db.mongodb.driver_connection_id: - $$type: [ 'int', 'long' ] + - client: *client0 + ignoreExtraSpans: false + spans: + - name: find operation-find.test + attributes: + db.system: mongodb + db.namespace: operation-find + db.collection.name: test + db.operation.name: find + db.operation.summary: find operation-find.test + nested: + - name: find operation-find.test + attributes: + db.system: mongodb + db.namespace: operation-find + db.collection.name: operation-find.$cmd + db.command.name: find + network.transport: tcp + db.mongodb.cursor_id: { $$exists: false } + db.response.status_code: { $$exists: false } + exception.message: { $$exists: false } + exception.type: { $$exists: false } + exception.stacktrace: { $$exists: false } + server.address: { $$type: string } + server.port: { $$type: ['int', 'long'] } + server.type: { $$type: string } + db.query.summary: find + db.query.text: + $$matchAsDocument: + $$matchAsRoot: + find: test + filter: + x: 1 + db.mongodb.server_connection_id: + $$type: [ 'int', 'long' ] + db.mongodb.driver_connection_id: + $$type: [ 'int', 'long' ] diff --git a/source/open-telemetry/tests/operation/find_one_and_update.json b/source/open-telemetry/tests/operation/find_one_and_update.json index b33c84095b..0fcbd1b6c6 100644 --- a/source/open-telemetry/tests/operation/find_one_and_update.json +++ b/source/open-telemetry/tests/operation/find_one_and_update.json @@ -48,92 +48,91 @@ } } ], - "expectTracingMessages": { - "client": "client0", - "ignoreExtraSpans": false, - "spans": [ - { - "name": "findAndModify operation-aggregate.test", - "tags": { - "db.system": "mongodb", - "db.namespace": "operation-aggregate", - "db.collection.name": "test", - "db.operation.name": "findAndModify", - "db.operation.summary": "findAndModify operation-aggregate.test" - }, - "nested": [ - { - "name": "command findAndModify", - "tags": { - "db.system": "mongodb", - "db.namespace": "operation-aggregate", - "db.collection.name": "operation-aggregate.$cmd", - "db.command.name": "findAndModify", - "network.transport": "tcp", - "db.mongodb.cursor_id": { - "$$exists": false - }, - "db.response.status_code": { - "$$exists": false - }, - "exception.message": { - "$$exists": false - }, - "exception.type": { - "$$exists": false - }, - "exception.stacktrace": { - "$$exists": false - }, - "server.address": { - "$$type": "string" - }, - "server.port": { - "$$type": [ - "int", - "long" - ] - }, - "server.type": { - "$$type": "string" - }, - "db.query.summary": "findAndModify", - "db.query.text": { - "$$matchAsDocument": { - "$$matchAsRoot": { - "findAndModify": "test", - "query": { - "_id": 1 - }, - "update": [ - { - "$set": { - "x": 5 + "expectTracingMessages": [ + { + "client": "client0", + "ignoreExtraSpans": false, + "spans": [ + { + "name": "findOneAndUpdate operation-aggregate.test", + "attributes": { + "db.system": "mongodb", + "db.namespace": "operation-aggregate", + "db.collection.name": "test", + "db.operation.name": "findOneAndUpdate", + "db.operation.summary": "findOneAndUpdate operation-aggregate.test" + }, + "nested": [ + { + "name": "findAndModify operation-aggregate.test", + "attributes": { + "db.system": "mongodb", + "db.namespace": "operation-aggregate", + "db.collection.name": "test", + "db.command.name": "findAndModify", + "network.transport": "tcp", + "db.mongodb.cursor_id": { + "$$exists": false + }, + "db.response.status_code": { + "$$exists": false + }, + "exception.message": { + "$$exists": false + }, + "exception.type": { + "$$exists": false + }, + "exception.stacktrace": { + "$$exists": false + }, + "server.address": { + "$$type": "string" + }, + "server.port": { + "$$type": [ + "int", + "long" + ] + }, + "db.query.summary": "findAndModify", + "db.query.text": { + "$$matchAsDocument": { + "$$matchAsRoot": { + "findAndModify": "test", + "query": { + "_id": 1 + }, + "update": [ + { + "$set": { + "x": 5 + } } - } - ], - "comment": "comment" + ], + "comment": "comment" + } } + }, + "db.mongodb.server_connection_id": { + "$$type": [ + "int", + "long" + ] + }, + "db.mongodb.driver_connection_id": { + "$$type": [ + "int", + "long" + ] } - }, - "db.mongodb.server_connection_id": { - "$$type": [ - "int", - "long" - ] - }, - "db.mongodb.driver_connection_id": { - "$$type": [ - "int", - "long" - ] } } - } - ] - } - ] - } + ] + } + ] + } + ] } ] } diff --git a/source/open-telemetry/tests/operation/find_one_and_update.yml b/source/open-telemetry/tests/operation/find_one_and_update.yml index 72e55f3ef5..e956186832 100644 --- a/source/open-telemetry/tests/operation/find_one_and_update.yml +++ b/source/open-telemetry/tests/operation/find_one_and_update.yml @@ -28,41 +28,40 @@ tests: comment: "comment" expectTracingMessages: - client: *client0 - ignoreExtraSpans: false - spans: - - name: findAndModify operation-aggregate.test - tags: - db.system: mongodb - db.namespace: operation-aggregate - db.collection.name: test - db.operation.name: findAndModify - db.operation.summary: findAndModify operation-aggregate.test - nested: - - name: command findAndModify - tags: - db.system: mongodb - db.namespace: operation-aggregate - db.collection.name: operation-aggregate.$cmd - db.command.name: findAndModify - network.transport: tcp - db.mongodb.cursor_id: { $$exists: false } - db.response.status_code: { $$exists: false } - exception.message: { $$exists: false } - exception.type: { $$exists: false } - exception.stacktrace: { $$exists: false } - server.address: { $$type: string } - server.port: { $$type: ['int', 'long'] } - server.type: { $$type: string } - db.query.summary: findAndModify - db.query.text: - $$matchAsDocument: - $$matchAsRoot: - findAndModify: test - query: *filter - update: *update - comment: "comment" - db.mongodb.server_connection_id: - $$type: [ 'int', 'long' ] - db.mongodb.driver_connection_id: - $$type: [ 'int', 'long' ] + - client: *client0 + ignoreExtraSpans: false + spans: + - name: findOneAndUpdate operation-aggregate.test + attributes: + db.system: mongodb + db.namespace: operation-aggregate + db.collection.name: test + db.operation.name: findOneAndUpdate + db.operation.summary: findOneAndUpdate operation-aggregate.test + nested: + - name: findAndModify operation-aggregate.test + attributes: + db.system: mongodb + db.namespace: operation-aggregate + db.collection.name: test + db.command.name: findAndModify + network.transport: tcp + db.mongodb.cursor_id: { $$exists: false } + db.response.status_code: { $$exists: false } + exception.message: { $$exists: false } + exception.type: { $$exists: false } + exception.stacktrace: { $$exists: false } + server.address: { $$type: string } + server.port: { $$type: ['int', 'long'] } + db.query.summary: findAndModify + db.query.text: + $$matchAsDocument: + $$matchAsRoot: + findAndModify: test + query: *filter + update: *update + comment: "comment" + db.mongodb.server_connection_id: + $$type: [ 'int', 'long' ] + db.mongodb.driver_connection_id: + $$type: [ 'int', 'long' ] diff --git a/source/open-telemetry/tests/operation/find_retries.json b/source/open-telemetry/tests/operation/find_retries.json new file mode 100644 index 0000000000..a505ab470d --- /dev/null +++ b/source/open-telemetry/tests/operation/find_retries.json @@ -0,0 +1,212 @@ +{ + "description": "operation find retrying failed command", + "schemaVersion": "1.26", + "createEntities": [ + { + "client": { + "id": "client0", + "useMultipleMongoses": false, + "observeTracingMessages": { + "enableCommandPayload": true + } + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "operation-find-retries" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "test" + } + } + ], + "initialData": [ + { + "collectionName": "test", + "databaseName": "operation-find-retries", + "documents": [] + } + ], + "tests": [ + { + "description": "find an element", + "operations": [ + { + "name": "failPoint", + "object": "testRunner", + "arguments": { + "client": "client0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "find" + ], + "errorCode": 89, + "errorLabels": [ + "RetryableWriteError" + ] + } + } + } + }, + { + "name": "find", + "object": "collection0", + "arguments": { + "filter": { + "x": 1 + } + } + } + ], + "expectTracingMessages": { + "client": "client0", + "ignoreExtraSpans": true, + "spans": [ + { + "name": "find operation-find-retries.test", + "attributes": { + "db.system": "mongodb", + "db.namespace": "operation-find-retries", + "db.collection.name": "test", + "db.operation.name": "find", + "db.operation.summary": "find operation-find-retries.test" + }, + "nested": [ + { + "name": "command find", + "attributes": { + "db.system": "mongodb", + "db.namespace": "operation-find-retries", + "db.collection.name": "operation-find-retries.$cmd", + "db.command.name": "find", + "network.transport": "tcp", + "db.mongodb.cursor_id": { + "$$exists": false + }, + "db.response.status_code": { + "$$exists": false + }, + "exception.message": { + "$$type": "string" + }, + "exception.type": { + "$$type": "string" + }, + "exception.stacktrace": { + "$$type": "string" + }, + "server.address": { + "$$type": "string" + }, + "server.port": { + "$$type": [ + "long", + "string" + ] + }, + "server.type": { + "$$type": "string" + }, + "db.query.summary": "find", + "db.query.text": { + "$$matchAsDocument": { + "$$matchAsRoot": { + "find": "test", + "filter": { + "x": 1 + } + } + } + }, + "db.mongodb.server_connection_id": { + "$$type": [ + "int", + "long" + ] + }, + "db.mongodb.driver_connection_id": { + "$$type": [ + "int", + "long" + ] + } + } + }, + { + "name": "command find", + "attributes": { + "db.system": "mongodb", + "db.namespace": "operation-find-retries", + "db.collection.name": "operation-find-retries.$cmd", + "db.command.name": "find", + "network.transport": "tcp", + "db.mongodb.cursor_id": { + "$$exists": false + }, + "db.response.status_code": { + "$$exists": false + }, + "exception.message": { + "$$exists": false + }, + "exception.type": { + "$$exists": false + }, + "exception.stacktrace": { + "$$exists": false + }, + "server.address": { + "$$type": "string" + }, + "server.port": { + "$$type": [ + "int", + "long" + ] + }, + "server.type": { + "$$type": "string" + }, + "db.query.summary": "find", + "db.query.text": { + "$$matchAsDocument": { + "$$matchAsRoot": { + "find": "test", + "filter": { + "x": 1 + } + } + } + }, + "db.mongodb.server_connection_id": { + "$$type": [ + "int", + "long" + ] + }, + "db.mongodb.driver_connection_id": { + "$$type": [ + "int", + "long" + ] + } + } + } + ] + } + ] + } + } + ] +} diff --git a/source/open-telemetry/tests/operation/find_retries.yml b/source/open-telemetry/tests/operation/find_retries.yml new file mode 100644 index 0000000000..d613c4a21e --- /dev/null +++ b/source/open-telemetry/tests/operation/find_retries.yml @@ -0,0 +1,103 @@ +description: operation find retrying failed command +schemaVersion: '1.26' +createEntities: + - client: + id: &client0 client0 + useMultipleMongoses: false + observeTracingMessages: + enableCommandPayload: true + - database: + id: &database0 database0 + client: *client0 + databaseName: operation-find-retries + - collection: + id: &collection0 collection0 + database: *database0 + collectionName: test +initialData: + - collectionName: test + databaseName: operation-find-retries + documents: [] +tests: + - description: find an element + operations: + - name: failPoint + object: testRunner + arguments: + client: *client0 + failPoint: + configureFailPoint: failCommand + mode: { times: 1 } + data: + failCommands: [ find ] + errorCode: 89 + errorLabels: [ RetryableWriteError ] + + - name: find + object: *collection0 + arguments: + filter: { x: 1 } + expectTracingMessages: + client: *client0 + ignoreExtraSpans: true + spans: + - name: find operation-find-retries.test + attributes: + db.system: mongodb + db.namespace: operation-find-retries + db.collection.name: test + db.operation.name: find + db.operation.summary: find operation-find-retries.test + nested: + - name: command find + attributes: + db.system: mongodb + db.namespace: operation-find-retries + db.collection.name: operation-find-retries.$cmd + db.command.name: find + network.transport: tcp + db.mongodb.cursor_id: { $$exists: false } + db.response.status_code: { $$exists: false } + exception.message: { $$type: string } + exception.type: { $$type: string } + exception.stacktrace: { $$type: string } + server.address: { $$type: string } + server.port: { $$type: ['long', 'string'] } + server.type: { $$type: string } + db.query.summary: find + db.query.text: + $$matchAsDocument: + $$matchAsRoot: + find: test + filter: + x: 1 + db.mongodb.server_connection_id: + $$type: [ 'int', 'long' ] + db.mongodb.driver_connection_id: + $$type: [ 'int', 'long' ] + - name: command find + attributes: + db.system: mongodb + db.namespace: operation-find-retries + db.collection.name: operation-find-retries.$cmd + db.command.name: find + network.transport: tcp + db.mongodb.cursor_id: { $$exists: false } + db.response.status_code: { $$exists: false } + exception.message: { $$exists: false } + exception.type: { $$exists: false } + exception.stacktrace: { $$exists: false } + server.address: { $$type: string } + server.port: { $$type: ['int', 'long'] } + server.type: { $$type: string } + db.query.summary: find + db.query.text: + $$matchAsDocument: + $$matchAsRoot: + find: test + filter: + x: 1 + db.mongodb.server_connection_id: + $$type: [ 'int', 'long' ] + db.mongodb.driver_connection_id: + $$type: [ 'int', 'long' ] diff --git a/source/open-telemetry/tests/operation/insert.json b/source/open-telemetry/tests/operation/insert.json index c50391770d..b617e6ceee 100644 --- a/source/open-telemetry/tests/operation/insert.json +++ b/source/open-telemetry/tests/operation/insert.json @@ -53,7 +53,7 @@ "spans": [ { "name": "insert operation-insert.test", - "tags": { + "attributes": { "db.system": "mongodb", "db.namespace": "operation-insert", "db.collection.name": "test", @@ -63,7 +63,7 @@ "nested": [ { "name": "command insert", - "tags": { + "attributes": { "db.system": "mongodb", "db.namespace": "operation-insert", "server.address": { diff --git a/source/open-telemetry/tests/operation/insert.yml b/source/open-telemetry/tests/operation/insert.yml index 0a02a6128b..90930222da 100644 --- a/source/open-telemetry/tests/operation/insert.yml +++ b/source/open-telemetry/tests/operation/insert.yml @@ -30,7 +30,7 @@ tests: ignoreExtraSpans: false spans: - name: insert operation-insert.test - tags: + attributes: db.system: mongodb db.namespace: operation-insert db.collection.name: test @@ -38,7 +38,7 @@ tests: db.operation.summary: insert operation-insert.test nested: - name: command insert - tags: + attributes: db.system: mongodb db.namespace: operation-insert server.address: { $$type: string } diff --git a/source/open-telemetry/tests/operation/list_collections.json b/source/open-telemetry/tests/operation/list_collections.json index 7add74857e..62eb1bee48 100644 --- a/source/open-telemetry/tests/operation/list_collections.json +++ b/source/open-telemetry/tests/operation/list_collections.json @@ -28,26 +28,26 @@ "name": "listCollections" } ], - "expectTracingMessages": { - "client": "client0", - "ignoreExtraSpans": false, - "spans": [ - { - "name": "listCollections operation-list-collections.$cmd", - "tags": { - "db.system": "mongodb", + "expectTracingMessages": [ + { + "client": "client0", + "ignoreExtraSpans": false, + "spans": [ + { + "name": "listCollections operation-list-collections", + "attributes": { + "db.system": "mongodb" + }, "db.namespace": "operation-list-collections", - "db.collection.name": "$cmd", "db.operation.name": "listCollections", - "db.operation.summary": "listCollections operation-list-collections.$cmd" - }, - "nested": [ - { - "name": "command listCollections", - "tags": { - "db.system": "mongodb", + "db.operation.summary": "listCollections operation-list-collections", + "nested": [ + { + "name": "listCollections operation-list-collections", + "attributes": { + "db.system": "mongodb" + }, "db.namespace": "operation-list-collections", - "db.collection.name": "operation-list-collections.$cmd", "db.command.name": "listCollections", "network.transport": "tcp", "db.mongodb.cursor_id": { @@ -74,9 +74,6 @@ "long" ] }, - "server.type": { - "$$type": "string" - }, "db.query.summary": "listCollections", "db.query.text": { "$$matchAsDocument": { @@ -99,11 +96,11 @@ ] } } - } - ] - } - ] - } + ] + } + ] + } + ] } ] } diff --git a/source/open-telemetry/tests/operation/list_collections.yml b/source/open-telemetry/tests/operation/list_collections.yml index 0280fa90ee..7f258af51c 100644 --- a/source/open-telemetry/tests/operation/list_collections.yml +++ b/source/open-telemetry/tests/operation/list_collections.yml @@ -17,39 +17,36 @@ tests: name: listCollections expectTracingMessages: - client: *client0 - ignoreExtraSpans: false - spans: - - name: listCollections operation-list-collections.$cmd - tags: - db.system: mongodb - db.namespace: operation-list-collections - db.collection.name: $cmd - db.operation.name: listCollections - db.operation.summary: listCollections operation-list-collections.$cmd - nested: - - name: command listCollections - tags: - db.system: mongodb - db.namespace: operation-list-collections - db.collection.name: operation-list-collections.$cmd - db.command.name: listCollections - network.transport: tcp - db.mongodb.cursor_id: { $$exists: false } - db.response.status_code: { $$exists: false } - exception.message: { $$exists: false } - exception.type: { $$exists: false } - exception.stacktrace: { $$exists: false } - server.address: { $$type: string } - server.port: { $$type: ['int', 'long'] } - server.type: { $$type: string } - db.query.summary: listCollections - db.query.text: - $$matchAsDocument: - $$matchAsRoot: - listCollections: 1 - cursor: {} - db.mongodb.server_connection_id: - $$type: [ 'int', 'long' ] - db.mongodb.driver_connection_id: - $$type: [ 'int', 'long' ] + - client: *client0 + ignoreExtraSpans: false + spans: + - name: listCollections operation-list-collections + attributes: + db.system: mongodb + db.namespace: operation-list-collections + db.operation.name: listCollections + db.operation.summary: listCollections operation-list-collections + nested: + - name: listCollections operation-list-collections + attributes: + db.system: mongodb + db.namespace: operation-list-collections + db.command.name: listCollections + network.transport: tcp + db.mongodb.cursor_id: { $$exists: false } + db.response.status_code: { $$exists: false } + exception.message: { $$exists: false } + exception.type: { $$exists: false } + exception.stacktrace: { $$exists: false } + server.address: { $$type: string } + server.port: { $$type: ['int', 'long'] } + db.query.summary: listCollections + db.query.text: + $$matchAsDocument: + $$matchAsRoot: + listCollections: 1 + cursor: {} + db.mongodb.server_connection_id: + $$type: [ 'int', 'long' ] + db.mongodb.driver_connection_id: + $$type: [ 'int', 'long' ] diff --git a/source/open-telemetry/tests/operation/list_databases.json b/source/open-telemetry/tests/operation/list_databases.json index 4b8d48b562..ab333cd47c 100644 --- a/source/open-telemetry/tests/operation/list_databases.json +++ b/source/open-telemetry/tests/operation/list_databases.json @@ -21,81 +21,78 @@ "name": "listDatabases" } ], - "expectTracingMessages": { - "client": "client0", - "ignoreExtraSpans": false, - "spans": [ - { - "name": "listDatabases admin.$cmd", - "tags": { - "db.system": "mongodb", + "expectTracingMessages": [ + { + "client": "client0", + "ignoreExtraSpans": false, + "spans": [ + { + "name": "listDatabases", + "attributes": { + "db.system": "mongodb" + }, "db.namespace": "admin", - "db.collection.name": "$cmd", "db.operation.name": "listDatabases", - "db.operation.summary": "listDatabases admin.$cmd" - }, - "nested": [ - { - "name": "command listDatabases", - "tags": { - "db.system": "mongodb", - "db.namespace": "admin", - "db.collection.name": "admin.$cmd", - "db.command.name": "listDatabases", - "network.transport": "tcp", - "db.mongodb.cursor_id": { - "$$exists": false - }, - "db.response.status_code": { - "$$exists": false - }, - "exception.message": { - "$$exists": false - }, - "exception.type": { - "$$exists": false - }, - "exception.stacktrace": { - "$$exists": false - }, - "server.address": { - "$$type": "string" - }, - "server.port": { - "$$type": [ - "int", - "long" - ] - }, - "server.type": { - "$$type": "string" - }, - "db.query.summary": "listDatabases", - "db.query.text": { - "$$matchAsDocument": { - "$$matchAsRoot": { - "listDatabases": 1 + "db.operation.summary": "listDatabases admin", + "nested": [ + { + "name": "listDatabases admin", + "attributes": { + "db.system": "mongodb", + "db.namespace": "admin", + "db.command.name": "listDatabases", + "network.transport": "tcp", + "db.mongodb.cursor_id": { + "$$exists": false + }, + "db.response.status_code": { + "$$exists": false + }, + "exception.message": { + "$$exists": false + }, + "exception.type": { + "$$exists": false + }, + "exception.stacktrace": { + "$$exists": false + }, + "server.address": { + "$$type": "string" + }, + "server.port": { + "$$type": [ + "int", + "long" + ] + }, + "db.query.summary": "listDatabases", + "db.query.text": { + "$$matchAsDocument": { + "$$matchAsRoot": { + "listDatabases": 1 + } } + }, + "db.mongodb.server_connection_id": { + "$$type": [ + "int", + "long" + ] + }, + "db.mongodb.driver_connection_id": { + "$$type": [ + "int", + "long" + ] } - }, - "db.mongodb.server_connection_id": { - "$$type": [ - "int", - "long" - ] - }, - "db.mongodb.driver_connection_id": { - "$$type": [ - "int", - "long" - ] } } - } - ] - } - ] - } + ] + } + ] + } + ] } ] } diff --git a/source/open-telemetry/tests/operation/list_databases.yml b/source/open-telemetry/tests/operation/list_databases.yml index 471d7e7390..3a54f0b7c2 100644 --- a/source/open-telemetry/tests/operation/list_databases.yml +++ b/source/open-telemetry/tests/operation/list_databases.yml @@ -13,38 +13,35 @@ tests: name: listDatabases expectTracingMessages: - client: *client0 - ignoreExtraSpans: false - spans: - - name: listDatabases admin.$cmd - tags: - db.system: mongodb + - client: *client0 + ignoreExtraSpans: false + spans: + - name: listDatabases + attributes: + db.system: mongodb db.namespace: admin - db.collection.name: $cmd db.operation.name: listDatabases - db.operation.summary: listDatabases admin.$cmd - nested: - - name: command listDatabases - tags: - db.system: mongodb - db.namespace: admin - db.collection.name: admin.$cmd - db.command.name: listDatabases - network.transport: tcp - db.mongodb.cursor_id: { $$exists: false } - db.response.status_code: { $$exists: false } - exception.message: { $$exists: false } - exception.type: { $$exists: false } - exception.stacktrace: { $$exists: false } - server.address: { $$type: string } - server.port: { $$type: ['int', 'long'] } - server.type: { $$type: string } - db.query.summary: listDatabases - db.query.text: - $$matchAsDocument: - $$matchAsRoot: - listDatabases: 1 - db.mongodb.server_connection_id: - $$type: [ 'int', 'long' ] - db.mongodb.driver_connection_id: - $$type: [ 'int', 'long' ] + db.operation.summary: listDatabases admin + nested: + - name: listDatabases admin + attributes: + db.system: mongodb + db.namespace: admin + db.command.name: listDatabases + network.transport: tcp + db.mongodb.cursor_id: { $$exists: false } + db.response.status_code: { $$exists: false } + exception.message: { $$exists: false } + exception.type: { $$exists: false } + exception.stacktrace: { $$exists: false } + server.address: { $$type: string } + server.port: { $$type: ['int', 'long'] } + db.query.summary: listDatabases + db.query.text: + $$matchAsDocument: + $$matchAsRoot: + listDatabases: 1 + db.mongodb.server_connection_id: + $$type: [ 'int', 'long' ] + db.mongodb.driver_connection_id: + $$type: [ 'int', 'long' ] diff --git a/source/open-telemetry/tests/operation/list_indexes.json b/source/open-telemetry/tests/operation/list_indexes.json index 10ddf3ab25..223b506dea 100644 --- a/source/open-telemetry/tests/operation/list_indexes.json +++ b/source/open-telemetry/tests/operation/list_indexes.json @@ -42,26 +42,28 @@ "name": "listIndexes" } ], - "expectTracingMessages": { - "client": "client0", - "ignoreExtraSpans": false, - "spans": [ - { - "name": "listIndexes operation-list-indexes.test", - "tags": { - "db.system": "mongodb", + "expectTracingMessages": [ + { + "client": "client0", + "ignoreExtraSpans": false, + "spans": [ + { + "name": "listIndexes operation-list-indexes.test", + "attributes": { + "db.system": "mongodb" + }, "db.namespace": "operation-list-indexes", "db.collection.name": "test", "db.operation.name": "listIndexes", - "db.operation.summary": "listIndexes operation-list-indexes.test" - }, - "nested": [ - { - "name": "command listIndexes", - "tags": { - "db.system": "mongodb", + "db.operation.summary": "listIndexes operation-list-indexes.test", + "nested": [ + { + "name": "listIndexes operation-list-indexes.test", + "attributes": { + "db.system": "mongodb" + }, "db.namespace": "operation-list-indexes", - "db.collection.name": "operation-list-indexes.$cmd", + "db.collection.name": "test", "db.command.name": "listIndexes", "network.transport": "tcp", "db.mongodb.cursor_id": { @@ -88,9 +90,6 @@ "long" ] }, - "server.type": { - "$$type": "string" - }, "db.query.summary": "listIndexes", "db.query.text": { "$$matchAsDocument": { @@ -112,11 +111,11 @@ ] } } - } - ] - } - ] - } + ] + } + ] + } + ] } ] } diff --git a/source/open-telemetry/tests/operation/list_indexes.yml b/source/open-telemetry/tests/operation/list_indexes.yml index f7796e07da..f72c199113 100644 --- a/source/open-telemetry/tests/operation/list_indexes.yml +++ b/source/open-telemetry/tests/operation/list_indexes.yml @@ -25,22 +25,22 @@ tests: name: listIndexes expectTracingMessages: - client: *client0 - ignoreExtraSpans: false - spans: - - name: listIndexes operation-list-indexes.test - tags: - db.system: mongodb + - client: *client0 + ignoreExtraSpans: false + spans: + - name: listIndexes operation-list-indexes.test + attributes: + db.system: mongodb db.namespace: operation-list-indexes db.collection.name: test db.operation.name: listIndexes db.operation.summary: listIndexes operation-list-indexes.test - nested: - - name: command listIndexes - tags: - db.system: mongodb + nested: + - name: listIndexes operation-list-indexes.test + attributes: + db.system: mongodb db.namespace: operation-list-indexes - db.collection.name: operation-list-indexes.$cmd + db.collection.name: test db.command.name: listIndexes network.transport: tcp db.mongodb.cursor_id: { $$exists: false } @@ -50,7 +50,6 @@ tests: exception.stacktrace: { $$exists: false } server.address: { $$type: string } server.port: { $$type: ['int', 'long'] } - server.type: { $$type: string } db.query.summary: listIndexes db.query.text: $$matchAsDocument: diff --git a/source/open-telemetry/tests/operation/map_reduce.json b/source/open-telemetry/tests/operation/map_reduce.json index 705973e754..df29f86396 100644 --- a/source/open-telemetry/tests/operation/map_reduce.json +++ b/source/open-telemetry/tests/operation/map_reduce.json @@ -89,90 +89,92 @@ ] } ], - "expectTracingMessages": { - "client": "client0", - "ignoreExtraSpans": false, - "spans": [ - { - "name": "mapReduce operation-map-reduce.test", - "tags": { - "db.system": "mongodb", - "db.namespace": "operation-map-reduce", - "db.collection.name": "test", - "db.operation.name": "mapReduce", - "db.operation.summary": "mapReduce operation-map-reduce.test" - }, - "nested": [ - { - "name": "command mapReduce", - "tags": { - "db.system": "mongodb", - "db.namespace": "operation-map-reduce", - "db.collection.name": "operation-map-reduce.$cmd", - "db.command.name": "mapReduce", - "network.transport": "tcp", - "db.mongodb.cursor_id": { - "$$exists": false - }, - "db.response.status_code": { - "$$exists": false - }, - "exception.message": { - "$$exists": false - }, - "exception.type": { - "$$exists": false - }, - "exception.stacktrace": { - "$$exists": false - }, - "server.address": { - "$$type": "string" - }, - "server.port": { - "$$type": [ - "int", - "long" - ] - }, - "server.type": { - "$$type": "string" - }, - "db.query.summary": "mapReduce", - "db.query.text": { - "$$matchAsDocument": { - "$$matchAsRoot": { - "mapReduce": "test", - "map": { - "$code": "function inc() { return emit(0, this.x + 1) }" - }, - "reduce": { - "$code": "function sum(key, values) { return values.reduce((acc, x) => acc + x); }" - }, - "out": { - "inline": 1 + "expectTracingMessages": [ + { + "client": "client0", + "ignoreExtraSpans": false, + "spans": [ + { + "name": "mapReduce operation-map-reduce.test", + "attributes": { + "db.system": "mongodb", + "db.namespace": "operation-map-reduce", + "db.collection.name": "test", + "db.operation.name": "mapReduce", + "db.operation.summary": "mapReduce operation-map-reduce.test" + }, + "nested": [ + { + "name": "command mapReduce", + "attributes": { + "db.system": "mongodb", + "db.namespace": "operation-map-reduce", + "db.collection.name": "operation-map-reduce.$cmd", + "db.command.name": "mapReduce", + "network.transport": "tcp", + "db.mongodb.cursor_id": { + "$$exists": false + }, + "db.response.status_code": { + "$$exists": false + }, + "exception.message": { + "$$exists": false + }, + "exception.type": { + "$$exists": false + }, + "exception.stacktrace": { + "$$exists": false + }, + "server.address": { + "$$type": "string" + }, + "server.port": { + "$$type": [ + "int", + "long" + ] + }, + "server.type": { + "$$type": "string" + }, + "db.query.summary": "mapReduce", + "db.query.text": { + "$$matchAsDocument": { + "$$matchAsRoot": { + "mapReduce": "test", + "map": { + "$code": "function inc() { return emit(0, this.x + 1) }" + }, + "reduce": { + "$code": "function sum(key, values) { return values.reduce((acc, x) => acc + x); }" + }, + "out": { + "inline": 1 + } } } + }, + "db.mongodb.server_connection_id": { + "$$type": [ + "int", + "long" + ] + }, + "db.mongodb.driver_connection_id": { + "$$type": [ + "int", + "long" + ] } - }, - "db.mongodb.server_connection_id": { - "$$type": [ - "int", - "long" - ] - }, - "db.mongodb.driver_connection_id": { - "$$type": [ - "int", - "long" - ] } } - } - ] - } - ] - } + ] + } + ] + } + ] } ] } diff --git a/source/open-telemetry/tests/operation/map_reduce.yml b/source/open-telemetry/tests/operation/map_reduce.yml index 33f119e6b8..2c16dde0f5 100644 --- a/source/open-telemetry/tests/operation/map_reduce.yml +++ b/source/open-telemetry/tests/operation/map_reduce.yml @@ -59,41 +59,41 @@ tests: _id: 0 value: 6 expectTracingMessages: - client: *client0 - ignoreExtraSpans: false - spans: - - name: mapReduce operation-map-reduce.test - tags: - db.system: mongodb - db.namespace: operation-map-reduce - db.collection.name: test - db.operation.name: mapReduce - db.operation.summary: mapReduce operation-map-reduce.test - nested: - - name: command mapReduce - tags: - db.system: mongodb - db.namespace: operation-map-reduce - db.collection.name: operation-map-reduce.$cmd - db.command.name: mapReduce - network.transport: tcp - db.mongodb.cursor_id: { $$exists: false } - db.response.status_code: { $$exists: false } - exception.message: { $$exists: false } - exception.type: { $$exists: false } - exception.stacktrace: { $$exists: false } - server.address: { $$type: string } - server.port: { $$type: ['int', 'long'] } - server.type: { $$type: string } - db.query.summary: mapReduce - db.query.text: - $$matchAsDocument: - $$matchAsRoot: - mapReduce: test - map: { $code: 'function inc() { return emit(0, this.x + 1) }' } - reduce: { $code: 'function sum(key, values) { return values.reduce((acc, x) => acc + x); }' } - out: { inline: 1 } - db.mongodb.server_connection_id: - $$type: [ 'int', 'long' ] - db.mongodb.driver_connection_id: - $$type: [ 'int', 'long' ] + - client: *client0 + ignoreExtraSpans: false + spans: + - name: mapReduce operation-map-reduce.test + attributes: + db.system: mongodb + db.namespace: operation-map-reduce + db.collection.name: test + db.operation.name: mapReduce + db.operation.summary: mapReduce operation-map-reduce.test + nested: + - name: command mapReduce + attributes: + db.system: mongodb + db.namespace: operation-map-reduce + db.collection.name: operation-map-reduce.$cmd + db.command.name: mapReduce + network.transport: tcp + db.mongodb.cursor_id: { $$exists: false } + db.response.status_code: { $$exists: false } + exception.message: { $$exists: false } + exception.type: { $$exists: false } + exception.stacktrace: { $$exists: false } + server.address: { $$type: string } + server.port: { $$type: [ 'int', 'long' ] } + server.type: { $$type: string } + db.query.summary: mapReduce + db.query.text: + $$matchAsDocument: + $$matchAsRoot: + mapReduce: test + map: { $code: 'function inc() { return emit(0, this.x + 1) }' } + reduce: { $code: 'function sum(key, values) { return values.reduce((acc, x) => acc + x); }' } + out: { inline: 1 } + db.mongodb.server_connection_id: + $$type: [ 'int', 'long' ] + db.mongodb.driver_connection_id: + $$type: [ 'int', 'long' ] diff --git a/source/open-telemetry/tests/operation/retries.json b/source/open-telemetry/tests/operation/retries.json index 6a00ea920f..0359c50ca6 100644 --- a/source/open-telemetry/tests/operation/retries.json +++ b/source/open-telemetry/tests/operation/retries.json @@ -11,6 +11,12 @@ } } }, + { + "client": { + "id": "failPointClient", + "useMultipleMongoses": false + } + }, { "database": { "id": "database0", @@ -41,7 +47,7 @@ "name": "failPoint", "object": "testRunner", "arguments": { - "client": "client0", + "client": "failPointClient", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -69,144 +75,146 @@ } } ], - "expectTracingMessages": { - "client": "client0", - "ignoreExtraSpans": true, - "spans": [ - { - "name": "find operation-find-retries.test", - "tags": { - "db.system": "mongodb", - "db.namespace": "operation-find-retries", - "db.collection.name": "test", - "db.operation.name": "find", - "db.operation.summary": "find operation-find-retries.test" - }, - "nested": [ - { - "name": "command find", - "tags": { - "db.system": "mongodb", - "db.namespace": "operation-find-retries", - "db.collection.name": "operation-find-retries.$cmd", - "db.command.name": "find", - "network.transport": "tcp", - "db.mongodb.cursor_id": { - "$$exists": false - }, - "db.response.status_code": { - "$$exists": false - }, - "exception.message": { - "$$type": "string" - }, - "exception.type": { - "$$type": "string" - }, - "exception.stacktrace": { - "$$type": "string" - }, - "server.address": { - "$$type": "string" - }, - "server.port": { - "$$type": [ - "long", - "string" - ] - }, - "server.type": { - "$$type": "string" - }, - "db.query.summary": "find", - "db.query.text": { - "$$matchAsDocument": { - "$$matchAsRoot": { - "find": "test", - "filter": { - "x": 1 + "expectTracingMessages": [ + { + "client": "client0", + "ignoreExtraSpans": true, + "spans": [ + { + "name": "find operation-find-retries.test", + "attributes": { + "db.system": "mongodb", + "db.namespace": "operation-find-retries", + "db.collection.name": "test", + "db.operation.name": "find", + "db.operation.summary": "find operation-find-retries.test" + }, + "nested": [ + { + "name": "find operation-find-retries.test", + "attributes": { + "db.system": "mongodb", + "db.namespace": "operation-find-retries", + "db.collection.name": "test", + "db.command.name": "find", + "network.transport": "tcp", + "db.mongodb.cursor_id": { + "$$exists": false + }, + "db.response.status_code": { + "$$exists": true + }, + "error.type": { + "$$exists": true + }, + "exception.message": { + "$$exists": false + }, + "exception.type": { + "$$exists": false + }, + "exception.stacktrace": { + "$$exists": false + }, + "server.address": { + "$$type": "string" + }, + "server.port": { + "$$type": [ + "long", + "string" + ] + }, + "db.query.summary": "find", + "db.query.text": { + "$$matchAsDocument": { + "$$matchAsRoot": { + "find": "test", + "filter": { + "x": 1 + } } } + }, + "db.mongodb.server_connection_id": { + "$$type": [ + "int", + "long" + ] + }, + "db.mongodb.driver_connection_id": { + "$$type": [ + "int", + "long" + ] } - }, - "db.mongodb.server_connection_id": { - "$$type": [ - "int", - "long" - ] - }, - "db.mongodb.driver_connection_id": { - "$$type": [ - "int", - "long" - ] } - } - }, - { - "name": "command find", - "tags": { - "db.system": "mongodb", - "db.namespace": "operation-find-retries", - "db.collection.name": "operation-find-retries.$cmd", - "db.command.name": "find", - "network.transport": "tcp", - "db.mongodb.cursor_id": { - "$$exists": false - }, - "db.response.status_code": { - "$$exists": false - }, - "exception.message": { - "$$exists": false - }, - "exception.type": { - "$$exists": false - }, - "exception.stacktrace": { - "$$exists": false - }, - "server.address": { - "$$type": "string" - }, - "server.port": { - "$$type": [ - "int", - "long" - ] - }, - "server.type": { - "$$type": "string" - }, - "db.query.summary": "find", - "db.query.text": { - "$$matchAsDocument": { - "$$matchAsRoot": { - "find": "test", - "filter": { - "x": 1 + }, + { + "name": "find operation-find-retries.test", + "attributes": { + "db.system": "mongodb", + "db.namespace": "operation-find-retries", + "db.collection.name": "test", + "db.command.name": "find", + "network.transport": "tcp", + "db.mongodb.cursor_id": { + "$$exists": false + }, + "db.response.status_code": { + "$$exists": false + }, + "error.type": { + "$$exists": false + }, + "exception.message": { + "$$exists": false + }, + "exception.type": { + "$$exists": false + }, + "exception.stacktrace": { + "$$exists": false + }, + "server.address": { + "$$type": "string" + }, + "server.port": { + "$$type": [ + "int", + "long" + ] + }, + "db.query.summary": "find", + "db.query.text": { + "$$matchAsDocument": { + "$$matchAsRoot": { + "find": "test", + "filter": { + "x": 1 + } } } + }, + "db.mongodb.server_connection_id": { + "$$type": [ + "int", + "long" + ] + }, + "db.mongodb.driver_connection_id": { + "$$type": [ + "int", + "long" + ] } - }, - "db.mongodb.server_connection_id": { - "$$type": [ - "int", - "long" - ] - }, - "db.mongodb.driver_connection_id": { - "$$type": [ - "int", - "long" - ] } } - } - ] - } - ] - } + ] + } + ] + } + ] } ] } diff --git a/source/open-telemetry/tests/operation/retries.yml b/source/open-telemetry/tests/operation/retries.yml index 520f8c9d9d..3e6510e4f0 100644 --- a/source/open-telemetry/tests/operation/retries.yml +++ b/source/open-telemetry/tests/operation/retries.yml @@ -6,14 +6,17 @@ createEntities: useMultipleMongoses: false observeTracingMessages: enableCommandPayload: true + - client: + id: &failPointClient failPointClient + useMultipleMongoses: false - database: id: &database0 database0 client: *client0 - databaseName: operation-find-retries + databaseName: &database0Name operation-find-retries - collection: id: &collection0 collection0 database: *database0 - collectionName: test + collectionName: &collection0Name test initialData: - collectionName: test databaseName: operation-find-retries @@ -24,7 +27,7 @@ tests: - name: failPoint object: testRunner arguments: - client: *client0 + client: *failPointClient failPoint: configureFailPoint: failCommand mode: { times: 1 } @@ -38,67 +41,66 @@ tests: arguments: filter: { x: 1 } expectTracingMessages: - client: *client0 - ignoreExtraSpans: true - spans: - - name: find operation-find-retries.test - tags: - db.system: mongodb - db.namespace: operation-find-retries - db.collection.name: test - db.operation.name: find - db.operation.summary: find operation-find-retries.test - nested: - - name: command find - tags: - db.system: mongodb - db.namespace: operation-find-retries - db.collection.name: operation-find-retries.$cmd - db.command.name: find - network.transport: tcp - db.mongodb.cursor_id: { $$exists: false } - db.response.status_code: { $$exists: false } - exception.message: { $$type: string } - exception.type: { $$type: string } - exception.stacktrace: { $$type: string } - server.address: { $$type: string } - server.port: { $$type: ['long', 'string'] } - server.type: { $$type: string } - db.query.summary: find - db.query.text: - $$matchAsDocument: - $$matchAsRoot: - find: test - filter: - x: 1 - db.mongodb.server_connection_id: - $$type: [ 'int', 'long' ] - db.mongodb.driver_connection_id: - $$type: [ 'int', 'long' ] - - name: command find - tags: - db.system: mongodb - db.namespace: operation-find-retries - db.collection.name: operation-find-retries.$cmd - db.command.name: find - network.transport: tcp - db.mongodb.cursor_id: { $$exists: false } - db.response.status_code: { $$exists: false } - exception.message: { $$exists: false } - exception.type: { $$exists: false } - exception.stacktrace: { $$exists: false } - server.address: { $$type: string } - server.port: { $$type: ['int', 'long'] } - server.type: { $$type: string } - db.query.summary: find - db.query.text: - $$matchAsDocument: - $$matchAsRoot: - find: test - filter: - x: 1 - db.mongodb.server_connection_id: - $$type: [ 'int', 'long' ] - db.mongodb.driver_connection_id: - $$type: [ 'int', 'long' ] - + - client: *client0 + ignoreExtraSpans: true + spans: + - name: find operation-find-retries.test + attributes: + db.system: mongodb + db.namespace: *database0Name + db.collection.name: *collection0Name + db.operation.name: find + db.operation.summary: find operation-find-retries.test + nested: + - name: find operation-find-retries.test + attributes: + db.system: mongodb + db.namespace: *database0Name + db.collection.name: *collection0Name + db.command.name: find + network.transport: tcp + db.mongodb.cursor_id: { $$exists: false } + db.response.status_code: { $$exists: true } + error.type: { $$exists: true } + exception.message: { $$exists: false } + exception.type: { $$exists: false } + exception.stacktrace: { $$exists: false } + server.address: { $$type: string } + server.port: { $$type: ['long', 'string'] } + db.query.summary: find + db.query.text: + $$matchAsDocument: + $$matchAsRoot: + find: test + filter: + x: 1 + db.mongodb.server_connection_id: + $$type: [ 'int', 'long' ] + db.mongodb.driver_connection_id: + $$type: [ 'int', 'long' ] + - name: find operation-find-retries.test + attributes: + db.system: mongodb + db.namespace: *database0Name + db.collection.name: *collection0Name + db.command.name: find + network.transport: tcp + db.mongodb.cursor_id: { $$exists: false } + db.response.status_code: { $$exists: false } + error.type: { $$exists: false } + exception.message: { $$exists: false } + exception.type: { $$exists: false } + exception.stacktrace: { $$exists: false } + server.address: { $$type: string } + server.port: { $$type: ['int', 'long'] } + db.query.summary: find + db.query.text: + $$matchAsDocument: + $$matchAsRoot: + find: test + filter: + x: 1 + db.mongodb.server_connection_id: + $$type: [ 'int', 'long' ] + db.mongodb.driver_connection_id: + $$type: [ 'int', 'long' ] diff --git a/source/open-telemetry/tests/operation/update.json b/source/open-telemetry/tests/operation/update.json index df26a7902e..2bf497d46e 100644 --- a/source/open-telemetry/tests/operation/update.json +++ b/source/open-telemetry/tests/operation/update.json @@ -45,65 +45,64 @@ } } ], - "expectTracingMessages": { - "client": "client0", - "ignoreExtraSpans": false, - "spans": [ - { - "name": "update operation-update.test", - "tags": { - "db.system": "mongodb", - "db.namespace": "operation-update", - "db.collection.name": "test", - "db.operation.name": "update", - "db.operation.summary": "update operation-update.test" - }, - "nested": [ - { - "name": "command update", - "tags": { - "db.system": "mongodb", - "db.namespace": "operation-update", - "server.address": { - "$$type": "string" - }, - "server.port": { - "$$type": [ - "long", - "string" - ] - }, - "server.type": { - "$$type": "string" - }, - "db.query.summary": "update", - "db.query.text": { - "$$matchAsDocument": { - "$$matchAsRoot": { - "update": "test", - "ordered": true, - "txnNumber": 1, - "updates": [ - { - "q": { - "_id": 1 - }, - "u": { - "$inc": { - "x": 1 + "expectTracingMessages": [ + { + "client": "client0", + "ignoreExtraSpans": false, + "spans": [ + { + "name": "update operation-update.test", + "attributes": { + "db.system": "mongodb", + "db.namespace": "operation-update", + "db.collection.name": "test", + "db.operation.name": "update", + "db.operation.summary": "update operation-update.test" + }, + "nested": [ + { + "name": "update operation-update.test", + "attributes": { + "db.system": "mongodb", + "db.namespace": "operation-update", + "server.address": { + "$$type": "string" + }, + "server.port": { + "$$type": [ + "long", + "string" + ] + }, + "db.query.summary": "update", + "db.query.text": { + "$$matchAsDocument": { + "$$matchAsRoot": { + "update": "test", + "ordered": true, + "txnNumber": 1, + "updates": [ + { + "q": { + "_id": 1 + }, + "u": { + "$inc": { + "x": 1 + } } } - } - ] + ] + } } } } } - } - ] - } - ] - } + ] + } + ] + } + ] } ] } diff --git a/source/open-telemetry/tests/operation/update.yml b/source/open-telemetry/tests/operation/update.yml index faa0dbb3a3..fac8720a63 100644 --- a/source/open-telemetry/tests/operation/update.yml +++ b/source/open-telemetry/tests/operation/update.yml @@ -9,11 +9,11 @@ createEntities: - database: id: &database0 database0 client: *client0 - databaseName: operation-update + databaseName: &databaseName0 operation-update - collection: id: &collection0 collection0 database: *database0 - collectionName: test + collectionName: &collectionName0 test tests: - description: update one element @@ -26,29 +26,28 @@ tests: update: { $inc: { x: 1 } } expectTracingMessages: - client: *client0 - ignoreExtraSpans: false - spans: - - name: update operation-update.test - tags: - db.system: mongodb - db.namespace: operation-update - db.collection.name: test - db.operation.name: update - db.operation.summary: update operation-update.test - nested: - - name: command update - tags: - db.system: mongodb - db.namespace: operation-update - server.address: { $$type: string } - server.port: { $$type: [ 'long', 'string' ] } - server.type: { $$type: string } - db.query.summary: update - db.query.text: - $$matchAsDocument: - $$matchAsRoot: - update: test - ordered: true - txnNumber: 1 - updates: [ { "q": { "_id": 1 }, "u": { "$inc": { "x": 1 } } } ] + - client: *client0 + ignoreExtraSpans: false + spans: + - name: update operation-update.test + attributes: + db.system: mongodb + db.namespace: *databaseName0 + db.collection.name: *collectionName0 + db.operation.name: update + db.operation.summary: update operation-update.test + nested: + - name: update operation-update.test + attributes: + db.system: mongodb + db.namespace: operation-update + server.address: { $$type: string } + server.port: { $$type: [ 'long', 'string' ] } + db.query.summary: update + db.query.text: + $$matchAsDocument: + $$matchAsRoot: + update: test + ordered: true + txnNumber: 1 + updates: [ { "q": { "_id": 1 }, "u": { "$inc": { "x": 1 } } } ] diff --git a/source/open-telemetry/tests/transaction/transaction.json b/source/open-telemetry/tests/transaction/transaction.json index 248b0a24df..836bf8403f 100644 --- a/source/open-telemetry/tests/transaction/transaction.json +++ b/source/open-telemetry/tests/transaction/transaction.json @@ -84,50 +84,34 @@ "x": 1 } } - }, - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 2 - } - } - }, - { - "object": "session0", - "name": "abortTransaction" } ], - "expectTracingMessages": { - "client": "client0", - "ignoreExtraSpans": false, - "spans": [ - { - "name": "transaction", - "tags": { - "db.system": "mongodb" - }, - "nested": [ - { - "name": "insert transaction-tests.test", - "tags": { - "db.system": "mongodb", + "expectTracingMessages": [ + { + "client": "client0", + "ignoreExtraSpans": false, + "spans": [ + { + "name": "transaction", + "attributes": { + "db.system": "mongodb" + }, + "nested": [ + { + "name": "insert transaction-tests.test", + "attributes": { + "db.system": "mongodb" + }, "db.namespace": "transaction-tests", "db.collection.name": "test", "db.operation.name": "insert", - "db.operation.summary": "insert transaction-tests.test" - }, - "nested": [ - { - "name": "command insert", - "tags": { - "db.system": "mongodb", + "db.operation.summary": "insert transaction-tests.test", + "nested": [ + { + "name": "command insert", + "attributes": { + "db.system": "mongodb" + }, "db.namespace": "transaction-tests", "server.address": { "$$type": "string" @@ -162,144 +146,62 @@ "$$sessionLsid": "session0" } } - } - ] - }, - { - "name": "commitTransaction admin.$cmd", - "tags": { - "db.system": "mongodb" + ] }, - "nested": [ - { - "name": "command commitTransaction", - "tags": { - "db.system": "mongodb", - "db.query.text": { - "$$matchAsDocument": { - "$$matchAsRoot": { - "commitTransaction": 1, - "txnNumber": 1, - "autocommit": false + { + "name": "commitTransaction admin.$cmd", + "attributes": { + "db.system": "mongodb", + "nested": [ + { + "name": "command commitTransaction", + "attributes": { + "db.system": "mongodb", + "db.query.text": { + "$$matchAsDocument": { + "$$matchAsRoot": { + "commitTransaction": 1, + "txnNumber": 1, + "autocommit": false + } + } } } } - } - } - ] - } - ] - }, - { - "name": "find transaction-tests.test", - "tags": {}, - "nested": [ - { - "name": "command find", - "tags": { - "db.system": "mongodb", - "db.namespace": "transaction-tests", - "server.address": { - "$$type": "string" - }, - "server.port": { - "$$type": [ - "long", - "string" ] - }, - "server.type": { - "$$type": "string" - }, - "db.query.summary": "find" + } } - } - ] - }, - { - "name": "transaction", - "tags": { - "db.system": "mongodb" - }, - "nested": [ - { - "name": "insert transaction-tests.test", - "tags": { - "db.system": "mongodb", - "db.namespace": "transaction-tests", - "db.collection.name": "test", - "db.operation.name": "insert", - "db.operation.summary": "insert transaction-tests.test" + ] + } + ] + }, + { + "name": "find transaction-tests.test", + "attributes": {}, + "nested": [ + { + "name": "command find", + "attributes": { + "db.system": "mongodb", + "db.namespace": "transaction-tests", + "server.address": { + "$$type": "string" }, - "nested": [ - { - "name": "command insert", - "tags": { - "db.system": "mongodb", - "db.namespace": "transaction-tests", - "server.address": { - "$$type": "string" - }, - "server.port": { - "$$type": [ - "long", - "string" - ] - }, - "server.type": { - "$$type": "string" - }, - "db.query.summary": "insert", - "db.query.text": { - "$$matchAsDocument": { - "$$matchAsRoot": { - "insert": "test", - "ordered": true, - "txnNumber": 2, - "startTransaction": true, - "autocommit": false, - "documents": [ - { - "_id": 2 - } - ] - } - } - }, - "db.mongodb.lsid": { - "$$sessionLsid": "session0" - } - } - } - ] - }, - { - "name": "abortTransaction admin.$cmd", - "tags": { - "db.system": "mongodb" + "server.port": { + "$$type": [ + "long", + "string" + ] }, - "nested": [ - { - "name": "command abortTransaction", - "tags": { - "db.system": "mongodb", - "db.query.text": { - "$$matchAsDocument": { - "$$matchAsRoot": { - "abortTransaction": 1, - "txnNumber": 2, - "autocommit": false - } - } - } - } - } - ] + "server.type": { + "$$type": "string" + }, + "db.query.summary": "find" } - ] - } - ] - }, + } + ] + } + ], "outcome": [ { "collectionName": "test", diff --git a/source/open-telemetry/tests/transaction/transaction.yml b/source/open-telemetry/tests/transaction/transaction.yml index 6387792a88..cff5448737 100644 --- a/source/open-telemetry/tests/transaction/transaction.yml +++ b/source/open-telemetry/tests/transaction/transaction.yml @@ -46,36 +46,25 @@ tests: object: *collection0 arguments: { filter: { x: 1 } } - - object: *session0 - name: startTransaction - - object: *collection0 - name: insertOne - arguments: - session: *session0 - document: - _id: 2 - - object: *session0 - name: abortTransaction - expectTracingMessages: - client: *client0 - ignoreExtraSpans: false - spans: - - name: transaction - tags: - db.system: mongodb - nested: - - name: insert transaction-tests.test - tags: - db.system: mongodb + - client: *client0 + ignoreExtraSpans: false + spans: + - name: transaction + attributes: + db.system: mongodb + nested: + - name: insert transaction-tests.test + attributes: + db.system: mongodb db.namespace: transaction-tests db.collection.name: test db.operation.name: insert db.operation.summary: insert transaction-tests.test - nested: - - name: command insert - tags: - db.system: mongodb + nested: + - name: command insert + attributes: + db.system: mongodb db.namespace: transaction-tests server.address: { $$type: string } server.port: { $$type: ['long', 'string'] } @@ -92,74 +81,30 @@ tests: documents: - _id: 1 db.mongodb.lsid: { $$sessionLsid: *session0 } - - name: commitTransaction admin.$cmd - tags: - db.system: mongodb - nested: - - name: command commitTransaction - tags: - db.system: mongodb - db.query.text: - $$matchAsDocument: - $$matchAsRoot: - commitTransaction: 1 - txnNumber: 1 - autocommit: false - - name: find transaction-tests.test - tags: {} - nested: - - name: command find - tags: - db.system: mongodb - db.namespace: transaction-tests - server.address: { $$type: string } - server.port: { $$type: ['long', 'string'] } - server.type: { $$type: string } - db.query.summary: find - - name: transaction - tags: - db.system: mongodb - nested: - - name: insert transaction-tests.test - tags: - db.system: mongodb - db.namespace: transaction-tests - db.collection.name: test - db.operation.name: insert - db.operation.summary: insert transaction-tests.test - nested: - - name: command insert - tags: - db.system: mongodb - db.namespace: transaction-tests - server.address: { $$type: string } - server.port: { $$type: ['long', 'string'] } - server.type: { $$type: string } - db.query.summary: insert - db.query.text: - $$matchAsDocument: - $$matchAsRoot: - insert: test - ordered: true - txnNumber: 2 - startTransaction: true - autocommit: false - documents: - - _id: 2 - db.mongodb.lsid: { $$sessionLsid: *session0 } - - name: abortTransaction admin.$cmd - tags: - db.system: mongodb - nested: - - name: command abortTransaction - tags: - db.system: mongodb - db.query.text: - $$matchAsDocument: - $$matchAsRoot: - abortTransaction: 1 - txnNumber: 2 - autocommit: false + - name: commitTransaction admin.$cmd + attributes: + db.system: mongodb + nested: + - name: command commitTransaction + attributes: + db.system: mongodb + db.query.text: + $$matchAsDocument: + $$matchAsRoot: + commitTransaction: 1 + txnNumber: 1 + autocommit: false + - name: find transaction-tests.test + attributes: {} + nested: + - name: command find + attributes: + db.system: mongodb + db.namespace: transaction-tests + server.address: { $$type: string } + server.port: { $$type: ['long', 'string'] } + server.type: { $$type: string } + db.query.summary: find outcome: - collectionName: test databaseName: transaction-tests diff --git a/source/unified-test-format/schema-1.26.json b/source/unified-test-format/schema-1.26.json index 25b69c05d8..d1b94b88fb 100644 --- a/source/unified-test-format/schema-1.26.json +++ b/source/unified-test-format/schema-1.26.json @@ -383,13 +383,13 @@ "additionalProperties": false, "required": [ "name", - "tags" + "attributes" ], "properties": { "name": { "type": "string" }, - "tags": { + "attributes": { "type": "object" }, "nested": { @@ -972,6 +972,29 @@ } } }, + "expectTracingMessagesForClient": { + "additionalProperties": false, + "type": "object", + "required": [ + "client", + "spans" + ], + "properties": { + "client": { + "type": "string" + }, + "ignoreExtraSpans": { + "type": "boolean" + }, + "spans": { + "type": "array", + "minItems": 1, + "items": { + "$ref": "#/definitions/spanComponent" + } + } + } + }, "expectedLogMessage": { "type": "object", "additionalProperties": false, @@ -1197,26 +1220,10 @@ } }, "expectTracingMessages": { - "additionalProperties" : false, - "type": "object", - "required": [ - "client", - "spans" - ], - "properties": { - "client": { - "type": "string" - }, - "ignoreExtraSpans": { - "type": "boolean" - }, - "spans": { - "type": "array", - "minItems": 1, - "items": { - "$ref": "#/definitions/spanComponent" - } - } + "type": "array", + "minItems": 1, + "items": { + "$ref": "#/definitions/expectTracingMessagesForClient" } }, "outcome": { diff --git a/source/unified-test-format/schema-latest.json b/source/unified-test-format/schema-latest.json index 25b69c05d8..d1b94b88fb 100644 --- a/source/unified-test-format/schema-latest.json +++ b/source/unified-test-format/schema-latest.json @@ -383,13 +383,13 @@ "additionalProperties": false, "required": [ "name", - "tags" + "attributes" ], "properties": { "name": { "type": "string" }, - "tags": { + "attributes": { "type": "object" }, "nested": { @@ -972,6 +972,29 @@ } } }, + "expectTracingMessagesForClient": { + "additionalProperties": false, + "type": "object", + "required": [ + "client", + "spans" + ], + "properties": { + "client": { + "type": "string" + }, + "ignoreExtraSpans": { + "type": "boolean" + }, + "spans": { + "type": "array", + "minItems": 1, + "items": { + "$ref": "#/definitions/spanComponent" + } + } + } + }, "expectedLogMessage": { "type": "object", "additionalProperties": false, @@ -1197,26 +1220,10 @@ } }, "expectTracingMessages": { - "additionalProperties" : false, - "type": "object", - "required": [ - "client", - "spans" - ], - "properties": { - "client": { - "type": "string" - }, - "ignoreExtraSpans": { - "type": "boolean" - }, - "spans": { - "type": "array", - "minItems": 1, - "items": { - "$ref": "#/definitions/spanComponent" - } - } + "type": "array", + "minItems": 1, + "items": { + "$ref": "#/definitions/expectTracingMessagesForClient" } }, "outcome": { From 67d4c90c5a51293d0eeed19a5ba2304a76d8996b Mon Sep 17 00:00:00 2001 From: Dmitry Rybakov Date: Wed, 3 Sep 2025 13:06:27 +0200 Subject: [PATCH 37/62] Clarify cursor operation and transactions nesting --- source/open-telemetry/open-telemetry.md | 33 +++++++++++++++++-------- 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/source/open-telemetry/open-telemetry.md b/source/open-telemetry/open-telemetry.md index 0ce4281105..be54e90e07 100644 --- a/source/open-telemetry/open-telemetry.md +++ b/source/open-telemetry/open-telemetry.md @@ -100,15 +100,18 @@ selection and serialization/deserialization. The span for the operation MUST be created within the current span of the host application, with the exceptions listed below. -##### Cursors +##### Transactions -If the driver operation returns a cursor, spans for all the subsequent operations on the cursor SHOULD be nested into -the operation span. This includes operations such as `getMore`, `next`, `close`. +When a user starts a transaction with `startTransaction`, the driver SHOULD create a span for the pseudo operation +`transaction`. This span MUST have only one attribute `db.system` with the value `mongodb`. All operations executed +within the transaction SHOULD be nested to the `transaction` span. + +When a user commits or aborts a transaction with `commitTransaction` or `abortTransaction`, the driver SHOULD finish the +`transaction` span. ##### `withTransaction` -The `withTransaction` operation is a special case because it may include other operations that are executed "in scope" -of `withTransaction`. In this case, spans for operations that are executed inside the callbacks SHOULD be nested into +In case of `withTransaction` operation spans for operations that are executed inside the callbacks SHOULD be nested into the `withTransaction` span. ##### Span Name @@ -191,12 +194,16 @@ Spans SHOULD have the following attributes: | `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.response.status_code and error.type +Besides the attributes listed in the table above, drivers MAY add other attributes from the +[Semantic Conventions for Databases](https://opentelemetry.io/docs/specs/semconv/registry/attributes/db/) that are +applicable to MongoDB. + +###### db.response.status_code and error.type These attributes should be added only if the command was not successful. The content of `error.type` is language specific; a driver decides what best describes the error. -##### db.query.text +###### db.query.text 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 @@ -210,13 +217,19 @@ added and truncated to the provided value (similar to the Logging specification) On the `MongoClient` level this configuration can be implemented with a `MongoClient` option, for example, `tracing.query_text_max_length`. -##### db.mongodb.cursor_id +###### db.mongodb.cursor_id If the command returns a cursor, or uses a cursor, the `cursor_id` attribute SHOULD be added. -##### Exception Handling +##### Exceptions -Exceptions MUST be added to the parent span of the command span, which is the driver operation span. +If the server command fails with an exception, drivers MUST record an exception to the current command span. When +recording an exception, drivers SHOULD add the following attributes to the span, when the content for the attribute if +available: + +- `exception.message` +- `exception.type` +- `exception.stacktrace` ## Motivation for Change From b478c9e229a682bd67966d6892ea8af657eab6bc Mon Sep 17 00:00:00 2001 From: Dmitry Rybakov Date: Wed, 3 Sep 2025 16:37:24 +0200 Subject: [PATCH 38/62] Fix bulkWrite test --- source/open-telemetry/tests/operation/bulk_write.json | 4 ++-- source/open-telemetry/tests/operation/bulk_write.yml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/source/open-telemetry/tests/operation/bulk_write.json b/source/open-telemetry/tests/operation/bulk_write.json index 1646af4012..305391d15e 100644 --- a/source/open-telemetry/tests/operation/bulk_write.json +++ b/source/open-telemetry/tests/operation/bulk_write.json @@ -156,12 +156,12 @@ "db.operation.summary": "bulkWrite operation-bulk-write.test", "nested": [ { - "name": "command bulkWrite", + "name": "bulkWrite bulkWrite operation-bulk-write.test", "attributes": { "db.system": "mongodb" }, "db.namespace": "admin", - "db.collection.name": "admin.$cmd", + "db.collection.name": "test", "db.command.name": "bulkWrite", "network.transport": "tcp", "db.mongodb.cursor_id": { diff --git a/source/open-telemetry/tests/operation/bulk_write.yml b/source/open-telemetry/tests/operation/bulk_write.yml index 66ccc09e5a..4d291a8723 100644 --- a/source/open-telemetry/tests/operation/bulk_write.yml +++ b/source/open-telemetry/tests/operation/bulk_write.yml @@ -70,11 +70,11 @@ tests: db.operation.name: bulkWrite db.operation.summary: bulkWrite operation-bulk-write.test nested: - - name: command bulkWrite + - name: bulkWrite bulkWrite operation-bulk-write.test attributes: db.system: mongodb db.namespace: admin - db.collection.name: admin.$cmd + db.collection.name: test db.command.name: bulkWrite network.transport: tcp db.mongodb.cursor_id: { $$exists: false } From 0a1134dedf6557c009abf155b5fe8623ec8ce8de Mon Sep 17 00:00:00 2001 From: Nabil Hachicha Date: Mon, 8 Sep 2025 18:31:33 +0100 Subject: [PATCH 39/62] Updating tests: - 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 --- .../open-telemetry/tests/cursor/cursor.json | 238 ++++++------- source/open-telemetry/tests/cursor/cursor.yml | 104 +++--- .../tests/operation/aggregate.json | 4 +- .../tests/operation/aggregate.yml | 4 +- .../tests/operation/atlas_search.json | 221 ++++++------ .../tests/operation/atlas_search.yml | 119 +++---- .../tests/operation/bulk_write.json | 314 ++++++++++-------- .../tests/operation/bulk_write.yml | 192 ++++++++--- .../open-telemetry/tests/operation/count.json | 10 +- .../open-telemetry/tests/operation/count.yml | 11 +- .../tests/operation/create_collection.json | 4 +- .../tests/operation/create_collection.yml | 4 +- .../tests/operation/create_indexes.json | 4 +- .../tests/operation/create_indexes.yml | 4 +- .../tests/operation/create_view.json | 160 ++++----- .../tests/operation/create_view.yml | 74 ++--- .../tests/operation/delete.json | 11 +- .../open-telemetry/tests/operation/delete.yml | 11 +- .../tests/operation/distinct.json | 4 +- .../tests/operation/distinct.yml | 4 +- .../tests/operation/drop_collection.json | 4 +- .../tests/operation/drop_collection.yml | 4 +- .../tests/operation/drop_indexes.json | 4 +- .../tests/operation/drop_indexes.yml | 4 +- .../open-telemetry/tests/operation/find.json | 6 +- .../open-telemetry/tests/operation/find.yml | 6 +- .../tests/operation/find_one_and_update.json | 10 +- .../tests/operation/find_one_and_update.yml | 10 +- .../tests/operation/find_retries.json | 258 +++++++------- .../tests/operation/find_retries.yml | 126 +++---- .../tests/operation/insert.json | 98 +++--- .../open-telemetry/tests/operation/insert.yml | 54 +-- .../tests/operation/list_collections.json | 104 +++--- .../tests/operation/list_collections.yml | 48 +-- .../tests/operation/list_databases.json | 17 +- .../tests/operation/list_databases.yml | 13 +- .../tests/operation/list_indexes.json | 4 +- .../tests/operation/list_indexes.yml | 4 +- .../tests/operation/map_reduce.json | 6 +- .../tests/operation/map_reduce.yml | 6 +- .../tests/operation/retries.json | 24 +- .../tests/operation/retries.yml | 19 +- .../tests/operation/update.json | 4 +- .../open-telemetry/tests/operation/update.yml | 4 +- .../tests/transaction/transaction.json | 170 +++++----- .../tests/transaction/transaction.yml | 95 +++--- 46 files changed, 1383 insertions(+), 1216 deletions(-) diff --git a/source/open-telemetry/tests/cursor/cursor.json b/source/open-telemetry/tests/cursor/cursor.json index 11bf9105e2..9b3cc80163 100644 --- a/source/open-telemetry/tests/cursor/cursor.json +++ b/source/open-telemetry/tests/cursor/cursor.json @@ -102,7 +102,7 @@ }, "nested": [ { - "name": "find cursor.test", + "name": "find", "attributes": { "db.system": "mongodb", "db.namespace": "cursor", @@ -133,7 +133,7 @@ "long" ] }, - "db.query.summary": "find", + "db.query.summary": "find cursor.test", "db.query.text": { "$$matchAsDocument": { "$$matchAsRoot": { @@ -160,130 +160,130 @@ ] } } - } - ] - }, - { - "name": "getMore cursor.test", - "attributes": { - "db.system": "mongodb", - "db.namespace": "cursor", - "db.collection.name": "test", - "db.command.name": "getMore", - "network.transport": "tcp", - "db.mongodb.cursor_id": { - "$$type": [ - "int", - "long" - ] - }, - "db.response.status_code": { - "$$exists": false }, - "exception.message": { - "$$exists": false - }, - "exception.type": { - "$$exists": false - }, - "exception.stacktrace": { - "$$exists": false - }, - "server.address": { - "$$type": "string" - }, - "server.port": { - "$$type": [ - "int", - "long" - ] - }, - "db.query.summary": "getMore", - "db.query.text": { - "$$matchAsDocument": { - "$$matchAsRoot": { - "getMore": { - "$$type": "long" - }, - "collection": "test", - "batchSize": 2 + { + "name": "getMore", + "attributes": { + "db.system": "mongodb", + "db.namespace": "cursor", + "db.collection.name": "test", + "db.command.name": "getMore", + "network.transport": "tcp", + "db.mongodb.cursor_id": { + "$$type": [ + "int", + "long" + ] + }, + "db.response.status_code": { + "$$exists": false + }, + "exception.message": { + "$$exists": false + }, + "exception.type": { + "$$exists": false + }, + "exception.stacktrace": { + "$$exists": false + }, + "server.address": { + "$$type": "string" + }, + "server.port": { + "$$type": [ + "int", + "long" + ] + }, + "db.query.summary": "getMore cursor.test", + "db.query.text": { + "$$matchAsDocument": { + "$$matchAsRoot": { + "getMore": { + "$$type": "long" + }, + "collection": "test", + "batchSize": 2 + } + } + }, + "db.mongodb.server_connection_id": { + "$$type": [ + "int", + "long" + ] + }, + "db.mongodb.driver_connection_id": { + "$$type": [ + "int", + "long" + ] } } }, - "db.mongodb.server_connection_id": { - "$$type": [ - "int", - "long" - ] - }, - "db.mongodb.driver_connection_id": { - "$$type": [ - "int", - "long" - ] - } - } - }, - { - "name": "getMore cursor.test", - "attributes": { - "db.system": "mongodb", - "db.namespace": "cursor", - "db.collection.name": "test", - "db.command.name": "getMore", - "network.transport": "tcp", - "db.mongodb.cursor_id": { - "$$type": [ - "int", - "long" - ] - }, - "db.response.status_code": { - "$$exists": false - }, - "exception.message": { - "$$exists": false - }, - "exception.type": { - "$$exists": false - }, - "exception.stacktrace": { - "$$exists": false - }, - "server.address": { - "$$type": "string" - }, - "server.port": { - "$$type": [ - "int", - "long" - ] - }, - "db.query.summary": "getMore", - "db.query.text": { - "$$matchAsDocument": { - "$$matchAsRoot": { - "getMore": { - "$$type": "long" - }, - "collection": "test", - "batchSize": 2 + { + "name": "getMore", + "attributes": { + "db.system": "mongodb", + "db.namespace": "cursor", + "db.collection.name": "test", + "db.command.name": "getMore", + "network.transport": "tcp", + "db.mongodb.cursor_id": { + "$$type": [ + "int", + "long" + ] + }, + "db.response.status_code": { + "$$exists": false + }, + "exception.message": { + "$$exists": false + }, + "exception.type": { + "$$exists": false + }, + "exception.stacktrace": { + "$$exists": false + }, + "server.address": { + "$$type": "string" + }, + "server.port": { + "$$type": [ + "int", + "long" + ] + }, + "db.query.summary": "getMore cursor.test", + "db.query.text": { + "$$matchAsDocument": { + "$$matchAsRoot": { + "getMore": { + "$$type": "long" + }, + "collection": "test", + "batchSize": 2 + } + } + }, + "db.mongodb.server_connection_id": { + "$$type": [ + "int", + "long" + ] + }, + "db.mongodb.driver_connection_id": { + "$$type": [ + "int", + "long" + ] } } - }, - "db.mongodb.server_connection_id": { - "$$type": [ - "int", - "long" - ] - }, - "db.mongodb.driver_connection_id": { - "$$type": [ - "int", - "long" - ] } - } + ] } ] } diff --git a/source/open-telemetry/tests/cursor/cursor.yml b/source/open-telemetry/tests/cursor/cursor.yml index 9b160122bf..a2b0041304 100644 --- a/source/open-telemetry/tests/cursor/cursor.yml +++ b/source/open-telemetry/tests/cursor/cursor.yml @@ -50,7 +50,7 @@ tests: db.operation.name: find db.operation.summary: find cursor.test nested: - - name: find cursor.test + - name: find attributes: db.system: mongodb db.namespace: cursor @@ -64,7 +64,7 @@ tests: exception.stacktrace: { $$exists: false } server.address: { $$type: string } server.port: { $$type: ['int', 'long'] } - db.query.summary: find + db.query.summary: find cursor.test db.query.text: $$matchAsDocument: $$matchAsRoot: @@ -76,54 +76,54 @@ tests: db.mongodb.driver_connection_id: $$type: [ 'int', 'long' ] - - name: getMore cursor.test - attributes: - db.system: mongodb - db.namespace: cursor - db.collection.name: *collectionName0 - db.command.name: getMore - network.transport: tcp - db.mongodb.cursor_id: { $$type: [ 'int', 'long' ] } - db.response.status_code: { $$exists: false } - exception.message: { $$exists: false } - exception.type: { $$exists: false } - exception.stacktrace: { $$exists: false } - server.address: { $$type: string } - server.port: { $$type: ['int', 'long'] } - db.query.summary: getMore - db.query.text: - $$matchAsDocument: - $$matchAsRoot: - getMore: { $$type: long } - collection: test - batchSize: 2 - db.mongodb.server_connection_id: - $$type: [ 'int', 'long' ] - db.mongodb.driver_connection_id: - $$type: [ 'int', 'long' ] + - name: getMore + attributes: + db.system: mongodb + db.namespace: cursor + db.collection.name: *collectionName0 + db.command.name: getMore + network.transport: tcp + db.mongodb.cursor_id: { $$type: [ 'int', 'long' ] } + db.response.status_code: { $$exists: false } + exception.message: { $$exists: false } + exception.type: { $$exists: false } + exception.stacktrace: { $$exists: false } + server.address: { $$type: string } + server.port: { $$type: ['int', 'long'] } + db.query.summary: getMore cursor.test + db.query.text: + $$matchAsDocument: + $$matchAsRoot: + getMore: { $$type: long } + collection: test + batchSize: 2 + db.mongodb.server_connection_id: + $$type: [ 'int', 'long' ] + db.mongodb.driver_connection_id: + $$type: [ 'int', 'long' ] - - name: getMore cursor.test - attributes: - db.system: mongodb - db.namespace: cursor - db.collection.name: *collectionName0 - db.command.name: getMore - network.transport: tcp - db.mongodb.cursor_id: { $$type: [ 'int', 'long' ] } - db.response.status_code: { $$exists: false } - exception.message: { $$exists: false } - exception.type: { $$exists: false } - exception.stacktrace: { $$exists: false } - server.address: { $$type: string } - server.port: { $$type: ['int', 'long'] } - db.query.summary: getMore - db.query.text: - $$matchAsDocument: - $$matchAsRoot: - getMore: { $$type: long } - collection: test - batchSize: 2 - db.mongodb.server_connection_id: - $$type: [ 'int', 'long' ] - db.mongodb.driver_connection_id: - $$type: [ 'int', 'long' ] + - name: getMore + attributes: + db.system: mongodb + db.namespace: cursor + db.collection.name: *collectionName0 + db.command.name: getMore + network.transport: tcp + db.mongodb.cursor_id: { $$type: [ 'int', 'long' ] } + db.response.status_code: { $$exists: false } + exception.message: { $$exists: false } + exception.type: { $$exists: false } + exception.stacktrace: { $$exists: false } + server.address: { $$type: string } + server.port: { $$type: ['int', 'long'] } + db.query.summary: getMore cursor.test + db.query.text: + $$matchAsDocument: + $$matchAsRoot: + getMore: { $$type: long } + collection: test + batchSize: 2 + db.mongodb.server_connection_id: + $$type: [ 'int', 'long' ] + db.mongodb.driver_connection_id: + $$type: [ 'int', 'long' ] diff --git a/source/open-telemetry/tests/operation/aggregate.json b/source/open-telemetry/tests/operation/aggregate.json index c99bc2bcfd..4d5db5ea1d 100644 --- a/source/open-telemetry/tests/operation/aggregate.json +++ b/source/open-telemetry/tests/operation/aggregate.json @@ -60,7 +60,7 @@ }, "nested": [ { - "name": "aggregate operation-aggregate.test", + "name": "aggregate", "attributes": { "db.system": "mongodb", "db.namespace": "operation-aggregate", @@ -91,7 +91,7 @@ "long" ] }, - "db.query.summary": "aggregate", + "db.query.summary": "aggregate operation-aggregate.test", "db.query.text": { "$$matchAsDocument": { "$$matchAsRoot": { diff --git a/source/open-telemetry/tests/operation/aggregate.yml b/source/open-telemetry/tests/operation/aggregate.yml index 0652a13e76..d8e91387fa 100644 --- a/source/open-telemetry/tests/operation/aggregate.yml +++ b/source/open-telemetry/tests/operation/aggregate.yml @@ -36,7 +36,7 @@ tests: db.operation.name: aggregate db.operation.summary: aggregate operation-aggregate.test nested: - - name: aggregate operation-aggregate.test + - name: aggregate attributes: db.system: mongodb db.namespace: operation-aggregate @@ -50,7 +50,7 @@ tests: exception.stacktrace: { $$exists: false } server.address: { $$type: string } server.port: { $$type: ['int', 'long'] } - db.query.summary: aggregate + db.query.summary: aggregate operation-aggregate.test db.query.text: $$matchAsDocument: $$matchAsRoot: diff --git a/source/open-telemetry/tests/operation/atlas_search.json b/source/open-telemetry/tests/operation/atlas_search.json index 15ee71de09..0774355213 100644 --- a/source/open-telemetry/tests/operation/atlas_search.json +++ b/source/open-telemetry/tests/operation/atlas_search.json @@ -101,134 +101,137 @@ { "name": "createSearchIndexes operation-atlas-search.test", "attributes": { - "db.system": "mongodb" + "db.system": "mongodb", + "db.namespace": "operation-atlas-search", + "db.collection.name": "test", + "db.operation.name": "createSearchIndexes", + "db.operation.summary": "createSearchIndexes operation-atlas-search.test" }, - "db.namespace": "operation-atlas-search", - "db.collection.name": "test", - "db.operation.name": "createSearchIndexes", - "db.operation.summary": "createSearchIndexes operation-atlas-search.test", "nested": [ { - "name": "command createSearchIndexes", + "name": "createSearchIndexes", "attributes": { - "db.system": "mongodb" - }, - "db.namespace": "operation-atlas-search", - "server.address": { - "$$type": "string" - }, - "server.port": { - "$$type": [ - "long", - "string" - ] - }, - "server.type": { - "$$type": "string" - }, - "db.query.summary": "createSearchIndexes", - "db.query.text": { - "$$matchAsDocument": { - "$$matchAsRoot": { - "createSearchIndexes": "test", - "indexes": [ - { - "type": "search", - "definition": { - "mappings": { - "dynamic": true + "db.system": "mongodb", + "db.namespace": "operation-atlas-search", + "db.collection.name": "test", + "server.address": { + "$$type": "string" + }, + "server.port": { + "$$type": [ + "long", + "string" + ] + }, + "server.type": { + "$$type": "string" + }, + "db.query.summary": "createSearchIndexes operation-atlas-search.test", + "db.query.text": { + "$$matchAsDocument": { + "$$matchAsRoot": { + "createSearchIndexes": "test", + "indexes": [ + { + "type": "search", + "definition": { + "mappings": { + "dynamic": true + } } } - } - ] + ] + } } } } } ] - } - ] - }, - { - "name": "updateSearchIndex operation-atlas-search.test", - "attributes": { - "db.system": "mongodb", - "db.namespace": "operation-atlas-search", - "db.collection.name": "test", - "db.operation.name": "updateSearchIndex", - "db.operation.summary": "updateSearchIndex operation-atlas-search.test", - "nested": [ - { - "name": "command updateSearchIndex", - "attributes": { - "db.system": "mongodb", - "db.namespace": "operation-atlas-search", - "server.address": { - "$$type": "string" - }, - "server.port": { - "$$type": [ - "long", - "string" - ] - }, - "server.type": { - "$$type": "string" - }, - "db.query.summary": "updateSearchIndex", - "db.query.text": { - "$$matchAsDocument": { - "$$matchAsRoot": { - "updateSearchIndex": "test", - "name": "test index", - "definition": {} + }, + { + "name": "updateSearchIndex operation-atlas-search.test", + "attributes": { + "db.system": "mongodb", + "db.namespace": "operation-atlas-search", + "db.collection.name": "test", + "db.operation.name": "updateSearchIndex", + "db.operation.summary": "updateSearchIndex operation-atlas-search.test" + }, + "nested": [ + { + "name": "updateSearchIndex", + "attributes": { + "db.system": "mongodb", + "db.namespace": "operation-atlas-search", + "db.collection.name": "test", + "server.address": { + "$$type": "string" + }, + "server.port": { + "$$type": [ + "long", + "string" + ] + }, + "server.type": { + "$$type": "string" + }, + "db.query.summary": "updateSearchIndex operation-atlas-search.test", + "db.query.text": { + "$$matchAsDocument": { + "$$matchAsRoot": { + "updateSearchIndex": "test", + "name": "test index", + "definition": {} + } } } } } - } - ] - } - }, - { - "name": "dropSearchIndex operation-atlas-search.test", - "attributes": { - "db.system": "mongodb", - "db.namespace": "operation-atlas-search", - "db.collection.name": "test", - "db.operation.name": "dropSearchIndex", - "db.operation.summary": "dropSearchIndex operation-atlas-search.test", - "nested": [ - { - "name": "command dropSearchIndex", - "attributes": { - "db.system": "mongodb", - "db.namespace": "operation-atlas-search", - "server.address": { - "$$type": "string" - }, - "server.port": { - "$$type": [ - "long", - "string" - ] - }, - "server.type": { - "$$type": "string" - }, - "db.query.summary": "dropSearchIndex", - "db.query.text": { - "$$matchAsDocument": { - "$$matchAsRoot": { - "dropSearchIndex": "test", - "name": "test index" + ] + }, + { + "name": "dropSearchIndex operation-atlas-search.test", + "attributes": { + "db.system": "mongodb", + "db.namespace": "operation-atlas-search", + "db.collection.name": "test", + "db.operation.name": "dropSearchIndex", + "db.operation.summary": "dropSearchIndex operation-atlas-search.test" + }, + "nested": [ + { + "name": "dropSearchIndex", + "attributes": { + "db.system": "mongodb", + "db.namespace": "operation-atlas-search", + "db.collection.name": "test", + "server.address": { + "$$type": "string" + }, + "server.port": { + "$$type": [ + "long", + "string" + ] + }, + "server.type": { + "$$type": "string" + }, + "db.query.summary": "dropSearchIndex operation-atlas-search.test", + "db.query.text": { + "$$matchAsDocument": { + "$$matchAsRoot": { + "dropSearchIndex": "test", + "name": "test index" + } } } } } - } - ] - } + ] + } + ] } ] } diff --git a/source/open-telemetry/tests/operation/atlas_search.yml b/source/open-telemetry/tests/operation/atlas_search.yml index 9fd7f05994..ae88278367 100644 --- a/source/open-telemetry/tests/operation/atlas_search.yml +++ b/source/open-telemetry/tests/operation/atlas_search.yml @@ -71,66 +71,69 @@ tests: - name: createSearchIndexes operation-atlas-search.test attributes: db.system: mongodb - db.namespace: operation-atlas-search - db.collection.name: test - db.operation.name: createSearchIndexes - db.operation.summary: createSearchIndexes operation-atlas-search.test + db.namespace: operation-atlas-search + db.collection.name: test + db.operation.name: createSearchIndexes + db.operation.summary: createSearchIndexes operation-atlas-search.test nested: - - name: command createSearchIndexes + - name: createSearchIndexes attributes: db.system: mongodb - db.namespace: operation-atlas-search - server.address: { $$type: string } - server.port: { $$type: [ 'long', 'string' ] } - server.type: { $$type: string } - db.query.summary: createSearchIndexes - db.query.text: - $$matchAsDocument: - $$matchAsRoot: - createSearchIndexes: test - indexes: [ { "type": "search", "definition": { "mappings": { "dynamic": true } } } ] + db.namespace: operation-atlas-search + db.collection.name: test + server.address: { $$type: string } + server.port: { $$type: [ 'long', 'string' ] } + server.type: { $$type: string } + db.query.summary: createSearchIndexes operation-atlas-search.test + db.query.text: + $$matchAsDocument: + $$matchAsRoot: + createSearchIndexes: test + indexes: [ { "type": "search", "definition": { "mappings": { "dynamic": true } } } ] - - name: updateSearchIndex operation-atlas-search.test - attributes: - db.system: mongodb - db.namespace: operation-atlas-search - db.collection.name: test - db.operation.name: updateSearchIndex - db.operation.summary: updateSearchIndex operation-atlas-search.test - nested: - - name: command updateSearchIndex - attributes: - db.system: mongodb - db.namespace: operation-atlas-search - server.address: { $$type: string } - server.port: { $$type: [ 'long', 'string' ] } - server.type: { $$type: string } - db.query.summary: updateSearchIndex - db.query.text: - $$matchAsDocument: - $$matchAsRoot: - updateSearchIndex: test - name: test index - definition: {} + - name: updateSearchIndex operation-atlas-search.test + attributes: + db.system: mongodb + db.namespace: operation-atlas-search + db.collection.name: test + db.operation.name: updateSearchIndex + db.operation.summary: updateSearchIndex operation-atlas-search.test + nested: + - name: updateSearchIndex + attributes: + db.system: mongodb + db.namespace: operation-atlas-search + db.collection.name: test + server.address: { $$type: string } + server.port: { $$type: [ 'long', 'string' ] } + server.type: { $$type: string } + db.query.summary: updateSearchIndex operation-atlas-search.test + db.query.text: + $$matchAsDocument: + $$matchAsRoot: + updateSearchIndex: test + name: test index + definition: {} - - name: dropSearchIndex operation-atlas-search.test - attributes: - db.system: mongodb - db.namespace: operation-atlas-search - db.collection.name: test - db.operation.name: dropSearchIndex - db.operation.summary: dropSearchIndex operation-atlas-search.test - nested: - - name: command dropSearchIndex - attributes: - db.system: mongodb - db.namespace: operation-atlas-search - server.address: { $$type: string } - server.port: { $$type: [ 'long', 'string' ] } - server.type: { $$type: string } - db.query.summary: dropSearchIndex - db.query.text: - $$matchAsDocument: - $$matchAsRoot: - dropSearchIndex: test - name: test index + - name: dropSearchIndex operation-atlas-search.test + attributes: + db.system: mongodb + db.namespace: operation-atlas-search + db.collection.name: test + db.operation.name: dropSearchIndex + db.operation.summary: dropSearchIndex operation-atlas-search.test + nested: + - name: dropSearchIndex + attributes: + db.system: mongodb + db.namespace: operation-atlas-search + db.collection.name: test + server.address: { $$type: string } + server.port: { $$type: [ 'long', 'string' ] } + server.type: { $$type: string } + db.query.summary: dropSearchIndex operation-atlas-search.test + db.query.text: + $$matchAsDocument: + $$matchAsRoot: + dropSearchIndex: test + name: test index diff --git a/source/open-telemetry/tests/operation/bulk_write.json b/source/open-telemetry/tests/operation/bulk_write.json index 305391d15e..8b4ef65b4c 100644 --- a/source/open-telemetry/tests/operation/bulk_write.json +++ b/source/open-telemetry/tests/operation/bulk_write.json @@ -21,26 +21,46 @@ "database": { "id": "database0", "client": "client0", - "databaseName": "operation-bulk-write" + "databaseName": "operation-bulk-write-0" + } + }, + { + "database": { + "id": "database1", + "client": "client0", + "databaseName": "operation-bulk-write-1" } }, { "collection": { "id": "collection0", "database": "database0", - "collectionName": "test" + "collectionName": "test0" + } + }, + { + "collection": { + "id": "collection1", + "database": "database1", + "collectionName": "test1" } } ], "initialData": [ { - "collectionName": "test", - "databaseName": "operation-bulk-write", + "collectionName": "test0", + "databaseName": "operation-bulk-write-0", + "documents": [] + }, + { + "collectionName": "test1", + "databaseName": "operation-bulk-write-1", "documents": [] } ], "_yamlAnchors": { - "namespace": "operation-bulk-write.test" + "namespace0": "operation-bulk-write-0.test0", + "namespace1": "operation-bulk-write-1.test1" }, "tests": [ { @@ -53,7 +73,7 @@ "models": [ { "insertOne": { - "namespace": "operation-bulk-write.test", + "namespace": "operation-bulk-write-0.test0", "document": { "_id": 8, "x": 88 @@ -62,7 +82,7 @@ }, { "updateOne": { - "namespace": "operation-bulk-write.test", + "namespace": "operation-bulk-write-0.test0", "filter": { "_id": 1 }, @@ -75,7 +95,7 @@ }, { "updateMany": { - "namespace": "operation-bulk-write.test", + "namespace": "operation-bulk-write-1.test1", "filter": { "$and": [ { @@ -99,7 +119,7 @@ }, { "replaceOne": { - "namespace": "operation-bulk-write.test", + "namespace": "operation-bulk-write-1.test1", "filter": { "_id": 4 }, @@ -111,7 +131,7 @@ }, { "deleteOne": { - "namespace": "operation-bulk-write.test", + "namespace": "operation-bulk-write-0.test0", "filter": { "_id": 5 } @@ -119,7 +139,7 @@ }, { "deleteMany": { - "namespace": "operation-bulk-write.test", + "namespace": "operation-bulk-write-1.test1", "filter": { "$and": [ { @@ -146,152 +166,164 @@ "ignoreExtraSpans": false, "spans": [ { - "name": "bulkWrite operation-bulk-write.test", + "name": "bulkWrite admin", "attributes": { - "db.system": "mongodb" + "db.system": "mongodb", + "db.namespace": "admin", + "db.collection.name": { + "$$exists": false + }, + "db.operation.name": "bulkWrite", + "db.operation.summary": "bulkWrite admin" }, - "db.namespace": "operation-bulk-write", - "db.collection.name": "test", - "db.operation.name": "bulkWrite", - "db.operation.summary": "bulkWrite operation-bulk-write.test", "nested": [ { - "name": "bulkWrite bulkWrite operation-bulk-write.test", + "name": "bulkWrite", "attributes": { - "db.system": "mongodb" - }, - "db.namespace": "admin", - "db.collection.name": "test", - "db.command.name": "bulkWrite", - "network.transport": "tcp", - "db.mongodb.cursor_id": { - "$$exists": false - }, - "db.response.status_code": { - "$$exists": false - }, - "exception.message": { - "$$exists": false - }, - "exception.type": { - "$$exists": false - }, - "exception.stacktrace": { - "$$exists": false - }, - "server.address": { - "$$type": "string" - }, - "server.port": { - "$$type": [ - "int", - "long" - ] - }, - "server.type": { - "$$type": "string" - }, - "db.query.summary": "bulkWrite", - "db.query.text": { - "$$matchAsDocument": { - "$$matchAsRoot": { - "bulkWrite": 1, - "errorsOnly": true, - "ordered": true, - "ops": [ - { - "insert": 0, - "document": { - "_id": 8, - "x": 88 - } - }, - { - "update": 0, - "multi": false, - "filter": { - "_id": 1 + "db.system": "mongodb", + "db.namespace": "admin", + "db.collection.name": { + "$$exists": false + }, + "db.command.name": "bulkWrite", + "network.transport": "tcp", + "db.mongodb.cursor_id": { + "$$exists": false + }, + "db.response.status_code": { + "$$exists": false + }, + "exception.message": { + "$$exists": false + }, + "exception.type": { + "$$exists": false + }, + "exception.stacktrace": { + "$$exists": false + }, + "server.address": { + "$$type": "string" + }, + "server.port": { + "$$type": [ + "int", + "long" + ] + }, + "server.type": { + "$$type": "string" + }, + "db.query.summary": "bulkWrite admin", + "db.query.text": { + "$$matchAsDocument": { + "$$matchAsRoot": { + "bulkWrite": 1, + "errorsOnly": true, + "ordered": true, + "ops": [ + { + "insert": 0, + "document": { + "_id": 8, + "x": 88 + } }, - "updateMods": { - "$inc": { - "x": 1 + { + "update": 0, + "multi": false, + "filter": { + "_id": 1 + }, + "updateMods": { + "$inc": { + "x": 1 + } } - } - }, - { - "update": 0, - "multi": true, - "filter": { - "$and": [ - { - "_id": { - "$gt": 1 - } - }, - { - "_id": { - "$lte": 3 + }, + { + "update": 1, + "multi": true, + "filter": { + "$and": [ + { + "_id": { + "$gt": 1 + } + }, + { + "_id": { + "$lte": 3 + } } + ] + }, + "updateMods": { + "$inc": { + "x": 2 } - ] - }, - "updateMods": { - "$inc": { - "x": 2 } - } - }, - { - "update": 0, - "multi": false, - "filter": { - "_id": 4 }, - "updateMods": { - "x": 44 + { + "update": 1, + "multi": false, + "filter": { + "_id": 4 + }, + "updateMods": { + "x": 44 + }, + "upsert": true }, - "upsert": true - }, - { - "delete": 0, - "multi": false, - "filter": { - "_id": 5 - } - }, - { - "delete": 0, - "multi": true, - "filter": { - "$and": [ - { - "_id": { - "$gt": 5 - } - }, - { - "_id": { - "$lte": 7 + { + "delete": 0, + "multi": false, + "filter": { + "_id": 5 + } + }, + { + "delete": 1, + "multi": true, + "filter": { + "$and": [ + { + "_id": { + "$gt": 5 + } + }, + { + "_id": { + "$lte": 7 + } } - } - ] + ] + } + } + ], + "nsInfo": [ + { + "ns": "operation-bulk-write-0.test0" + }, + { + "ns": "operation-bulk-write-1.test1" } - } - ] + ] + } } + }, + "db.mongodb.server_connection_id": { + "$$type": [ + "int", + "long" + ] + }, + "db.mongodb.driver_connection_id": { + "$$type": [ + "int", + "long" + ] } - }, - "db.mongodb.server_connection_id": { - "$$type": [ - "int", - "long" - ] - }, - "db.mongodb.driver_connection_id": { - "$$type": [ - "int", - "long" - ] } } ] diff --git a/source/open-telemetry/tests/operation/bulk_write.yml b/source/open-telemetry/tests/operation/bulk_write.yml index 4d291a8723..e6f212f4c3 100644 --- a/source/open-telemetry/tests/operation/bulk_write.yml +++ b/source/open-telemetry/tests/operation/bulk_write.yml @@ -13,18 +13,31 @@ createEntities: - database: id: &database0 database0 client: *client0 - databaseName: &databaseName operation-bulk-write + databaseName: &databaseName0 operation-bulk-write-0 + - database: + id: &database1 database1 + client: *client0 + databaseName: &databaseName1 operation-bulk-write-1 - collection: id: collection0 database: *database0 - collectionName: &collectionName test + collectionName: &collectionName0 test0 + - collection: + id: collection1 + database: *database1 + collectionName: &collectionName1 test1 + initialData: - - collectionName: *collectionName - databaseName: *databaseName - documents: [] + - collectionName: *collectionName0 + databaseName: *databaseName0 + documents: [ ] + - collectionName: *collectionName1 + databaseName: *databaseName1 + documents: [ ] _yamlAnchors: - namespace: &namespace "operation-bulk-write.test" + namespace0: &namespace0 "operation-bulk-write-0.test0" + namespace1: &namespace1 "operation-bulk-write-1.test1" tests: - description: bulkWrite @@ -34,27 +47,27 @@ tests: arguments: models: - insertOne: - namespace: *namespace + namespace: *namespace0 document: { _id: 8, x: 88 } - updateOne: - namespace: *namespace + namespace: *namespace0 filter: { _id: 1 } update: { $inc: { x: 1 } } - updateMany: - namespace: *namespace + namespace: *namespace1 filter: $and: [ { _id: { $gt: 1 } }, { _id: { $lte: 3 } } ] update: { $inc: { x: 2 } } - replaceOne: - namespace: *namespace + namespace: *namespace1 filter: { _id: 4 } replacement: { x: 44 } upsert: true - deleteOne: - namespace: *namespace + namespace: *namespace0 filter: { _id: 5 } - deleteMany: - namespace: *namespace + namespace: *namespace1 filter: $and: [ { _id: { $gt: 5 } }, { _id: { $lte: 7 } } ] @@ -62,46 +75,125 @@ tests: - client: *client0 ignoreExtraSpans: false spans: - - name: bulkWrite operation-bulk-write.test + - name: bulkWrite admin attributes: db.system: mongodb - db.namespace: operation-bulk-write - db.collection.name: test - db.operation.name: bulkWrite - db.operation.summary: bulkWrite operation-bulk-write.test + db.namespace: admin + db.collection.name: { $$exists: false } + db.operation.name: bulkWrite + db.operation.summary: bulkWrite admin nested: - - name: bulkWrite bulkWrite operation-bulk-write.test + - name: bulkWrite attributes: db.system: mongodb - db.namespace: admin - db.collection.name: test - db.command.name: bulkWrite - network.transport: tcp - db.mongodb.cursor_id: { $$exists: false } - db.response.status_code: { $$exists: false } - exception.message: { $$exists: false } - exception.type: { $$exists: false } - exception.stacktrace: { $$exists: false } - server.address: { $$type: string } - server.port: { $$type: ['int', 'long'] } - server.type: { $$type: string } - db.query.summary: bulkWrite - db.query.text: - $$matchAsDocument: - $$matchAsRoot: - bulkWrite: 1 - errorsOnly: true - ordered: true - ops: [ { "insert": 0, "document": { "_id": 8, "x": 88 } }, - { "update": 0, "multi": false, "filter": { "_id": 1 }, "updateMods": { "$inc": { "x": 1 } } }, - { "update": 0, "multi": true, "filter": { "$and": [ { "_id": { "$gt": 1 } }, { "_id": { "$lte": 3 } } ] }, - "updateMods": { "$inc": { "x": 2 } } }, - { "update": 0, "multi": false, "filter": { "_id": 4 }, - "updateMods": { "x": 44 }, "upsert": true }, - { "delete": 0, "multi": false, "filter": { "_id": 5 } }, - { "delete": 0, "multi": true, "filter": { "$and": [ - { "_id": { "$gt": 5 } }, { "_id": { "$lte": 7 } } ] } } ] - db.mongodb.server_connection_id: - $$type: [ 'int', 'long' ] - db.mongodb.driver_connection_id: - $$type: [ 'int', 'long' ] + db.namespace: admin + db.collection.name: { $$exists: false } + db.command.name: bulkWrite + network.transport: tcp + db.mongodb.cursor_id: { $$exists: false } + db.response.status_code: { $$exists: false } + exception.message: { $$exists: false } + exception.type: { $$exists: false } + exception.stacktrace: { $$exists: false } + server.address: { $$type: string } + server.port: { $$type: [ 'int', 'long' ] } + server.type: { $$type: string } + db.query.summary: bulkWrite admin + db.query.text: + $$matchAsDocument: + $$matchAsRoot: + bulkWrite: 1 + errorsOnly: true + ordered: true + ops: [ + { + "insert": 0, + "document": { + "_id": 8, + "x": 88 + } + }, + { + "update": 0, + "multi": false, + "filter": { + "_id": 1 + }, + "updateMods": { + "$inc": { + "x": 1 + } + } + }, + { + "update": 1, + "multi": true, + "filter": { + "$and": [ + { + "_id": { + "$gt": 1 + } + }, + { + "_id": { + "$lte": 3 + } + } + ] + }, + "updateMods": { + "$inc": { + "x": 2 + } + } + }, + { + "update": 1, + "multi": false, + "filter": { + "_id": 4 + }, + "updateMods": { + "x": 44 + }, + "upsert": true + }, + { + "delete": 0, + "multi": false, + "filter": { + "_id": 5 + } + }, + { + "delete": 1, + "multi": true, + "filter": { + "$and": [ + { + "_id": { + "$gt": 5 + } + }, + { + "_id": { + "$lte": 7 + } + } + ] + } + } + ] + nsInfo: [ + { + "ns": *namespace0 + }, + { + "ns": *namespace1 + } + ] + db.mongodb.server_connection_id: + $$type: [ 'int', 'long' ] + db.mongodb.driver_connection_id: + $$type: [ 'int', 'long' ] diff --git a/source/open-telemetry/tests/operation/count.json b/source/open-telemetry/tests/operation/count.json index 6083ffc7e5..8c3ec36bd0 100644 --- a/source/open-telemetry/tests/operation/count.json +++ b/source/open-telemetry/tests/operation/count.json @@ -50,17 +50,17 @@ "ignoreExtraSpans": false, "spans": [ { - "name": "estimatedDocumentCount operation-count.test", + "name": "count operation-count.test", "attributes": { "db.system": "mongodb", "db.namespace": "operation-count", "db.collection.name": "test", - "db.operation.name": "estimatedDocumentCount", - "db.operation.summary": "estimatedDocumentCount operation-count.test" + "db.operation.name": "count", + "db.operation.summary": "count operation-count.test" }, "nested": [ { - "name": "count operation-count.test", + "name": "count", "attributes": { "db.system": "mongodb", "db.namespace": "operation-count", @@ -91,7 +91,7 @@ "long" ] }, - "db.query.summary": "count", + "db.query.summary": "count operation-count.test", "db.query.text": { "$$matchAsDocument": { "$$matchAsRoot": { diff --git a/source/open-telemetry/tests/operation/count.yml b/source/open-telemetry/tests/operation/count.yml index 0c5147bc36..59b8a57ef6 100644 --- a/source/open-telemetry/tests/operation/count.yml +++ b/source/open-telemetry/tests/operation/count.yml @@ -30,15 +30,16 @@ tests: - client: *client0 ignoreExtraSpans: false spans: - - name: estimatedDocumentCount operation-count.test + - name: count operation-count.test attributes: db.system: mongodb db.namespace: *database0Name db.collection.name: *collection0Name - db.operation.name: estimatedDocumentCount - db.operation.summary: estimatedDocumentCount operation-count.test + db.operation.name: count + db.operation.summary: count + |||||operation-count.test nested: - - name: count operation-count.test + - name: count attributes: db.system: mongodb db.namespace: *database0Name @@ -52,7 +53,7 @@ tests: exception.stacktrace: { $$exists: false } server.address: { $$type: string } server.port: { $$type: ['int', 'long'] } - db.query.summary: count + db.query.summary: count operation-count.test db.query.text: $$matchAsDocument: $$matchAsRoot: diff --git a/source/open-telemetry/tests/operation/create_collection.json b/source/open-telemetry/tests/operation/create_collection.json index c6b521d37b..8c54738e4f 100644 --- a/source/open-telemetry/tests/operation/create_collection.json +++ b/source/open-telemetry/tests/operation/create_collection.json @@ -47,7 +47,7 @@ }, "nested": [ { - "name": "create operation-create-collection.newlyCreatedCollection", + "name": "create", "attributes": { "db.system": "mongodb", "db.namespace": "operation-create-collection", @@ -78,7 +78,7 @@ "long" ] }, - "db.query.summary": "create", + "db.query.summary": "create operation-create-collection.newlyCreatedCollection", "db.query.text": { "$$matchAsDocument": { "$$matchAsRoot": { diff --git a/source/open-telemetry/tests/operation/create_collection.yml b/source/open-telemetry/tests/operation/create_collection.yml index da65a6b262..e0f8ae9b72 100644 --- a/source/open-telemetry/tests/operation/create_collection.yml +++ b/source/open-telemetry/tests/operation/create_collection.yml @@ -30,7 +30,7 @@ tests: db.operation.name: createCollection db.operation.summary: createCollection operation-create-collection.newlyCreatedCollection nested: - - name: create operation-create-collection.newlyCreatedCollection + - name: create attributes: db.system: mongodb db.namespace: *database0Name @@ -44,7 +44,7 @@ tests: exception.stacktrace: { $$exists: false } server.address: { $$type: string } server.port: { $$type: ['int', 'long'] } - db.query.summary: create + db.query.summary: create operation-create-collection.newlyCreatedCollection db.query.text: $$matchAsDocument: $$matchAsRoot: diff --git a/source/open-telemetry/tests/operation/create_indexes.json b/source/open-telemetry/tests/operation/create_indexes.json index d572f857fe..1fe66ca54a 100644 --- a/source/open-telemetry/tests/operation/create_indexes.json +++ b/source/open-telemetry/tests/operation/create_indexes.json @@ -56,7 +56,7 @@ }, "nested": [ { - "name": "createIndexes operation-create-indexes.test", + "name": "createIndexes", "attributes": { "db.system": "mongodb", "db.namespace": "operation-create-indexes", @@ -87,7 +87,7 @@ "long" ] }, - "db.query.summary": "createIndexes", + "db.query.summary": "createIndexes operation-create-indexes.test", "db.query.text": { "$$matchAsDocument": { "$$matchAsRoot": { diff --git a/source/open-telemetry/tests/operation/create_indexes.yml b/source/open-telemetry/tests/operation/create_indexes.yml index d2c2ae5d69..377d331d7b 100644 --- a/source/open-telemetry/tests/operation/create_indexes.yml +++ b/source/open-telemetry/tests/operation/create_indexes.yml @@ -34,7 +34,7 @@ tests: db.operation.name: createIndexes db.operation.summary: createIndexes operation-create-indexes.test nested: - - name: createIndexes operation-create-indexes.test + - name: createIndexes attributes: db.system: mongodb db.namespace: *database0Name @@ -48,7 +48,7 @@ tests: exception.stacktrace: { $$exists: false } server.address: { $$type: string } server.port: { $$type: ['int', 'long'] } - db.query.summary: createIndexes + db.query.summary: createIndexes operation-create-indexes.test db.query.text: $$matchAsDocument: $$matchAsRoot: diff --git a/source/open-telemetry/tests/operation/create_view.json b/source/open-telemetry/tests/operation/create_view.json index 2d4a73c49d..3ef4e55eda 100644 --- a/source/open-telemetry/tests/operation/create_view.json +++ b/source/open-telemetry/tests/operation/create_view.json @@ -48,91 +48,93 @@ } } ], - "expectTracingMessages": { - "client": "client0", - "ignoreExtraSpans": false, - "spans": [ - { - "name": "createView operation-create-view.my_view", - "attributes": { - "db.system": "mongodb", - "db.namespace": "operation-create-view", - "db.collection.name": "my_view", - "db.operation.name": "createView", - "db.operation.summary": "createView operation-create-view.my_view" - }, - "nested": [ - { - "name": "command create", - "attributes": { - "db.system": "mongodb", - "db.namespace": "operation-create-view", - "db.collection.name": "operation-create-view.$cmd", - "db.command.name": "create", - "network.transport": "tcp", - "db.mongodb.cursor_id": { - "$$exists": false - }, - "db.response.status_code": { - "$$exists": false - }, - "exception.message": { - "$$exists": false - }, - "exception.type": { - "$$exists": false - }, - "exception.stacktrace": { - "$$exists": false - }, - "server.address": { - "$$type": "string" - }, - "server.port": { - "$$type": [ - "int", - "long" - ] - }, - "server.type": { - "$$type": "string" - }, - "db.query.summary": "create", - "db.query.text": { - "$$matchAsDocument": { - "$$matchAsRoot": { - "create": "my_view", - "viewOn": "test", - "pipeline": [ - { - "$match": { - "_id": { - "$gt": 1 + "expectTracingMessages": [ + { + "client": "client0", + "ignoreExtraSpans": false, + "spans": [ + { + "name": "createView operation-create-view.my_view", + "attributes": { + "db.system": "mongodb", + "db.namespace": "operation-create-view", + "db.collection.name": "my_view", + "db.operation.name": "createView", + "db.operation.summary": "createView operation-create-view.my_view" + }, + "nested": [ + { + "name": "create", + "attributes": { + "db.system": "mongodb", + "db.namespace": "operation-create-view", + "db.collection.name": "my_view", + "db.command.name": "create", + "network.transport": "tcp", + "db.mongodb.cursor_id": { + "$$exists": false + }, + "db.response.status_code": { + "$$exists": false + }, + "exception.message": { + "$$exists": false + }, + "exception.type": { + "$$exists": false + }, + "exception.stacktrace": { + "$$exists": false + }, + "server.address": { + "$$type": "string" + }, + "server.port": { + "$$type": [ + "int", + "long" + ] + }, + "server.type": { + "$$type": "string" + }, + "db.query.summary": "create operation-create-view.my_view", + "db.query.text": { + "$$matchAsDocument": { + "$$matchAsRoot": { + "create": "my_view", + "viewOn": "test", + "pipeline": [ + { + "$match": { + "_id": { + "$gt": 1 + } } } - } - ] + ] + } } + }, + "db.mongodb.server_connection_id": { + "$$type": [ + "int", + "long" + ] + }, + "db.mongodb.driver_connection_id": { + "$$type": [ + "int", + "long" + ] } - }, - "db.mongodb.server_connection_id": { - "$$type": [ - "int", - "long" - ] - }, - "db.mongodb.driver_connection_id": { - "$$type": [ - "int", - "long" - ] } } - } - ] - } - ] - } + ] + } + ] + } + ] } ] } diff --git a/source/open-telemetry/tests/operation/create_view.yml b/source/open-telemetry/tests/operation/create_view.yml index ce0375af42..9cc656cf44 100644 --- a/source/open-telemetry/tests/operation/create_view.yml +++ b/source/open-telemetry/tests/operation/create_view.yml @@ -26,40 +26,40 @@ tests: - { $match: { _id: { $gt: 1 } } } expectTracingMessages: - client: *client0 - ignoreExtraSpans: false - spans: - - name: createView operation-create-view.my_view - attributes: - db.system: mongodb - db.namespace: operation-create-view - db.collection.name: my_view - db.operation.name: createView - db.operation.summary: createView operation-create-view.my_view - nested: - - name: command create - attributes: - db.system: mongodb - db.namespace: operation-create-view - db.collection.name: operation-create-view.$cmd - db.command.name: create - network.transport: tcp - db.mongodb.cursor_id: { $$exists: false } - db.response.status_code: { $$exists: false } - exception.message: { $$exists: false } - exception.type: { $$exists: false } - exception.stacktrace: { $$exists: false } - server.address: { $$type: string } - server.port: { $$type: ['int', 'long'] } - server.type: { $$type: string } - db.query.summary: create - db.query.text: - $$matchAsDocument: - $$matchAsRoot: - create: my_view - viewOn: test - pipeline: *pipeline - db.mongodb.server_connection_id: - $$type: [ 'int', 'long' ] - db.mongodb.driver_connection_id: - $$type: [ 'int', 'long' ] + - client: *client0 + ignoreExtraSpans: false + spans: + - name: createView operation-create-view.my_view + attributes: + db.system: mongodb + db.namespace: operation-create-view + db.collection.name: my_view + db.operation.name: createView + db.operation.summary: createView operation-create-view.my_view + nested: + - name: create + attributes: + db.system: mongodb + db.namespace: operation-create-view + db.collection.name: my_view + db.command.name: create + network.transport: tcp + db.mongodb.cursor_id: { $$exists: false } + db.response.status_code: { $$exists: false } + exception.message: { $$exists: false } + exception.type: { $$exists: false } + exception.stacktrace: { $$exists: false } + server.address: { $$type: string } + server.port: { $$type: ['int', 'long'] } + server.type: { $$type: string } + db.query.summary: create operation-create-view.my_view + db.query.text: + $$matchAsDocument: + $$matchAsRoot: + create: my_view + viewOn: test + pipeline: *pipeline + db.mongodb.server_connection_id: + $$type: [ 'int', 'long' ] + db.mongodb.driver_connection_id: + $$type: [ 'int', 'long' ] diff --git a/source/open-telemetry/tests/operation/delete.json b/source/open-telemetry/tests/operation/delete.json index 888515d0dc..897040d5b1 100644 --- a/source/open-telemetry/tests/operation/delete.json +++ b/source/open-telemetry/tests/operation/delete.json @@ -48,20 +48,21 @@ "ignoreExtraSpans": false, "spans": [ { - "name": "deleteMany operation-delete.test", + "name": "delete operation-delete.test", "attributes": { "db.system": "mongodb", "db.namespace": "operation-delete", "db.collection.name": "test", - "db.operation.name": "deleteMany", - "db.operation.summary": "deleteMany operation-delete.test" + "db.operation.name": "delete", + "db.operation.summary": "delete operation-delete.test" }, "nested": [ { - "name": "delete operation-delete.test", + "name": "delete", "attributes": { "db.system": "mongodb", "db.namespace": "operation-delete", + "db.collection.name": "test", "server.address": { "$$type": "string" }, @@ -71,7 +72,7 @@ "string" ] }, - "db.query.summary": "delete", + "db.query.summary": "delete operation-delete.test", "db.query.text": { "$$matchAsDocument": { "$$matchAsRoot": { diff --git a/source/open-telemetry/tests/operation/delete.yml b/source/open-telemetry/tests/operation/delete.yml index 796787fe24..b931393bd8 100644 --- a/source/open-telemetry/tests/operation/delete.yml +++ b/source/open-telemetry/tests/operation/delete.yml @@ -27,21 +27,22 @@ tests: - client: *client0 ignoreExtraSpans: false spans: - - name: deleteMany operation-delete.test + - name: delete operation-delete.test attributes: db.system: mongodb db.namespace: *databaseName0 db.collection.name: *collectionName0 - db.operation.name: deleteMany - db.operation.summary: deleteMany operation-delete.test + db.operation.name: delete + db.operation.summary: delete operation-delete.test nested: - - name: delete operation-delete.test + - name: delete attributes: db.system: mongodb db.namespace: operation-delete + db.collection.name: test server.address: { $$type: string } server.port: { $$type: [ 'long', 'string' ] } - db.query.summary: delete + db.query.summary: delete operation-delete.test db.query.text: $$matchAsDocument: $$matchAsRoot: diff --git a/source/open-telemetry/tests/operation/distinct.json b/source/open-telemetry/tests/operation/distinct.json index d9d9ea7841..db1e0b3028 100644 --- a/source/open-telemetry/tests/operation/distinct.json +++ b/source/open-telemetry/tests/operation/distinct.json @@ -62,7 +62,7 @@ }, "nested": [ { - "name": "distinct operation-distinct.test", + "name": "distinct", "attributes": { "db.system": "mongodb", "db.namespace": "operation-distinct", @@ -93,7 +93,7 @@ "long" ] }, - "db.query.summary": "distinct", + "db.query.summary": "distinct operation-distinct.test", "db.query.text": { "$$matchAsDocument": { "$$matchAsRoot": { diff --git a/source/open-telemetry/tests/operation/distinct.yml b/source/open-telemetry/tests/operation/distinct.yml index fd493c14bd..0cdaaf1760 100644 --- a/source/open-telemetry/tests/operation/distinct.yml +++ b/source/open-telemetry/tests/operation/distinct.yml @@ -39,7 +39,7 @@ tests: db.operation.name: distinct db.operation.summary: distinct operation-distinct.test nested: - - name: distinct operation-distinct.test + - name: distinct attributes: db.system: mongodb db.namespace: operation-distinct @@ -53,7 +53,7 @@ tests: exception.stacktrace: { $$exists: false } server.address: { $$type: string } server.port: { $$type: ['int', 'long'] } - db.query.summary: distinct + db.query.summary: distinct operation-distinct.test db.query.text: $$matchAsDocument: $$matchAsRoot: diff --git a/source/open-telemetry/tests/operation/drop_collection.json b/source/open-telemetry/tests/operation/drop_collection.json index 2acf785487..0b5d0863f3 100644 --- a/source/open-telemetry/tests/operation/drop_collection.json +++ b/source/open-telemetry/tests/operation/drop_collection.json @@ -54,7 +54,7 @@ }, "nested": [ { - "name": "drop operation-drop-collection.test", + "name": "drop", "attributes": { "db.system": "mongodb", "db.namespace": "operation-drop-collection", @@ -85,7 +85,7 @@ "long" ] }, - "db.query.summary": "drop", + "db.query.summary": "drop operation-drop-collection.test", "db.query.text": { "$$matchAsDocument": { "$$matchAsRoot": { diff --git a/source/open-telemetry/tests/operation/drop_collection.yml b/source/open-telemetry/tests/operation/drop_collection.yml index e254a8f913..1b8ea70809 100644 --- a/source/open-telemetry/tests/operation/drop_collection.yml +++ b/source/open-telemetry/tests/operation/drop_collection.yml @@ -35,7 +35,7 @@ tests: db.operation.name: dropCollection db.operation.summary: dropCollection operation-drop-collection.test nested: - - name: drop operation-drop-collection.test + - name: drop attributes: db.system: mongodb db.namespace: operation-drop-collection @@ -49,7 +49,7 @@ tests: exception.stacktrace: { $$exists: false } server.address: { $$type: string } server.port: { $$type: ['int', 'long'] } - db.query.summary: drop + db.query.summary: drop operation-drop-collection.test db.query.text: $$matchAsDocument: $$matchAsRoot: diff --git a/source/open-telemetry/tests/operation/drop_indexes.json b/source/open-telemetry/tests/operation/drop_indexes.json index 79a1d0cd3a..05f987fef1 100644 --- a/source/open-telemetry/tests/operation/drop_indexes.json +++ b/source/open-telemetry/tests/operation/drop_indexes.json @@ -81,7 +81,7 @@ }, "nested": [ { - "name": "dropIndexes operation-drop-indexes.test", + "name": "dropIndexes", "attributes": { "db.system": "mongodb", "db.namespace": "operation-drop-indexes", @@ -112,7 +112,7 @@ "long" ] }, - "db.query.summary": "dropIndexes", + "db.query.summary": "dropIndexes operation-drop-indexes.test", "db.query.text": { "$$matchAsDocument": { "$$matchAsRoot": { diff --git a/source/open-telemetry/tests/operation/drop_indexes.yml b/source/open-telemetry/tests/operation/drop_indexes.yml index 8dd3f5daef..ab6aa82910 100644 --- a/source/open-telemetry/tests/operation/drop_indexes.yml +++ b/source/open-telemetry/tests/operation/drop_indexes.yml @@ -52,7 +52,7 @@ tests: db.operation.name: dropIndexes db.operation.summary: dropIndexes operation-drop-indexes.test nested: - - name: dropIndexes operation-drop-indexes.test + - name: dropIndexes attributes: db.system: mongodb db.namespace: operation-drop-indexes @@ -66,7 +66,7 @@ tests: exception.stacktrace: { $$exists: false } server.address: { $$type: string } server.port: { $$type: ['int', 'long'] } - db.query.summary: dropIndexes + db.query.summary: dropIndexes operation-drop-indexes.test db.query.text: $$matchAsDocument: $$matchAsRoot: diff --git a/source/open-telemetry/tests/operation/find.json b/source/open-telemetry/tests/operation/find.json index dbee338ae2..5157299beb 100644 --- a/source/open-telemetry/tests/operation/find.json +++ b/source/open-telemetry/tests/operation/find.json @@ -63,11 +63,11 @@ }, "nested": [ { - "name": "find operation-find.test", + "name": "find", "attributes": { "db.system": "mongodb", "db.namespace": "operation-find", - "db.collection.name": "operation-find.$cmd", + "db.collection.name": "test", "db.command.name": "find", "network.transport": "tcp", "db.mongodb.cursor_id": { @@ -97,7 +97,7 @@ "server.type": { "$$type": "string" }, - "db.query.summary": "find", + "db.query.summary": "find operation-find.test", "db.query.text": { "$$matchAsDocument": { "$$matchAsRoot": { diff --git a/source/open-telemetry/tests/operation/find.yml b/source/open-telemetry/tests/operation/find.yml index c92a70fcc2..2d0a943db9 100644 --- a/source/open-telemetry/tests/operation/find.yml +++ b/source/open-telemetry/tests/operation/find.yml @@ -37,11 +37,11 @@ tests: db.operation.name: find db.operation.summary: find operation-find.test nested: - - name: find operation-find.test + - name: find attributes: db.system: mongodb db.namespace: operation-find - db.collection.name: operation-find.$cmd + db.collection.name: test db.command.name: find network.transport: tcp db.mongodb.cursor_id: { $$exists: false } @@ -52,7 +52,7 @@ tests: server.address: { $$type: string } server.port: { $$type: ['int', 'long'] } server.type: { $$type: string } - db.query.summary: find + db.query.summary: find operation-find.test db.query.text: $$matchAsDocument: $$matchAsRoot: diff --git a/source/open-telemetry/tests/operation/find_one_and_update.json b/source/open-telemetry/tests/operation/find_one_and_update.json index 0fcbd1b6c6..d3541ea056 100644 --- a/source/open-telemetry/tests/operation/find_one_and_update.json +++ b/source/open-telemetry/tests/operation/find_one_and_update.json @@ -54,17 +54,17 @@ "ignoreExtraSpans": false, "spans": [ { - "name": "findOneAndUpdate operation-aggregate.test", + "name": "findAndModify operation-aggregate.test", "attributes": { "db.system": "mongodb", "db.namespace": "operation-aggregate", "db.collection.name": "test", - "db.operation.name": "findOneAndUpdate", - "db.operation.summary": "findOneAndUpdate operation-aggregate.test" + "db.operation.name": "findAndModify", + "db.operation.summary": "findAndModify operation-aggregate.test" }, "nested": [ { - "name": "findAndModify operation-aggregate.test", + "name": "findAndModify", "attributes": { "db.system": "mongodb", "db.namespace": "operation-aggregate", @@ -95,7 +95,7 @@ "long" ] }, - "db.query.summary": "findAndModify", + "db.query.summary": "findAndModify operation-aggregate.test", "db.query.text": { "$$matchAsDocument": { "$$matchAsRoot": { diff --git a/source/open-telemetry/tests/operation/find_one_and_update.yml b/source/open-telemetry/tests/operation/find_one_and_update.yml index e956186832..32721492cb 100644 --- a/source/open-telemetry/tests/operation/find_one_and_update.yml +++ b/source/open-telemetry/tests/operation/find_one_and_update.yml @@ -31,15 +31,15 @@ tests: - client: *client0 ignoreExtraSpans: false spans: - - name: findOneAndUpdate operation-aggregate.test + - name: findAndModify operation-aggregate.test attributes: db.system: mongodb db.namespace: operation-aggregate db.collection.name: test - db.operation.name: findOneAndUpdate - db.operation.summary: findOneAndUpdate operation-aggregate.test + db.operation.name: findAndModify + db.operation.summary: findAndModify operation-aggregate.test nested: - - name: findAndModify operation-aggregate.test + - name: findAndModify attributes: db.system: mongodb db.namespace: operation-aggregate @@ -53,7 +53,7 @@ tests: exception.stacktrace: { $$exists: false } server.address: { $$type: string } server.port: { $$type: ['int', 'long'] } - db.query.summary: findAndModify + db.query.summary: findAndModify operation-aggregate.test db.query.text: $$matchAsDocument: $$matchAsRoot: diff --git a/source/open-telemetry/tests/operation/find_retries.json b/source/open-telemetry/tests/operation/find_retries.json index a505ab470d..d79de95657 100644 --- a/source/open-telemetry/tests/operation/find_retries.json +++ b/source/open-telemetry/tests/operation/find_retries.json @@ -69,144 +69,144 @@ } } ], - "expectTracingMessages": { - "client": "client0", - "ignoreExtraSpans": true, - "spans": [ - { - "name": "find operation-find-retries.test", - "attributes": { - "db.system": "mongodb", - "db.namespace": "operation-find-retries", - "db.collection.name": "test", - "db.operation.name": "find", - "db.operation.summary": "find operation-find-retries.test" - }, - "nested": [ - { - "name": "command find", - "attributes": { - "db.system": "mongodb", - "db.namespace": "operation-find-retries", - "db.collection.name": "operation-find-retries.$cmd", - "db.command.name": "find", - "network.transport": "tcp", - "db.mongodb.cursor_id": { - "$$exists": false - }, - "db.response.status_code": { - "$$exists": false - }, - "exception.message": { - "$$type": "string" - }, - "exception.type": { - "$$type": "string" - }, - "exception.stacktrace": { - "$$type": "string" - }, - "server.address": { - "$$type": "string" - }, - "server.port": { - "$$type": [ - "long", - "string" - ] - }, - "server.type": { - "$$type": "string" - }, - "db.query.summary": "find", - "db.query.text": { - "$$matchAsDocument": { - "$$matchAsRoot": { - "find": "test", - "filter": { - "x": 1 + "expectTracingMessages": [ + { + "client": "client0", + "ignoreExtraSpans": true, + "spans": [ + { + "name": "find operation-find-retries.test", + "attributes": { + "db.system": "mongodb", + "db.namespace": "operation-find-retries", + "db.collection.name": "test", + "db.operation.name": "find", + "db.operation.summary": "find operation-find-retries.test" + }, + "nested": [ + { + "name": "find", + "attributes": { + "db.system": "mongodb", + "db.namespace": "operation-find-retries", + "db.collection.name": "test", + "db.command.name": "find", + "network.transport": "tcp", + "db.mongodb.cursor_id": { + "$$exists": false + }, + "db.response.status_code": 89, + "exception.message": { + "$$type": "string" + }, + "exception.type": { + "$$type": "string" + }, + "exception.stacktrace": { + "$$type": "string" + }, + "server.address": { + "$$type": "string" + }, + "server.port": { + "$$type": [ + "long", + "string" + ] + }, + "server.type": { + "$$type": "string" + }, + "db.query.summary": "find operation-find-retries.test", + "db.query.text": { + "$$matchAsDocument": { + "$$matchAsRoot": { + "find": "test", + "filter": { + "x": 1 + } } } + }, + "db.mongodb.server_connection_id": { + "$$type": [ + "int", + "long" + ] + }, + "db.mongodb.driver_connection_id": { + "$$type": [ + "int", + "long" + ] } - }, - "db.mongodb.server_connection_id": { - "$$type": [ - "int", - "long" - ] - }, - "db.mongodb.driver_connection_id": { - "$$type": [ - "int", - "long" - ] } - } - }, - { - "name": "command find", - "attributes": { - "db.system": "mongodb", - "db.namespace": "operation-find-retries", - "db.collection.name": "operation-find-retries.$cmd", - "db.command.name": "find", - "network.transport": "tcp", - "db.mongodb.cursor_id": { - "$$exists": false - }, - "db.response.status_code": { - "$$exists": false - }, - "exception.message": { - "$$exists": false - }, - "exception.type": { - "$$exists": false - }, - "exception.stacktrace": { - "$$exists": false - }, - "server.address": { - "$$type": "string" - }, - "server.port": { - "$$type": [ - "int", - "long" - ] - }, - "server.type": { - "$$type": "string" - }, - "db.query.summary": "find", - "db.query.text": { - "$$matchAsDocument": { - "$$matchAsRoot": { - "find": "test", - "filter": { - "x": 1 + }, + { + "name": "find", + "attributes": { + "db.system": "mongodb", + "db.namespace": "operation-find-retries", + "db.collection.name": "test", + "db.command.name": "find", + "network.transport": "tcp", + "db.mongodb.cursor_id": { + "$$exists": false + }, + "db.response.status_code": { + "$$exists": false + }, + "exception.message": { + "$$exists": false + }, + "exception.type": { + "$$exists": false + }, + "exception.stacktrace": { + "$$exists": false + }, + "server.address": { + "$$type": "string" + }, + "server.port": { + "$$type": [ + "int", + "long" + ] + }, + "server.type": { + "$$type": "string" + }, + "db.query.summary": "find operation-find-retries.test", + "db.query.text": { + "$$matchAsDocument": { + "$$matchAsRoot": { + "find": "test", + "filter": { + "x": 1 + } } } + }, + "db.mongodb.server_connection_id": { + "$$type": [ + "int", + "long" + ] + }, + "db.mongodb.driver_connection_id": { + "$$type": [ + "int", + "long" + ] } - }, - "db.mongodb.server_connection_id": { - "$$type": [ - "int", - "long" - ] - }, - "db.mongodb.driver_connection_id": { - "$$type": [ - "int", - "long" - ] } } - } - ] - } - ] - } + ] + } + ] + } + ] } ] } diff --git a/source/open-telemetry/tests/operation/find_retries.yml b/source/open-telemetry/tests/operation/find_retries.yml index d613c4a21e..3e9deb9d0b 100644 --- a/source/open-telemetry/tests/operation/find_retries.yml +++ b/source/open-telemetry/tests/operation/find_retries.yml @@ -38,66 +38,66 @@ tests: arguments: filter: { x: 1 } expectTracingMessages: - client: *client0 - ignoreExtraSpans: true - spans: - - name: find operation-find-retries.test - attributes: - db.system: mongodb - db.namespace: operation-find-retries - db.collection.name: test - db.operation.name: find - db.operation.summary: find operation-find-retries.test - nested: - - name: command find - attributes: - db.system: mongodb - db.namespace: operation-find-retries - db.collection.name: operation-find-retries.$cmd - db.command.name: find - network.transport: tcp - db.mongodb.cursor_id: { $$exists: false } - db.response.status_code: { $$exists: false } - exception.message: { $$type: string } - exception.type: { $$type: string } - exception.stacktrace: { $$type: string } - server.address: { $$type: string } - server.port: { $$type: ['long', 'string'] } - server.type: { $$type: string } - db.query.summary: find - db.query.text: - $$matchAsDocument: - $$matchAsRoot: - find: test - filter: - x: 1 - db.mongodb.server_connection_id: - $$type: [ 'int', 'long' ] - db.mongodb.driver_connection_id: - $$type: [ 'int', 'long' ] - - name: command find - attributes: - db.system: mongodb - db.namespace: operation-find-retries - db.collection.name: operation-find-retries.$cmd - db.command.name: find - network.transport: tcp - db.mongodb.cursor_id: { $$exists: false } - db.response.status_code: { $$exists: false } - exception.message: { $$exists: false } - exception.type: { $$exists: false } - exception.stacktrace: { $$exists: false } - server.address: { $$type: string } - server.port: { $$type: ['int', 'long'] } - server.type: { $$type: string } - db.query.summary: find - db.query.text: - $$matchAsDocument: - $$matchAsRoot: - find: test - filter: - x: 1 - db.mongodb.server_connection_id: - $$type: [ 'int', 'long' ] - db.mongodb.driver_connection_id: - $$type: [ 'int', 'long' ] + - client: *client0 + ignoreExtraSpans: true + spans: + - name: find operation-find-retries.test + attributes: + db.system: mongodb + db.namespace: operation-find-retries + db.collection.name: test + db.operation.name: find + db.operation.summary: find operation-find-retries.test + nested: + - name: find + attributes: + db.system: mongodb + db.namespace: operation-find-retries + db.collection.name: test + db.command.name: find + network.transport: tcp + db.mongodb.cursor_id: { $$exists: false } + db.response.status_code: 89 + exception.message: { $$type: string } + exception.type: { $$type: string } + exception.stacktrace: { $$type: string } + server.address: { $$type: string } + server.port: { $$type: ['long', 'string'] } + server.type: { $$type: string } + db.query.summary: find operation-find-retries.test + db.query.text: + $$matchAsDocument: + $$matchAsRoot: + find: test + filter: + x: 1 + db.mongodb.server_connection_id: + $$type: [ 'int', 'long' ] + db.mongodb.driver_connection_id: + $$type: [ 'int', 'long' ] + - name: find + attributes: + db.system: mongodb + db.namespace: operation-find-retries + db.collection.name: test + db.command.name: find + network.transport: tcp + db.mongodb.cursor_id: { $$exists: false } + db.response.status_code: { $$exists: false } + exception.message: { $$exists: false } + exception.type: { $$exists: false } + exception.stacktrace: { $$exists: false } + server.address: { $$type: string } + server.port: { $$type: ['int', 'long'] } + server.type: { $$type: string } + db.query.summary: find operation-find-retries.test + db.query.text: + $$matchAsDocument: + $$matchAsRoot: + find: test + filter: + x: 1 + db.mongodb.server_connection_id: + $$type: [ 'int', 'long' ] + db.mongodb.driver_connection_id: + $$type: [ 'int', 'long' ] diff --git a/source/open-telemetry/tests/operation/insert.json b/source/open-telemetry/tests/operation/insert.json index b617e6ceee..8db179146a 100644 --- a/source/open-telemetry/tests/operation/insert.json +++ b/source/open-telemetry/tests/operation/insert.json @@ -47,58 +47,60 @@ } } ], - "expectTracingMessages": { - "client": "client0", - "ignoreExtraSpans": false, - "spans": [ - { - "name": "insert operation-insert.test", - "attributes": { - "db.system": "mongodb", - "db.namespace": "operation-insert", - "db.collection.name": "test", - "db.operation.name": "insert", - "db.operation.summary": "insert operation-insert.test" - }, - "nested": [ - { - "name": "command insert", - "attributes": { - "db.system": "mongodb", - "db.namespace": "operation-insert", - "server.address": { - "$$type": "string" - }, - "server.port": { - "$$type": [ - "long", - "string" - ] - }, - "server.type": { - "$$type": "string" - }, - "db.query.summary": "insert", - "db.query.text": { - "$$matchAsDocument": { - "$$matchAsRoot": { - "insert": "test", - "ordered": true, - "txnNumber": 1, - "documents": [ - { - "_id": 1 - } - ] + "expectTracingMessages": [ + { + "client": "client0", + "ignoreExtraSpans": false, + "spans": [ + { + "name": "insert operation-insert.test", + "attributes": { + "db.system": "mongodb", + "db.namespace": "operation-insert", + "db.collection.name": "test", + "db.operation.name": "insert", + "db.operation.summary": "insert operation-insert.test" + }, + "nested": [ + { + "name": "insert", + "attributes": { + "db.system": "mongodb", + "db.namespace": "operation-insert", + "server.address": { + "$$type": "string" + }, + "server.port": { + "$$type": [ + "long", + "string" + ] + }, + "server.type": { + "$$type": "string" + }, + "db.query.summary": "insert operation-insert.test", + "db.query.text": { + "$$matchAsDocument": { + "$$matchAsRoot": { + "insert": "test", + "ordered": true, + "txnNumber": 1, + "documents": [ + { + "_id": 1 + } + ] + } } } } } - } - ] - } - ] - }, + ] + } + ] + } + ], "outcome": [ { "collectionName": "test", diff --git a/source/open-telemetry/tests/operation/insert.yml b/source/open-telemetry/tests/operation/insert.yml index 90930222da..7e220426e8 100644 --- a/source/open-telemetry/tests/operation/insert.yml +++ b/source/open-telemetry/tests/operation/insert.yml @@ -26,33 +26,33 @@ tests: arguments: { document: { _id: 1 } } expectTracingMessages: - client: *client0 - ignoreExtraSpans: false - spans: - - name: insert operation-insert.test - attributes: - db.system: mongodb - db.namespace: operation-insert - db.collection.name: test - db.operation.name: insert - db.operation.summary: insert operation-insert.test - nested: - - name: command insert - attributes: - db.system: mongodb - db.namespace: operation-insert - server.address: { $$type: string } - server.port: { $$type: [ 'long', 'string' ] } - server.type: { $$type: string } - db.query.summary: insert - db.query.text: - $$matchAsDocument: - $$matchAsRoot: - insert: test - ordered: true - txnNumber: 1 - documents: - - _id: 1 + - client: *client0 + ignoreExtraSpans: false + spans: + - name: insert operation-insert.test + attributes: + db.system: mongodb + db.namespace: operation-insert + db.collection.name: test + db.operation.name: insert + db.operation.summary: insert operation-insert.test + nested: + - name: insert + attributes: + db.system: mongodb + db.namespace: operation-insert + server.address: { $$type: string } + server.port: { $$type: [ 'long', 'string' ] } + server.type: { $$type: string } + db.query.summary: insert operation-insert.test + db.query.text: + $$matchAsDocument: + $$matchAsRoot: + insert: test + ordered: true + txnNumber: 1 + documents: + - _id: 1 outcome: - collectionName: test diff --git a/source/open-telemetry/tests/operation/list_collections.json b/source/open-telemetry/tests/operation/list_collections.json index 62eb1bee48..1b88bcb659 100644 --- a/source/open-telemetry/tests/operation/list_collections.json +++ b/source/open-telemetry/tests/operation/list_collections.json @@ -36,64 +36,64 @@ { "name": "listCollections operation-list-collections", "attributes": { - "db.system": "mongodb" + "db.system": "mongodb", + "db.namespace": "operation-list-collections", + "db.operation.name": "listCollections", + "db.operation.summary": "listCollections operation-list-collections" }, - "db.namespace": "operation-list-collections", - "db.operation.name": "listCollections", - "db.operation.summary": "listCollections operation-list-collections", "nested": [ { - "name": "listCollections operation-list-collections", + "name": "listCollections", "attributes": { - "db.system": "mongodb" - }, - "db.namespace": "operation-list-collections", - "db.command.name": "listCollections", - "network.transport": "tcp", - "db.mongodb.cursor_id": { - "$$exists": false - }, - "db.response.status_code": { - "$$exists": false - }, - "exception.message": { - "$$exists": false - }, - "exception.type": { - "$$exists": false - }, - "exception.stacktrace": { - "$$exists": false - }, - "server.address": { - "$$type": "string" - }, - "server.port": { - "$$type": [ - "int", - "long" - ] - }, - "db.query.summary": "listCollections", - "db.query.text": { - "$$matchAsDocument": { - "$$matchAsRoot": { - "listCollections": 1, - "cursor": {} + "db.system": "mongodb", + "db.namespace": "operation-list-collections", + "db.command.name": "listCollections", + "network.transport": "tcp", + "db.mongodb.cursor_id": { + "$$exists": false + }, + "db.response.status_code": { + "$$exists": false + }, + "exception.message": { + "$$exists": false + }, + "exception.type": { + "$$exists": false + }, + "exception.stacktrace": { + "$$exists": false + }, + "server.address": { + "$$type": "string" + }, + "server.port": { + "$$type": [ + "int", + "long" + ] + }, + "db.query.summary": "listCollections operation-list-collections", + "db.query.text": { + "$$matchAsDocument": { + "$$matchAsRoot": { + "listCollections": 1, + "cursor": {} + } } + }, + "db.mongodb.server_connection_id": { + "$$type": [ + "int", + "long" + ] + }, + "db.mongodb.driver_connection_id": { + "$$type": [ + "int", + "long" + ] } - }, - "db.mongodb.server_connection_id": { - "$$type": [ - "int", - "long" - ] - }, - "db.mongodb.driver_connection_id": { - "$$type": [ - "int", - "long" - ] } } ] diff --git a/source/open-telemetry/tests/operation/list_collections.yml b/source/open-telemetry/tests/operation/list_collections.yml index 7f258af51c..1796722277 100644 --- a/source/open-telemetry/tests/operation/list_collections.yml +++ b/source/open-telemetry/tests/operation/list_collections.yml @@ -23,30 +23,30 @@ tests: - name: listCollections operation-list-collections attributes: db.system: mongodb - db.namespace: operation-list-collections - db.operation.name: listCollections - db.operation.summary: listCollections operation-list-collections + db.namespace: operation-list-collections + db.operation.name: listCollections + db.operation.summary: listCollections operation-list-collections nested: - - name: listCollections operation-list-collections + - name: listCollections attributes: db.system: mongodb - db.namespace: operation-list-collections - db.command.name: listCollections - network.transport: tcp - db.mongodb.cursor_id: { $$exists: false } - db.response.status_code: { $$exists: false } - exception.message: { $$exists: false } - exception.type: { $$exists: false } - exception.stacktrace: { $$exists: false } - server.address: { $$type: string } - server.port: { $$type: ['int', 'long'] } - db.query.summary: listCollections - db.query.text: - $$matchAsDocument: - $$matchAsRoot: - listCollections: 1 - cursor: {} - db.mongodb.server_connection_id: - $$type: [ 'int', 'long' ] - db.mongodb.driver_connection_id: - $$type: [ 'int', 'long' ] + db.namespace: operation-list-collections + db.command.name: listCollections + network.transport: tcp + db.mongodb.cursor_id: { $$exists: false } + db.response.status_code: { $$exists: false } + exception.message: { $$exists: false } + exception.type: { $$exists: false } + exception.stacktrace: { $$exists: false } + server.address: { $$type: string } + server.port: { $$type: ['int', 'long'] } + db.query.summary: listCollections operation-list-collections + db.query.text: + $$matchAsDocument: + $$matchAsRoot: + listCollections: 1 + cursor: {} + db.mongodb.server_connection_id: + $$type: [ 'int', 'long' ] + db.mongodb.driver_connection_id: + $$type: [ 'int', 'long' ] diff --git a/source/open-telemetry/tests/operation/list_databases.json b/source/open-telemetry/tests/operation/list_databases.json index ab333cd47c..12ad82a559 100644 --- a/source/open-telemetry/tests/operation/list_databases.json +++ b/source/open-telemetry/tests/operation/list_databases.json @@ -27,19 +27,22 @@ "ignoreExtraSpans": false, "spans": [ { - "name": "listDatabases", + "name": "listDatabases admin", "attributes": { - "db.system": "mongodb" + "db.system": "mongodb", + "db.namespace": "admin", + "db.operation.name": "listDatabases", + "db.operation.summary": "listDatabases admin" }, - "db.namespace": "admin", - "db.operation.name": "listDatabases", - "db.operation.summary": "listDatabases admin", "nested": [ { - "name": "listDatabases admin", + "name": "listDatabases", "attributes": { "db.system": "mongodb", "db.namespace": "admin", + "db.collection.name": { + "$$exists": false + }, "db.command.name": "listDatabases", "network.transport": "tcp", "db.mongodb.cursor_id": { @@ -66,7 +69,7 @@ "long" ] }, - "db.query.summary": "listDatabases", + "db.query.summary": "listDatabases admin", "db.query.text": { "$$matchAsDocument": { "$$matchAsRoot": { diff --git a/source/open-telemetry/tests/operation/list_databases.yml b/source/open-telemetry/tests/operation/list_databases.yml index 3a54f0b7c2..f453b86052 100644 --- a/source/open-telemetry/tests/operation/list_databases.yml +++ b/source/open-telemetry/tests/operation/list_databases.yml @@ -16,17 +16,18 @@ tests: - client: *client0 ignoreExtraSpans: false spans: - - name: listDatabases + - name: listDatabases admin attributes: db.system: mongodb - db.namespace: admin - db.operation.name: listDatabases - db.operation.summary: listDatabases admin + db.namespace: admin + db.operation.name: listDatabases + db.operation.summary: listDatabases admin nested: - - name: listDatabases admin + - name: listDatabases attributes: db.system: mongodb db.namespace: admin + db.collection.name: { $$exists: false } db.command.name: listDatabases network.transport: tcp db.mongodb.cursor_id: { $$exists: false } @@ -36,7 +37,7 @@ tests: exception.stacktrace: { $$exists: false } server.address: { $$type: string } server.port: { $$type: ['int', 'long'] } - db.query.summary: listDatabases + db.query.summary: listDatabases admin db.query.text: $$matchAsDocument: $$matchAsRoot: diff --git a/source/open-telemetry/tests/operation/list_indexes.json b/source/open-telemetry/tests/operation/list_indexes.json index 223b506dea..4860ab8995 100644 --- a/source/open-telemetry/tests/operation/list_indexes.json +++ b/source/open-telemetry/tests/operation/list_indexes.json @@ -58,7 +58,7 @@ "db.operation.summary": "listIndexes operation-list-indexes.test", "nested": [ { - "name": "listIndexes operation-list-indexes.test", + "name": "listIndexes", "attributes": { "db.system": "mongodb" }, @@ -90,7 +90,7 @@ "long" ] }, - "db.query.summary": "listIndexes", + "db.query.summary": "listIndexes operation-list-indexes.test", "db.query.text": { "$$matchAsDocument": { "$$matchAsRoot": { diff --git a/source/open-telemetry/tests/operation/list_indexes.yml b/source/open-telemetry/tests/operation/list_indexes.yml index f72c199113..c80f195c76 100644 --- a/source/open-telemetry/tests/operation/list_indexes.yml +++ b/source/open-telemetry/tests/operation/list_indexes.yml @@ -36,7 +36,7 @@ tests: db.operation.name: listIndexes db.operation.summary: listIndexes operation-list-indexes.test nested: - - name: listIndexes operation-list-indexes.test + - name: listIndexes attributes: db.system: mongodb db.namespace: operation-list-indexes @@ -50,7 +50,7 @@ tests: exception.stacktrace: { $$exists: false } server.address: { $$type: string } server.port: { $$type: ['int', 'long'] } - db.query.summary: listIndexes + db.query.summary: listIndexes operation-list-indexes.test db.query.text: $$matchAsDocument: $$matchAsRoot: diff --git a/source/open-telemetry/tests/operation/map_reduce.json b/source/open-telemetry/tests/operation/map_reduce.json index df29f86396..c9c84432c0 100644 --- a/source/open-telemetry/tests/operation/map_reduce.json +++ b/source/open-telemetry/tests/operation/map_reduce.json @@ -105,11 +105,11 @@ }, "nested": [ { - "name": "command mapReduce", + "name": "mapReduce", "attributes": { "db.system": "mongodb", "db.namespace": "operation-map-reduce", - "db.collection.name": "operation-map-reduce.$cmd", + "db.collection.name": "test", "db.command.name": "mapReduce", "network.transport": "tcp", "db.mongodb.cursor_id": { @@ -139,7 +139,7 @@ "server.type": { "$$type": "string" }, - "db.query.summary": "mapReduce", + "db.query.summary": "mapReduce operation-map-reduce.test", "db.query.text": { "$$matchAsDocument": { "$$matchAsRoot": { diff --git a/source/open-telemetry/tests/operation/map_reduce.yml b/source/open-telemetry/tests/operation/map_reduce.yml index 2c16dde0f5..99168cea8a 100644 --- a/source/open-telemetry/tests/operation/map_reduce.yml +++ b/source/open-telemetry/tests/operation/map_reduce.yml @@ -70,11 +70,11 @@ tests: db.operation.name: mapReduce db.operation.summary: mapReduce operation-map-reduce.test nested: - - name: command mapReduce + - name: mapReduce attributes: db.system: mongodb db.namespace: operation-map-reduce - db.collection.name: operation-map-reduce.$cmd + db.collection.name: test db.command.name: mapReduce network.transport: tcp db.mongodb.cursor_id: { $$exists: false } @@ -85,7 +85,7 @@ tests: server.address: { $$type: string } server.port: { $$type: [ 'int', 'long' ] } server.type: { $$type: string } - db.query.summary: mapReduce + db.query.summary: mapReduce operation-map-reduce.test db.query.text: $$matchAsDocument: $$matchAsRoot: diff --git a/source/open-telemetry/tests/operation/retries.json b/source/open-telemetry/tests/operation/retries.json index 0359c50ca6..2cd93eaf14 100644 --- a/source/open-telemetry/tests/operation/retries.json +++ b/source/open-telemetry/tests/operation/retries.json @@ -91,7 +91,7 @@ }, "nested": [ { - "name": "find operation-find-retries.test", + "name": "find", "attributes": { "db.system": "mongodb", "db.namespace": "operation-find-retries", @@ -101,20 +101,15 @@ "db.mongodb.cursor_id": { "$$exists": false }, - "db.response.status_code": { - "$$exists": true - }, - "error.type": { - "$$exists": true - }, + "db.response.status_code": 89, "exception.message": { - "$$exists": false + "$$exists": true }, "exception.type": { - "$$exists": false + "$$exists": true }, "exception.stacktrace": { - "$$exists": false + "$$exists": true }, "server.address": { "$$type": "string" @@ -125,7 +120,7 @@ "string" ] }, - "db.query.summary": "find", + "db.query.summary": "find operation-find-retries.test", "db.query.text": { "$$matchAsDocument": { "$$matchAsRoot": { @@ -151,7 +146,7 @@ } }, { - "name": "find operation-find-retries.test", + "name": "find", "attributes": { "db.system": "mongodb", "db.namespace": "operation-find-retries", @@ -164,9 +159,6 @@ "db.response.status_code": { "$$exists": false }, - "error.type": { - "$$exists": false - }, "exception.message": { "$$exists": false }, @@ -185,7 +177,7 @@ "long" ] }, - "db.query.summary": "find", + "db.query.summary": "find operation-find-retries.test", "db.query.text": { "$$matchAsDocument": { "$$matchAsRoot": { diff --git a/source/open-telemetry/tests/operation/retries.yml b/source/open-telemetry/tests/operation/retries.yml index 3e6510e4f0..12c2b69820 100644 --- a/source/open-telemetry/tests/operation/retries.yml +++ b/source/open-telemetry/tests/operation/retries.yml @@ -40,6 +40,7 @@ tests: object: *collection0 arguments: filter: { x: 1 } + expectTracingMessages: - client: *client0 ignoreExtraSpans: true @@ -52,7 +53,7 @@ tests: db.operation.name: find db.operation.summary: find operation-find-retries.test nested: - - name: find operation-find-retries.test + - name: find attributes: db.system: mongodb db.namespace: *database0Name @@ -60,14 +61,13 @@ tests: db.command.name: find network.transport: tcp db.mongodb.cursor_id: { $$exists: false } - db.response.status_code: { $$exists: true } - error.type: { $$exists: true } - exception.message: { $$exists: false } - exception.type: { $$exists: false } - exception.stacktrace: { $$exists: false } + db.response.status_code: 89 + exception.message: { $$exists: true } + exception.type: { $$exists: true } + exception.stacktrace: { $$exists: true } server.address: { $$type: string } server.port: { $$type: ['long', 'string'] } - db.query.summary: find + db.query.summary: find operation-find-retries.test db.query.text: $$matchAsDocument: $$matchAsRoot: @@ -78,7 +78,7 @@ tests: $$type: [ 'int', 'long' ] db.mongodb.driver_connection_id: $$type: [ 'int', 'long' ] - - name: find operation-find-retries.test + - name: find attributes: db.system: mongodb db.namespace: *database0Name @@ -87,13 +87,12 @@ tests: network.transport: tcp db.mongodb.cursor_id: { $$exists: false } db.response.status_code: { $$exists: false } - error.type: { $$exists: false } exception.message: { $$exists: false } exception.type: { $$exists: false } exception.stacktrace: { $$exists: false } server.address: { $$type: string } server.port: { $$type: ['int', 'long'] } - db.query.summary: find + db.query.summary: find operation-find-retries.test db.query.text: $$matchAsDocument: $$matchAsRoot: diff --git a/source/open-telemetry/tests/operation/update.json b/source/open-telemetry/tests/operation/update.json index 2bf497d46e..f512c47ae9 100644 --- a/source/open-telemetry/tests/operation/update.json +++ b/source/open-telemetry/tests/operation/update.json @@ -61,7 +61,7 @@ }, "nested": [ { - "name": "update operation-update.test", + "name": "update", "attributes": { "db.system": "mongodb", "db.namespace": "operation-update", @@ -74,7 +74,7 @@ "string" ] }, - "db.query.summary": "update", + "db.query.summary": "update operation-update.test", "db.query.text": { "$$matchAsDocument": { "$$matchAsRoot": { diff --git a/source/open-telemetry/tests/operation/update.yml b/source/open-telemetry/tests/operation/update.yml index fac8720a63..0a7a33295d 100644 --- a/source/open-telemetry/tests/operation/update.yml +++ b/source/open-telemetry/tests/operation/update.yml @@ -37,13 +37,13 @@ tests: db.operation.name: update db.operation.summary: update operation-update.test nested: - - name: update operation-update.test + - name: update attributes: db.system: mongodb db.namespace: operation-update server.address: { $$type: string } server.port: { $$type: [ 'long', 'string' ] } - db.query.summary: update + db.query.summary: update operation-update.test db.query.text: $$matchAsDocument: $$matchAsRoot: diff --git a/source/open-telemetry/tests/transaction/transaction.json b/source/open-telemetry/tests/transaction/transaction.json index 836bf8403f..db66ae263f 100644 --- a/source/open-telemetry/tests/transaction/transaction.json +++ b/source/open-telemetry/tests/transaction/transaction.json @@ -100,104 +100,124 @@ { "name": "insert transaction-tests.test", "attributes": { - "db.system": "mongodb" + "db.system": "mongodb", + "db.namespace": "transaction-tests", + "db.collection.name": "test", + "db.operation.name": "insert", + "db.operation.summary": "insert transaction-tests.test" }, - "db.namespace": "transaction-tests", - "db.collection.name": "test", - "db.operation.name": "insert", - "db.operation.summary": "insert transaction-tests.test", "nested": [ { - "name": "command insert", + "name": "insert", "attributes": { - "db.system": "mongodb" - }, - "db.namespace": "transaction-tests", - "server.address": { - "$$type": "string" - }, - "server.port": { - "$$type": [ - "long", - "string" - ] - }, - "server.type": { - "$$type": "string" - }, - "db.query.summary": "insert", - "db.query.text": { - "$$matchAsDocument": { - "$$matchAsRoot": { - "insert": "test", - "ordered": true, - "txnNumber": 1, - "startTransaction": true, - "autocommit": false, - "documents": [ - { - "_id": 1 - } - ] + "db.system": "mongodb", + "db.namespace": "transaction-tests", + "db.collection.name": "test", + "server.address": { + "$$type": "string" + }, + "server.port": { + "$$type": [ + "long", + "string" + ] + }, + "server.type": { + "$$type": "string" + }, + "db.query.summary": "insert transaction-tests.test", + "db.query.text": { + "$$matchAsDocument": { + "$$matchAsRoot": { + "insert": "test", + "ordered": true, + "txnNumber": 1, + "startTransaction": true, + "autocommit": false, + "documents": [ + { + "_id": 1 + } + ] + } } + }, + "db.mongodb.lsid": { + "$$sessionLsid": "session0" } - }, - "db.mongodb.lsid": { - "$$sessionLsid": "session0" } } ] }, { - "name": "commitTransaction admin.$cmd", + "name": "commitTransaction admin", "attributes": { "db.system": "mongodb", - "nested": [ - { - "name": "command commitTransaction", - "attributes": { - "db.system": "mongodb", - "db.query.text": { - "$$matchAsDocument": { - "$$matchAsRoot": { - "commitTransaction": 1, - "txnNumber": 1, - "autocommit": false - } + "db.namespace": "admin", + "db.collection.name": { + "$$exists": false + }, + "db.operation.name": "commitTransaction" + }, + "nested": [ + { + "name": "commitTransaction", + "attributes": { + "db.system": "mongodb", + "db.namespace": "admin", + "db.collection.name": { + "$$exists": false + }, + "db.query.summary": "commitTransaction admin", + "db.command.name": "commitTransaction", + "db.query.text": { + "$$matchAsDocument": { + "$$matchAsRoot": { + "commitTransaction": 1, + "txnNumber": 1, + "autocommit": false } } } } - ] - } + } + ] } ] - } - ] - }, - { - "name": "find transaction-tests.test", - "attributes": {}, - "nested": [ + }, { - "name": "command find", + "name": "find transaction-tests.test", "attributes": { "db.system": "mongodb", "db.namespace": "transaction-tests", - "server.address": { - "$$type": "string" - }, - "server.port": { - "$$type": [ - "long", - "string" - ] - }, - "server.type": { - "$$type": "string" - }, - "db.query.summary": "find" - } + "db.collection.name": "test", + "db.operation.summary": "find transaction-tests.test", + "db.operation.name": "find" + }, + "nested": [ + { + "name": "find", + "attributes": { + "db.system": "mongodb", + "db.namespace": "transaction-tests", + "db.collection.name": "test", + "db.command.name": "find", + "server.address": { + "$$type": "string" + }, + "server.port": { + "$$type": [ + "long", + "string" + ] + }, + "server.type": { + "$$type": "string" + }, + "db.query.summary": "find transaction-tests.test" + } + } + ] } ] } diff --git a/source/open-telemetry/tests/transaction/transaction.yml b/source/open-telemetry/tests/transaction/transaction.yml index cff5448737..d2791d4e47 100644 --- a/source/open-telemetry/tests/transaction/transaction.yml +++ b/source/open-telemetry/tests/transaction/transaction.yml @@ -57,54 +57,69 @@ tests: - name: insert transaction-tests.test attributes: db.system: mongodb - db.namespace: transaction-tests - db.collection.name: test - db.operation.name: insert - db.operation.summary: insert transaction-tests.test + db.namespace: transaction-tests + db.collection.name: test + db.operation.name: insert + db.operation.summary: insert transaction-tests.test nested: - - name: command insert + - name: insert attributes: db.system: mongodb - db.namespace: transaction-tests - server.address: { $$type: string } - server.port: { $$type: ['long', 'string'] } - server.type: { $$type: string } - db.query.summary: insert - db.query.text: - $$matchAsDocument: - $$matchAsRoot: - insert: test - ordered: true - txnNumber: 1 - startTransaction: true - autocommit: false - documents: - - _id: 1 - db.mongodb.lsid: { $$sessionLsid: *session0 } - - name: commitTransaction admin.$cmd + db.namespace: transaction-tests + db.collection.name: test + server.address: { $$type: string } + server.port: { $$type: ['long', 'string'] } + server.type: { $$type: string } + db.query.summary: insert transaction-tests.test + db.query.text: + $$matchAsDocument: + $$matchAsRoot: + insert: test + ordered: true + txnNumber: 1 + startTransaction: true + autocommit: false + documents: + - _id: 1 + db.mongodb.lsid: { $$sessionLsid: *session0 } + - name: commitTransaction admin attributes: db.system: mongodb - nested: - - name: command commitTransaction - attributes: - db.system: mongodb - db.query.text: - $$matchAsDocument: - $$matchAsRoot: - commitTransaction: 1 - txnNumber: 1 - autocommit: false - - name: find transaction-tests.test - attributes: {} - nested: - - name: command find + db.namespace: admin + db.collection.name: { $$exists: false } + db.operation.name: commitTransaction + nested: + - name: commitTransaction + attributes: + db.system: mongodb + db.namespace: admin + db.collection.name: { $$exists: false } + db.query.summary: commitTransaction admin + db.command.name: commitTransaction + db.query.text: + $$matchAsDocument: + $$matchAsRoot: + commitTransaction: 1 + txnNumber: 1 + autocommit: false + - name: find transaction-tests.test attributes: db.system: mongodb db.namespace: transaction-tests - server.address: { $$type: string } - server.port: { $$type: ['long', 'string'] } - server.type: { $$type: string } - db.query.summary: find + db.collection.name: test + db.operation.summary: find transaction-tests.test + db.operation.name: find + nested: + - name: find + attributes: + db.system: mongodb + db.namespace: transaction-tests + db.collection.name: test + db.command.name: find + server.address: { $$type: string } + server.port: { $$type: ['long', 'string'] } + server.type: { $$type: string } + db.query.summary: find transaction-tests.test outcome: - collectionName: test databaseName: transaction-tests From 0edc807bf1046664b83c9a7d718fe6927032a9f3 Mon Sep 17 00:00:00 2001 From: Nabil Hachicha Date: Tue, 9 Sep 2025 10:55:31 +0100 Subject: [PATCH 40/62] Fixing typo in test file --- source/open-telemetry/tests/operation/count.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/source/open-telemetry/tests/operation/count.yml b/source/open-telemetry/tests/operation/count.yml index 59b8a57ef6..d9e4956987 100644 --- a/source/open-telemetry/tests/operation/count.yml +++ b/source/open-telemetry/tests/operation/count.yml @@ -36,8 +36,7 @@ tests: db.namespace: *database0Name db.collection.name: *collection0Name db.operation.name: count - db.operation.summary: count - |||||operation-count.test + db.operation.summary: count operation-count.test nested: - name: count attributes: From 3822dafce83e2b4a11091ca93b0e961e69967572 Mon Sep 17 00:00:00 2001 From: Nabil Hachicha Date: Tue, 9 Sep 2025 11:15:53 +0100 Subject: [PATCH 41/62] Fixing test --- .../tests/operation/list_indexes.json | 104 +++++++++--------- .../tests/operation/list_indexes.yml | 48 ++++---- 2 files changed, 76 insertions(+), 76 deletions(-) diff --git a/source/open-telemetry/tests/operation/list_indexes.json b/source/open-telemetry/tests/operation/list_indexes.json index 4860ab8995..487f630c1c 100644 --- a/source/open-telemetry/tests/operation/list_indexes.json +++ b/source/open-telemetry/tests/operation/list_indexes.json @@ -50,65 +50,65 @@ { "name": "listIndexes operation-list-indexes.test", "attributes": { - "db.system": "mongodb" + "db.system": "mongodb", + "db.namespace": "operation-list-indexes", + "db.collection.name": "test", + "db.operation.name": "listIndexes", + "db.operation.summary": "listIndexes operation-list-indexes.test" }, - "db.namespace": "operation-list-indexes", - "db.collection.name": "test", - "db.operation.name": "listIndexes", - "db.operation.summary": "listIndexes operation-list-indexes.test", "nested": [ { "name": "listIndexes", "attributes": { - "db.system": "mongodb" - }, - "db.namespace": "operation-list-indexes", - "db.collection.name": "test", - "db.command.name": "listIndexes", - "network.transport": "tcp", - "db.mongodb.cursor_id": { - "$$exists": false - }, - "db.response.status_code": { - "$$exists": false - }, - "exception.message": { - "$$exists": false - }, - "exception.type": { - "$$exists": false - }, - "exception.stacktrace": { - "$$exists": false - }, - "server.address": { - "$$type": "string" - }, - "server.port": { - "$$type": [ - "int", - "long" - ] - }, - "db.query.summary": "listIndexes operation-list-indexes.test", - "db.query.text": { - "$$matchAsDocument": { - "$$matchAsRoot": { - "listIndexes": "test" + "db.system": "mongodb", + "db.namespace": "operation-list-indexes", + "db.collection.name": "test", + "db.command.name": "listIndexes", + "network.transport": "tcp", + "db.mongodb.cursor_id": { + "$$exists": false + }, + "db.response.status_code": { + "$$exists": false + }, + "exception.message": { + "$$exists": false + }, + "exception.type": { + "$$exists": false + }, + "exception.stacktrace": { + "$$exists": false + }, + "server.address": { + "$$type": "string" + }, + "server.port": { + "$$type": [ + "int", + "long" + ] + }, + "db.query.summary": "listIndexes operation-list-indexes.test", + "db.query.text": { + "$$matchAsDocument": { + "$$matchAsRoot": { + "listIndexes": "test" + } } + }, + "db.mongodb.server_connection_id": { + "$$type": [ + "int", + "long" + ] + }, + "db.mongodb.driver_connection_id": { + "$$type": [ + "int", + "long" + ] } - }, - "db.mongodb.server_connection_id": { - "$$type": [ - "int", - "long" - ] - }, - "db.mongodb.driver_connection_id": { - "$$type": [ - "int", - "long" - ] } } ] diff --git a/source/open-telemetry/tests/operation/list_indexes.yml b/source/open-telemetry/tests/operation/list_indexes.yml index c80f195c76..ee3865c4e4 100644 --- a/source/open-telemetry/tests/operation/list_indexes.yml +++ b/source/open-telemetry/tests/operation/list_indexes.yml @@ -31,31 +31,31 @@ tests: - name: listIndexes operation-list-indexes.test attributes: db.system: mongodb - db.namespace: operation-list-indexes - db.collection.name: test - db.operation.name: listIndexes - db.operation.summary: listIndexes operation-list-indexes.test + db.namespace: operation-list-indexes + db.collection.name: test + db.operation.name: listIndexes + db.operation.summary: listIndexes operation-list-indexes.test nested: - name: listIndexes attributes: db.system: mongodb - db.namespace: operation-list-indexes - db.collection.name: test - db.command.name: listIndexes - network.transport: tcp - db.mongodb.cursor_id: { $$exists: false } - db.response.status_code: { $$exists: false } - exception.message: { $$exists: false } - exception.type: { $$exists: false } - exception.stacktrace: { $$exists: false } - server.address: { $$type: string } - server.port: { $$type: ['int', 'long'] } - db.query.summary: listIndexes operation-list-indexes.test - db.query.text: - $$matchAsDocument: - $$matchAsRoot: - listIndexes: test - db.mongodb.server_connection_id: - $$type: [ 'int', 'long' ] - db.mongodb.driver_connection_id: - $$type: [ 'int', 'long' ] + db.namespace: operation-list-indexes + db.collection.name: test + db.command.name: listIndexes + network.transport: tcp + db.mongodb.cursor_id: { $$exists: false } + db.response.status_code: { $$exists: false } + exception.message: { $$exists: false } + exception.type: { $$exists: false } + exception.stacktrace: { $$exists: false } + server.address: { $$type: string } + server.port: { $$type: ['int', 'long'] } + db.query.summary: listIndexes operation-list-indexes.test + db.query.text: + $$matchAsDocument: + $$matchAsRoot: + listIndexes: test + db.mongodb.server_connection_id: + $$type: [ 'int', 'long' ] + db.mongodb.driver_connection_id: + $$type: [ 'int', 'long' ] From 9987dbf8130d4879db27d9a41bc0d538dcec9c02 Mon Sep 17 00:00:00 2001 From: Nabil Hachicha Date: Tue, 9 Sep 2025 13:41:22 +0100 Subject: [PATCH 42/62] Added convenient transaction test --- .../tests/transaction/convenient.json | 232 ++++++++++++++++++ .../tests/transaction/convenient.yml | 128 ++++++++++ 2 files changed, 360 insertions(+) create mode 100644 source/open-telemetry/tests/transaction/convenient.json create mode 100644 source/open-telemetry/tests/transaction/convenient.yml diff --git a/source/open-telemetry/tests/transaction/convenient.json b/source/open-telemetry/tests/transaction/convenient.json new file mode 100644 index 0000000000..0e6ef1d664 --- /dev/null +++ b/source/open-telemetry/tests/transaction/convenient.json @@ -0,0 +1,232 @@ +{ + "description": "convenient transactions", + "schemaVersion": "1.26", + "runOnRequirements": [ + { + "minServerVersion": "4.4", + "topologies": [ + "replicaset", + "sharded" + ] + } + ], + "createEntities": [ + { + "client": { + "id": "client", + "useMultipleMongoses": false, + "observeTracingMessages": { + "enableCommandPayload": true + } + } + }, + { + "database": { + "id": "database", + "client": "client", + "databaseName": "convenient-transaction-tests" + } + }, + { + "collection": { + "id": "collection", + "database": "database", + "collectionName": "test" + } + }, + { + "session": { + "id": "session", + "client": "client" + } + } + ], + "initialData": [ + { + "collectionName": "test", + "databaseName": "convenient-transaction-tests", + "documents": [] + } + ], + "tests": [ + { + "description": "withTransaction", + "operations": [ + { + "name": "withTransaction", + "object": "session", + "arguments": { + "callback": [ + { + "name": "insertOne", + "object": "collection", + "arguments": { + "document": { + "_id": 1 + }, + "session": "session" + } + } + ] + } + }, + { + "name": "find", + "object": "collection", + "arguments": { + "filter": { + "x": 1 + } + } + } + ], + "expectTracingMessages": [ + { + "client": "client", + "ignoreExtraSpans": false, + "spans": [ + { + "name": "transaction", + "attributes": { + "db.system": "mongodb" + }, + "nested": [ + { + "name": "insert convenient-transaction-tests.test", + "attributes": { + "db.system": "mongodb", + "db.namespace": "convenient-transaction-tests", + "db.collection.name": "test", + "db.operation.name": "insert", + "db.operation.summary": "insert convenient-transaction-tests.test" + }, + "nested": [ + { + "name": "insert", + "attributes": { + "db.system": "mongodb", + "db.namespace": "convenient-transaction-tests", + "db.collection.name": "test", + "server.address": { + "$$type": "string" + }, + "server.port": { + "$$type": [ + "long", + "string" + ] + }, + "server.type": { + "$$type": "string" + }, + "db.query.summary": "insert convenient-transaction-tests.test", + "db.query.text": { + "$$matchAsDocument": { + "$$matchAsRoot": { + "insert": "test", + "ordered": true, + "txnNumber": 1, + "startTransaction": true, + "autocommit": false, + "documents": [ + { + "_id": 1 + } + ] + } + } + }, + "db.mongodb.lsid": { + "$$sessionLsid": "session" + } + } + } + ] + }, + { + "name": "commitTransaction admin", + "attributes": { + "db.system": "mongodb", + "db.namespace": "admin", + "db.collection.name": { + "$$exists": false + }, + "db.operation.name": "commitTransaction" + }, + "nested": [ + { + "name": "commitTransaction", + "attributes": { + "db.system": "mongodb", + "db.namespace": "admin", + "db.collection.name": { + "$$exists": false + }, + "db.query.summary": "commitTransaction admin", + "db.command.name": "commitTransaction", + "db.query.text": { + "$$matchAsDocument": { + "$$matchAsRoot": { + "commitTransaction": 1, + "txnNumber": 1, + "autocommit": false + } + } + } + } + } + ] + } + ] + }, + { + "name": "find convenient-transaction-tests.test", + "attributes": { + "db.system": "mongodb", + "db.namespace": "convenient-transaction-tests", + "db.collection.name": "test", + "db.operation.summary": "find convenient-transaction-tests.test", + "db.operation.name": "find" + }, + "nested": [ + { + "name": "find", + "attributes": { + "db.system": "mongodb", + "db.namespace": "convenient-transaction-tests", + "db.collection.name": "test", + "db.command.name": "find", + "server.address": { + "$$type": "string" + }, + "server.port": { + "$$type": [ + "long", + "string" + ] + }, + "server.type": { + "$$type": "string" + }, + "db.query.summary": "find convenient-transaction-tests.test" + } + } + ] + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "convenient-transaction-tests", + "documents": [ + { + "_id": 1 + } + ] + } + ] + } + ] +} diff --git a/source/open-telemetry/tests/transaction/convenient.yml b/source/open-telemetry/tests/transaction/convenient.yml new file mode 100644 index 0000000000..76f45b4004 --- /dev/null +++ b/source/open-telemetry/tests/transaction/convenient.yml @@ -0,0 +1,128 @@ +description: convenient transactions + +schemaVersion: "1.26" + +runOnRequirements: + - minServerVersion: "4.4" + topologies: ["replicaset", "sharded"] + +createEntities: + - client: + id: &client client + useMultipleMongoses: false + observeTracingMessages: + enableCommandPayload: true + - database: + id: &database database + client: *client + databaseName: &databaseName convenient-transaction-tests + - collection: + id: &collection collection + database: *database + collectionName: &collectionName test + - session: + id: &session session + client: *client + +initialData: + - collectionName: *collectionName + databaseName: *databaseName + documents: [] + +tests: + - description: "withTransaction" + operations: + - name: withTransaction + object: *session + arguments: + callback: + - name: insertOne + object: *collection + arguments: + document: + _id: 1 + session: *session + - name: find + object: *collection + arguments: { filter: { x: 1 } } + + expectTracingMessages: + - client: *client + ignoreExtraSpans: false + spans: + - name: transaction + attributes: + db.system: mongodb + nested: + - name: insert convenient-transaction-tests.test + attributes: + db.system: mongodb + db.namespace: *databaseName + db.collection.name: *collectionName + db.operation.name: insert + db.operation.summary: insert convenient-transaction-tests.test + nested: + - name: insert + attributes: + db.system: mongodb + db.namespace: *databaseName + db.collection.name: *collectionName + server.address: { $$type: string } + server.port: { $$type: [ 'long', 'string' ] } + server.type: { $$type: string } + db.query.summary: insert convenient-transaction-tests.test + db.query.text: + $$matchAsDocument: + $$matchAsRoot: + insert: test + ordered: true + txnNumber: 1 + startTransaction: true + autocommit: false + documents: + - _id: 1 + db.mongodb.lsid: { $$sessionLsid: *session } + - name: commitTransaction admin + attributes: + db.system: mongodb + db.namespace: admin + db.collection.name: { $$exists: false } + db.operation.name: commitTransaction + nested: + - name: commitTransaction + attributes: + db.system: mongodb + db.namespace: admin + db.collection.name: { $$exists: false } + db.query.summary: commitTransaction admin + db.command.name: commitTransaction + db.query.text: + $$matchAsDocument: + $$matchAsRoot: + commitTransaction: 1 + txnNumber: 1 + autocommit: false + - name: find convenient-transaction-tests.test + attributes: + db.system: mongodb + db.namespace: *databaseName + db.collection.name: *collectionName + db.operation.summary: find convenient-transaction-tests.test + db.operation.name: find + nested: + - name: find + attributes: + db.system: mongodb + db.namespace: *databaseName + db.collection.name: *collectionName + db.command.name: find + server.address: { $$type: string } + server.port: { $$type: [ 'long', 'string' ] } + server.type: { $$type: string } + db.query.summary: find convenient-transaction-tests.test + + outcome: + - collectionName: test + databaseName: convenient-transaction-tests + documents: + - _id: 1 From 51fc929c4cf5efc6d37a81ea397073a73d3d046b Mon Sep 17 00:00:00 2001 From: Dmitry Rybakov Date: Tue, 9 Sep 2025 16:24:44 +0200 Subject: [PATCH 43/62] Bring spec in accordance with the new tests --- source/open-telemetry/open-telemetry.md | 42 ++++++++++--------------- 1 file changed, 16 insertions(+), 26 deletions(-) diff --git a/source/open-telemetry/open-telemetry.md b/source/open-telemetry/open-telemetry.md index be54e90e07..446c7c0848 100644 --- a/source/open-telemetry/open-telemetry.md +++ b/source/open-telemetry/open-telemetry.md @@ -163,11 +163,7 @@ span. ##### Span Name -The span name SHOULD be: - -- `server_command db.collection_name` if the command is executed on a collection (e.g., - `findAndModify warehouse.users`). -- `server_command db` if there is no specific collection for the command. +The span name SHOULD be the command name. For example, `find`, `insert`, `update`, etc. ##### Span Kind @@ -177,32 +173,26 @@ Span kind MUST be "client". Spans SHOULD have the following attributes: -| Attribute | Type | Description | Requirement Level | -| :-------------------------------- | :------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :--------------------------- | -| `db.system` | `string` | MUST be 'mongodb' | Required | -| `db.namespace` | `string` | The database name | Required if available | -| `db.collection.name` | `string` | The collection being accessed within the database stated in `db.namespace` | Required if available | -| `db.command.name` | `string` | The name of the server command being executed | Required | -| `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 | -| `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 | -| `server.port` | `int64` | Server port number | Required | -| `server.address` | `string` | Name of the database host, or IP address if name is not known | Required | -| `network.transport` | `string` | MUST be 'tcp' or 'unix' depending on the protocol | Required | -| `db.query.summary` | `string` | Equivalent to span name | Required | -| `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 | +| Attribute | Type | Description | Requirement Level | +| :-------------------------------- | :------- | :------------------------------------------------------------------------------------------------------------------------------------------------------- | :--------------------------- | +| `db.system` | `string` | MUST be 'mongodb' | Required | +| `db.namespace` | `string` | The database name | Required if available | +| `db.collection.name` | `string` | The collection being accessed within the database stated in `db.namespace` | Required if available | +| `db.command.name` | `string` | The name of the server command being executed | Required | +| `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 | +| `server.port` | `int64` | Server port number | Required | +| `server.address` | `string` | Name of the database host, or IP address if name is not known | Required | +| `network.transport` | `string` | MUST be 'tcp' or 'unix' depending on the protocol | Required | +| `db.query.summary` | `string` | Equivalent to span name | Required | +| `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 | Besides the attributes listed in the table above, drivers MAY add other attributes from the [Semantic Conventions for Databases](https://opentelemetry.io/docs/specs/semconv/registry/attributes/db/) that are applicable to MongoDB. -###### db.response.status_code and error.type - -These attributes should be added only if the command was not successful. The content of `error.type` is language -specific; a driver decides what best describes the error. - ###### db.query.text This attribute contains the full database command executed serialized to extended JSON. If not truncated, the content of From 2841df30c061866b424531dd3ed5a81229113212 Mon Sep 17 00:00:00 2001 From: Nabil Hachicha Date: Tue, 9 Sep 2025 16:39:16 +0100 Subject: [PATCH 44/62] db.response.status_code type is string per the OTel convention https://opentelemetry.io/docs/specs/semconv/registry/attributes/db/ --- source/open-telemetry/tests/operation/find_retries.json | 2 +- source/open-telemetry/tests/operation/find_retries.yml | 2 +- source/open-telemetry/tests/operation/retries.json | 2 +- source/open-telemetry/tests/operation/retries.yml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/source/open-telemetry/tests/operation/find_retries.json b/source/open-telemetry/tests/operation/find_retries.json index d79de95657..1d1f4a582d 100644 --- a/source/open-telemetry/tests/operation/find_retries.json +++ b/source/open-telemetry/tests/operation/find_retries.json @@ -95,7 +95,7 @@ "db.mongodb.cursor_id": { "$$exists": false }, - "db.response.status_code": 89, + "db.response.status_code": "89", "exception.message": { "$$type": "string" }, diff --git a/source/open-telemetry/tests/operation/find_retries.yml b/source/open-telemetry/tests/operation/find_retries.yml index 3e9deb9d0b..e3d2984596 100644 --- a/source/open-telemetry/tests/operation/find_retries.yml +++ b/source/open-telemetry/tests/operation/find_retries.yml @@ -57,7 +57,7 @@ tests: db.command.name: find network.transport: tcp db.mongodb.cursor_id: { $$exists: false } - db.response.status_code: 89 + db.response.status_code: '89' exception.message: { $$type: string } exception.type: { $$type: string } exception.stacktrace: { $$type: string } diff --git a/source/open-telemetry/tests/operation/retries.json b/source/open-telemetry/tests/operation/retries.json index 2cd93eaf14..bb95c953ae 100644 --- a/source/open-telemetry/tests/operation/retries.json +++ b/source/open-telemetry/tests/operation/retries.json @@ -101,7 +101,7 @@ "db.mongodb.cursor_id": { "$$exists": false }, - "db.response.status_code": 89, + "db.response.status_code": "89", "exception.message": { "$$exists": true }, diff --git a/source/open-telemetry/tests/operation/retries.yml b/source/open-telemetry/tests/operation/retries.yml index 12c2b69820..fcc4b8f3cc 100644 --- a/source/open-telemetry/tests/operation/retries.yml +++ b/source/open-telemetry/tests/operation/retries.yml @@ -61,7 +61,7 @@ tests: db.command.name: find network.transport: tcp db.mongodb.cursor_id: { $$exists: false } - db.response.status_code: 89 + db.response.status_code: '89' exception.message: { $$exists: true } exception.type: { $$exists: true } exception.stacktrace: { $$exists: true } From 5af87ec67aa5c7ce960f3784fd7c9d1488fa1593 Mon Sep 17 00:00:00 2001 From: Dmitry Rybakov Date: Tue, 9 Sep 2025 17:50:57 +0200 Subject: [PATCH 45/62] Fix review remarks --- source/open-telemetry/open-telemetry.md | 34 ++++++++++++++++++++++--- 1 file changed, 31 insertions(+), 3 deletions(-) diff --git a/source/open-telemetry/open-telemetry.md b/source/open-telemetry/open-telemetry.md index 446c7c0848..c4fb18f37d 100644 --- a/source/open-telemetry/open-telemetry.md +++ b/source/open-telemetry/open-telemetry.md @@ -118,9 +118,9 @@ the `withTransaction` span. The span name SHOULD be: -- `driver_operation_name db.collection_name` if the command is executed on a collection (e.g., +- `driver_operation_name db.collection_name` if the operation is executed on a collection (e.g., `findOneAndDelete warehouse.users`). -- `driver_operation_name db` if there is no specific collection for the command (e.g., `runCommand warehouse`). +- `driver_operation_name db` if there is no specific collection for the operation (e.g., `runCommand warehouse`). ##### Span Kind @@ -142,6 +142,16 @@ Spans SHOULD have the following attributes: Not all attributes are available at the moment of span creation. Drivers need to add attributes at later stages, which requires an operation span to be available throughout the complete operation lifecycle. +###### db.namespace + +This attribute SHOULD be set to current database name except for operations executing against admin db. This field is +omitted for transaction (abort|commit), and client `bulkWrite` operations. + +###### db.collection.name + +This attribute should be set to the user's collection if the operation is executing against a collection, this field is +omitted for commands running against `admin` database or commands that do not target a specific collection. + ##### Exceptions 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: | `server.port` | `int64` | Server port number | Required | | `server.address` | `string` | Name of the database host, or IP address if name is not known | Required | | `network.transport` | `string` | MUST be 'tcp' or 'unix' depending on the protocol | Required | -| `db.query.summary` | `string` | Equivalent to span name | Required | +| `db.query.summary` | `string` | `command_name database_name.collection_name` | Required | | `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 | @@ -193,6 +203,24 @@ Besides the attributes listed in the table above, drivers MAY add other attribut [Semantic Conventions for Databases](https://opentelemetry.io/docs/specs/semconv/registry/attributes/db/) that are applicable to MongoDB. +###### db.namespace + +This attribute SHOULD be set to current database name except for commands executing against admin db. This field is +omitted for transaction (abort|commit). + +###### db.collection.name + +This attribute should be set to the user's collection if the operation is executing against a collection, this field is +omitted for commands running against `admin` database or commands that do not target a specific collection. + +###### db.query.summary + +This attribute SHOULD contain: + +- `command_name db.collection_name` if the command is executed on a collection. +- `command_name db` if there is no specific collection for the command. +- `command_name` in other cases (e.g., commands executed against `admin` database). + ###### db.query.text This attribute contains the full database command executed serialized to extended JSON. If not truncated, the content of From 46bc709b898df1e25feee288b54ec87ff5d74ae7 Mon Sep 17 00:00:00 2001 From: Dmitry Rybakov Date: Tue, 9 Sep 2025 18:06:07 +0200 Subject: [PATCH 46/62] Fix review remarks --- source/open-telemetry/open-telemetry.md | 1 - 1 file changed, 1 deletion(-) diff --git a/source/open-telemetry/open-telemetry.md b/source/open-telemetry/open-telemetry.md index c4fb18f37d..1520f4097e 100644 --- a/source/open-telemetry/open-telemetry.md +++ b/source/open-telemetry/open-telemetry.md @@ -137,7 +137,6 @@ Spans SHOULD have the following attributes: | `db.collection.name` | `string` | The collection being accessed within the database stated in `db.namespace` | Required if available | | `db.operation.name` | `string` | The name of the driver operation being executed | Required | | `db.operation.summary` | `string` | Equivalent to span name | Required | -| `db.mongodb.cursor_id` | `int64` | If a cursor is created or used in the operation | Required if available | Not all attributes are available at the moment of span creation. Drivers need to add attributes at later stages, which requires an operation span to be available throughout the complete operation lifecycle. From ae0d15e4e9cde19699bce7c704e2e8ba0b8b1d30 Mon Sep 17 00:00:00 2001 From: Dmitry Rybakov Date: Wed, 10 Sep 2025 14:19:29 +0200 Subject: [PATCH 47/62] Fix section names --- source/open-telemetry/open-telemetry.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/source/open-telemetry/open-telemetry.md b/source/open-telemetry/open-telemetry.md index 1520f4097e..c14f78e751 100644 --- a/source/open-telemetry/open-telemetry.md +++ b/source/open-telemetry/open-telemetry.md @@ -114,7 +114,7 @@ When a user commits or aborts a transaction with `commitTransaction` or `abortTr In case of `withTransaction` operation spans for operations that are executed inside the callbacks SHOULD be nested into the `withTransaction` span. -##### Span Name +##### Operation Span Name The span name SHOULD be: @@ -122,11 +122,11 @@ The span name SHOULD be: `findOneAndDelete warehouse.users`). - `driver_operation_name db` if there is no specific collection for the operation (e.g., `runCommand warehouse`). -##### Span Kind +##### Operation Span Kind Span kind MUST be "client". -##### Span Attributes +##### Operation Span Attributes Spans SHOULD have the following attributes: @@ -170,15 +170,15 @@ Spans for commands MUST be nested to the span for the corresponding driver opera retried, the driver MUST create a separate span for each retry; all the retries MUST be nested to the same operation span. -##### Span Name +##### Command Span Name The span name SHOULD be the command name. For example, `find`, `insert`, `update`, etc. -##### Span Kind +##### Command Span Kind Span kind MUST be "client". -##### Span Attributes +##### Command Span Attributes Spans SHOULD have the following attributes: From 52974c0d28efb9957d955f38c9147cf7dd1b0c1e Mon Sep 17 00:00:00 2001 From: Nabil Hachicha Date: Wed, 10 Sep 2025 18:08:47 +0100 Subject: [PATCH 48/62] - Clarifying rules for db.namespace, db.collection.name and db.query.summary with examples - Adding test for abortTransaction - Renaming transaction test to core_api --- source/open-telemetry/open-telemetry.md | 103 +++++++++----- ...e_and_update.json => find_and_modify.json} | 0 ...one_and_update.yml => find_and_modify.yml} | 0 .../{transaction.json => core_api.json} | 134 +++++++++++++++++- .../{transaction.yml => core_api.yml} | 78 +++++++++- 5 files changed, 281 insertions(+), 34 deletions(-) rename source/open-telemetry/tests/operation/{find_one_and_update.json => find_and_modify.json} (100%) rename source/open-telemetry/tests/operation/{find_one_and_update.yml => find_and_modify.yml} (100%) rename source/open-telemetry/tests/transaction/{transaction.json => core_api.json} (60%) rename source/open-telemetry/tests/transaction/{transaction.yml => core_api.yml} (60%) diff --git a/source/open-telemetry/open-telemetry.md b/source/open-telemetry/open-telemetry.md index c14f78e751..d387218aa8 100644 --- a/source/open-telemetry/open-telemetry.md +++ b/source/open-telemetry/open-telemetry.md @@ -119,7 +119,12 @@ the `withTransaction` span. The span name SHOULD be: - `driver_operation_name db.collection_name` if the operation is executed on a collection (e.g., - `findOneAndDelete warehouse.users`). + `collection.findOneAndDelete(filter)` will report `findAndModify warehouse_db.users_coll`). + +**Note**: since the `findOneAndDelete` operation is implemented as a `findAndModify` command, the operation name in the +span is `findAndModify`. This ensures consistency between drivers when naming operations. See the +[covered operations](#covered-operations) table below for mapping of public API methods to operation names. + - `driver_operation_name db` if there is no specific collection for the operation (e.g., `runCommand warehouse`). ##### Operation Span Kind @@ -143,14 +148,30 @@ requires an operation span to be available throughout the complete operation lif ###### db.namespace -This attribute SHOULD be set to current database name except for operations executing against admin db. This field is -omitted for transaction (abort|commit), and client `bulkWrite` operations. +This attribute SHOULD be set to current database name except for operations executing against admin db ex: (transaction, +client `bulkWrite`) operations. + +Examples: + +- `find` on `test.users` → `test` +- `runCommand` on `admin` → `admin` +- `commitTransaction` → `admin` +- `abortTransaction` → `admin` +- client `bulkWrite` → `admin` ###### db.collection.name This attribute should be set to the user's collection if the operation is executing against a collection, this field is omitted for commands running against `admin` database or commands that do not target a specific collection. +Examples: + +- `find` on `test.users` → `users` +- `runCommand` on `admin` → *omitted* +- `commitTransaction` → *omitted* +- `abortTransaction` → *omitted* +- client `bulkWrite` → *omitted* + ##### Exceptions If the driver operation fails with an exception, drivers MUST record an exception to the current operation span. When @@ -204,21 +225,38 @@ applicable to MongoDB. ###### db.namespace -This attribute SHOULD be set to current database name except for commands executing against admin db. This field is -omitted for transaction (abort|commit). +This attribute SHOULD be set to current database name except for operations executing against admin db ex: (transaction, +client `bulkWrite`) operations. + +Examples: + +- `find` on `test.users` → `test` +- `runCommand` on `admin` → `admin` +- `commitTransaction` → `admin` +- `abortTransaction` → `admin` +- client `bulkWrite` → `admin` ###### db.collection.name This attribute should be set to the user's collection if the operation is executing against a collection, this field is omitted for commands running against `admin` database or commands that do not target a specific collection. +Examples: + +- `find` on `test.users` → `users` +- `runCommand` on `admin` → *omitted* +- `commitTransaction` → *omitted* +- `abortTransaction` → *omitted* +- client `bulkWrite` → *omitted* + ###### db.query.summary This attribute SHOULD contain: - `command_name db.collection_name` if the command is executed on a collection. - `command_name db` if there is no specific collection for the command. -- `command_name` in other cases (e.g., commands executed against `admin` database). +- `command_name admin` in other cases (e.g., commands executed against `admin` database, transaction or client + `bulkWrite`). ###### db.query.text @@ -269,32 +307,33 @@ See [OpenTelemetry Tests](tests/README.md) for the test plan. The OpenTelemetry specification covers the following operations: -| Operation | Test | -| :----------------------- | :----------------------------------------------------------------------------------- | -| `aggregate` | [tests/transaction/aggregate.yml](tests/operation/aggregate.yml) | -| `findAndModify` | [tests/transaction/find_one_and_update.yml](tests/operation/find_one_and_update.yml) | -| `bulkWrite` | [tests/transaction/bulk_write.yml](tests/operation/bulk_write.yml) | -| `commitTransaction` | [tests/transaction/transaction.yml](tests/transaction/transaction.yml) | -| `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) | -| `distinct` | [tests/transaction/distinct.yml](tests/operation/distinct.yml) | -| `dropCollection` | [tests/transaction/drop_collection.yml](tests/operation/drop_collection.yml) | -| `dropIndexes` | [tests/transaction/drop_indexes.yml](tests/operation/drop_indexes.yml) | -| `find` | [tests/transaction/find.yml](tests/operation/find.yml) | -| `listCollections` | [tests/transaction/list_collections.yml](tests/operation/list_collections.yml) | -| `listDatabases` | [tests/transaction/list_databases.yml](tests/operation/list_databases.yml) | -| `listIndexes` | [tests/transaction/list_indexes.yml](tests/operation/list_indexes.yml) | -| `mapReduce` | [tests/transaction/map_reduce.yml](tests/operation/map_reduce.yml) | -| `estimatedDocumentCount` | [tests/transaction/count.yml](tests/operation/count.yml) | -| `insert` | [tests/transaction/insert.yml](tests/operation/insert.yml) | -| `delete` | [tests/transaction/delete.yml](tests/operation/delete.yml) | -| `update` | [tests/transaction/update.yml](tests/operation/update.yml) | -| `createSearchIndexes` | [tests/transaction/atlas_search.yml](tests/operation/atlas_search.yml) | -| `dropSearchIndex` | [tests/transaction/atlas_search.yml](tests/operation/atlas_search.yml) | -| `updateSearchIndex` | [tests/transaction/delete.yml](tests/operation/delete.yml) | -| `delete` | [tests/transaction/atlas_search.yml](tests/operation/atlas_search.yml) | +| Operation | Test | +| :----------------------- | :----------------------------------------------------------------------------- | +| `aggregate` | [tests/operation/aggregate.yml](tests/operation/aggregate.yml) | +| `findAndModify` | [tests/operation/find_and_modify.yml](tests/operation/find_and_modify.yml) | +| `bulkWrite` | [tests/operation/bulk_write.yml](tests/operation/bulk_write.yml) | +| `commitTransaction` | [tests/transaction/core_api.yml](tests/transaction/core_api.yml) | +| `abortTransaction` | [tests/transaction/core_api.yml](tests/transaction/core_api.yml) | +| `withTransaction` | [tests/transaction/convenient.yml](tests/transaction/convenient.yml) | +| `createCollection` | [tests/operation/create_collection.yml](tests/operation/create_collection.yml) | +| `createIndexes` | [tests/operation/create_indexes.yml](tests/operation/create_indexes.yml) | +| `createView` | [tests/operation/create_view.yml](tests/operation/create_view.yml) | +| `distinct` | [tests/operation/distinct.yml](tests/operation/distinct.yml) | +| `dropCollection` | [tests/operation/drop_collection.yml](tests/operation/drop_collection.yml) | +| `dropIndexes` | [tests/operation/drop_indexes.yml](tests/operation/drop_indexes.yml) | +| `find` | [tests/operation/find.yml](tests/operation/find.yml) | +| `listCollections` | [tests/operation/list_collections.yml](tests/operation/list_collections.yml) | +| `listDatabases` | [tests/operation/list_databases.yml](tests/operation/list_databases.yml) | +| `listIndexes` | [tests/operation/list_indexes.yml](tests/operation/list_indexes.yml) | +| `mapReduce` | [tests/operation/map_reduce.yml](tests/operation/map_reduce.yml) | +| `estimatedDocumentCount` | [tests/operation/count.yml](tests/operation/count.yml) | +| `insert` | [tests/operation/insert.yml](tests/operation/insert.yml) | +| `delete` | [tests/operation/delete.yml](tests/operation/delete.yml) | +| `update` | [tests/operation/update.yml](tests/operation/update.yml) | +| `createSearchIndexes` | [tests/operation/atlas_search.yml](tests/operation/atlas_search.yml) | +| `dropSearchIndex` | [tests/operation/atlas_search.yml](tests/operation/atlas_search.yml) | +| `updateSearchIndex` | [tests/operation/delete.yml](tests/operation/delete.yml) | +| `delete` | [tests/operation/atlas_search.yml](tests/operation/atlas_search.yml) | ## Backwards Compatibility diff --git a/source/open-telemetry/tests/operation/find_one_and_update.json b/source/open-telemetry/tests/operation/find_and_modify.json similarity index 100% rename from source/open-telemetry/tests/operation/find_one_and_update.json rename to source/open-telemetry/tests/operation/find_and_modify.json diff --git a/source/open-telemetry/tests/operation/find_one_and_update.yml b/source/open-telemetry/tests/operation/find_and_modify.yml similarity index 100% rename from source/open-telemetry/tests/operation/find_one_and_update.yml rename to source/open-telemetry/tests/operation/find_and_modify.yml diff --git a/source/open-telemetry/tests/transaction/transaction.json b/source/open-telemetry/tests/transaction/core_api.json similarity index 60% rename from source/open-telemetry/tests/transaction/transaction.json rename to source/open-telemetry/tests/transaction/core_api.json index db66ae263f..e37e2ac2d3 100644 --- a/source/open-telemetry/tests/transaction/transaction.json +++ b/source/open-telemetry/tests/transaction/core_api.json @@ -56,7 +56,7 @@ ], "tests": [ { - "description": "observeTracingMessages around transaction", + "description": "commit transaction", "operations": [ { "object": "session0", @@ -233,6 +233,138 @@ ] } ] + }, + { + "description": "abort transaction", + "operations": [ + { + "object": "session0", + "name": "startTransaction" + }, + { + "object": "collection0", + "name": "insertOne", + "arguments": { + "session": "session0", + "document": { + "_id": 1 + } + } + }, + { + "object": "session0", + "name": "abortTransaction" + } + ], + "expectTracingMessages": [ + { + "client": "client0", + "ignoreExtraSpans": false, + "spans": [ + { + "name": "transaction", + "attributes": { + "db.system": "mongodb" + }, + "nested": [ + { + "name": "insert transaction-tests.test", + "attributes": { + "db.system": "mongodb", + "db.namespace": "transaction-tests", + "db.collection.name": "test", + "db.operation.name": "insert", + "db.operation.summary": "insert transaction-tests.test" + }, + "nested": [ + { + "name": "insert", + "attributes": { + "db.system": "mongodb", + "db.namespace": "transaction-tests", + "db.collection.name": "test", + "server.address": { + "$$type": "string" + }, + "server.port": { + "$$type": [ + "long", + "string" + ] + }, + "server.type": { + "$$type": "string" + }, + "db.query.summary": "insert transaction-tests.test", + "db.query.text": { + "$$matchAsDocument": { + "$$matchAsRoot": { + "insert": "test", + "ordered": true, + "txnNumber": 1, + "startTransaction": true, + "autocommit": false, + "documents": [ + { + "_id": 1 + } + ] + } + } + }, + "db.mongodb.lsid": { + "$$sessionLsid": "session0" + } + } + } + ] + }, + { + "name": "abortTransaction admin", + "attributes": { + "db.system": "mongodb", + "db.namespace": "admin", + "db.collection.name": { + "$$exists": false + }, + "db.operation.name": "abortTransaction" + }, + "nested": [ + { + "name": "abortTransaction", + "attributes": { + "db.system": "mongodb", + "db.namespace": "admin", + "db.collection.name": { + "$$exists": false + }, + "db.query.summary": "abortTransaction admin", + "db.command.name": "abortTransaction", + "db.query.text": { + "$$matchAsDocument": { + "$$matchAsRoot": { + "abortTransaction": 1, + "txnNumber": 1, + "autocommit": false + } + } + } + } + } + ] + } + ] + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "transaction-tests", + "documents": [] + } + ] } ] } diff --git a/source/open-telemetry/tests/transaction/transaction.yml b/source/open-telemetry/tests/transaction/core_api.yml similarity index 60% rename from source/open-telemetry/tests/transaction/transaction.yml rename to source/open-telemetry/tests/transaction/core_api.yml index d2791d4e47..11d14e1958 100644 --- a/source/open-telemetry/tests/transaction/transaction.yml +++ b/source/open-telemetry/tests/transaction/core_api.yml @@ -30,7 +30,7 @@ initialData: databaseName: transaction-tests documents: [] tests: - - description: observeTracingMessages around transaction + - description: commit transaction operations: - object: *session0 name: startTransaction @@ -125,3 +125,79 @@ tests: databaseName: transaction-tests documents: - _id: 1 + + - description: abort transaction + operations: + - object: *session0 + name: startTransaction + - object: *collection0 + name: insertOne + arguments: + session: *session0 + document: + _id: 1 + - object: *session0 + name: abortTransaction + + expectTracingMessages: + - client: *client0 + ignoreExtraSpans: false + spans: + - name: transaction + attributes: + db.system: mongodb + nested: + - name: insert transaction-tests.test + attributes: + db.system: mongodb + db.namespace: transaction-tests + db.collection.name: test + db.operation.name: insert + db.operation.summary: insert transaction-tests.test + nested: + - name: insert + attributes: + db.system: mongodb + db.namespace: transaction-tests + db.collection.name: test + server.address: { $$type: string } + server.port: { $$type: ['long', 'string'] } + server.type: { $$type: string } + db.query.summary: insert transaction-tests.test + db.query.text: + $$matchAsDocument: + $$matchAsRoot: + insert: test + ordered: true + txnNumber: 1 + startTransaction: true + autocommit: false + documents: + - _id: 1 + db.mongodb.lsid: { $$sessionLsid: *session0 } + - name: abortTransaction admin + attributes: + db.system: mongodb + db.namespace: admin + db.collection.name: { $$exists: false } + db.operation.name: abortTransaction + nested: + - name: abortTransaction + attributes: + db.system: mongodb + db.namespace: admin + db.collection.name: { $$exists: false } + db.query.summary: abortTransaction admin + db.command.name: abortTransaction + db.query.text: + $$matchAsDocument: + $$matchAsRoot: + abortTransaction: 1 + txnNumber: 1 + autocommit: false + + outcome: + - collectionName: test + databaseName: transaction-tests + documents: [] + From 00c1dc33df729eaefc9a9af0c4d6f23284343840 Mon Sep 17 00:00:00 2001 From: Dmitry Rybakov <160598371+comandeo-mongo@users.noreply.github.com> Date: Tue, 16 Sep 2025 10:24:25 +0200 Subject: [PATCH 49/62] Update source/open-telemetry/open-telemetry.md Co-authored-by: Jeremy Mikola --- source/open-telemetry/open-telemetry.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/open-telemetry/open-telemetry.md b/source/open-telemetry/open-telemetry.md index d387218aa8..a7c0686fa0 100644 --- a/source/open-telemetry/open-telemetry.md +++ b/source/open-telemetry/open-telemetry.md @@ -41,7 +41,7 @@ Spans encapsulate: - Attributes - A list of links to other Spans - A list of timestamped Events -- A Status. +- A Status #### Tracer From cafe19c4eb018eaf58db735dffdc2fc96cc45fe7 Mon Sep 17 00:00:00 2001 From: Dmitry Rybakov Date: Tue, 16 Sep 2025 11:54:05 +0200 Subject: [PATCH 50/62] Respond to code review remarks --- source/open-telemetry/open-telemetry.md | 38 +++++++++---------- .../tests/transaction/convenient.json | 11 ++++-- .../tests/transaction/convenient.yml | 6 ++- .../tests/transaction/core_api.json | 22 ++++++++--- .../tests/transaction/core_api.yml | 11 ++++-- 5 files changed, 56 insertions(+), 32 deletions(-) diff --git a/source/open-telemetry/open-telemetry.md b/source/open-telemetry/open-telemetry.md index a7c0686fa0..8fbd21b86b 100644 --- a/source/open-telemetry/open-telemetry.md +++ b/source/open-telemetry/open-telemetry.md @@ -25,7 +25,7 @@ The keywords "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SH An application that uses the MongoDB driver. -#### Span +**Span** A Span represents a single operation within a trace. Spans can be nested to form a trace tree. Each trace contains a root span, which typically describes the entire operation and, optionally, one or more sub-spans for its sub-operations. @@ -43,10 +43,9 @@ Spans encapsulate: - A list of timestamped Events - A Status -#### Tracer +### Implementation Requirements -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. +#### External Dependencies **OpenTelemetry API and SDK** @@ -54,10 +53,6 @@ OpenTelemetry offers two components for implementing instrumentation – API and the necessary types and method signatures. If there is no OpenTelemetry SDK available at runtime, API methods are no-ops. OpenTelemetry SDK is an actual implementation of the API. If the SDK is available, API methods do work. -### Implementation Requirements - -#### External Dependencies - Drivers MAY add a dependency to the corresponding OpenTelemetry API. This is the recommended way for implementing OpenTelemetry in libraries. Alternatively, drivers can implement OpenTelemetry support using any suitable tools within the driver ecosystem. Drivers MUST NOT add a dependency to OpenTelemetry SDK. @@ -174,9 +169,12 @@ Examples: ##### 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 -available: +If the driver operation fails with an exception, drivers MUST record an exception to the current operation span. This +does not relate to exceptions that happen on the server command level (see below). Those exceptions MUST be recorded to +the corresponding command span. + +When recording an exception, drivers SHOULD add the following attributes to the span, when the content for the attribute +if available: - `exception.message` - `exception.type` @@ -213,11 +211,13 @@ Spans SHOULD have the following attributes: | `server.port` | `int64` | Server port number | Required | | `server.address` | `string` | Name of the database host, or IP address if name is not known | Required | | `network.transport` | `string` | MUST be 'tcp' or 'unix' depending on the protocol | Required | -| `db.query.summary` | `string` | `command_name database_name.collection_name` | Required | +| `db.query.summary` | `string` | (see explanation below) | Required | | `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 | Besides the attributes listed in the table above, drivers MAY add other attributes from the [Semantic Conventions for Databases](https://opentelemetry.io/docs/specs/semconv/registry/attributes/db/) that are @@ -292,12 +292,12 @@ A common complaint from our support team is that they don't know how to easily g 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. -Although users can implement their own debug logging support via existing driver events (SDAM, APM, etc), this requires -code changes. It is often difficult to quickly implement and deploy such changes in production at the time they are -needed, and to remove the changes afterward. Additionally, there are useful scenarios to log that do not correspond to -existing events. Standardizing on debug log messages that drivers produce and how to enable/configure logging will -provide TSEs, CEs, and MongoDB users an easier way to get debugging information out of our drivers, facilitate support -of drivers for our internal teams, and improve our documentation around troubleshooting. +OpenTelemetry is currently the industry standard for instrumenting, generating, and collecting telemetry data (metrics, +logs, and traces). By instrumenting our drivers natively, we allow our end users to collect traces in a +batteries-included way, with the additional benefits that the tracing is developed and maintained in-house, and conforms +to the open-source standard for tracing. This also ensures that traces generated on the client-side on driver operations +can tie into other traces, thus giving our end users a broader picture of the network hops that a single request might +take. ## Test Plan @@ -305,7 +305,7 @@ See [OpenTelemetry Tests](tests/README.md) for the test plan. ## Covered operations -The OpenTelemetry specification covers the following operations: +The OpenTelemetry specification covers all driver operations including but not limited to the following operations: | Operation | Test | | :----------------------- | :----------------------------------------------------------------------------- | diff --git a/source/open-telemetry/tests/transaction/convenient.json b/source/open-telemetry/tests/transaction/convenient.json index 0e6ef1d664..7f775a45cc 100644 --- a/source/open-telemetry/tests/transaction/convenient.json +++ b/source/open-telemetry/tests/transaction/convenient.json @@ -120,6 +120,10 @@ "$$type": "string" }, "db.query.summary": "insert convenient-transaction-tests.test", + "db.mongodb.lsid": { + "$$sessionLsid": "session" + }, + "db.mongodb.txn_number": 1, "db.query.text": { "$$matchAsDocument": { "$$matchAsRoot": { @@ -135,9 +139,6 @@ ] } } - }, - "db.mongodb.lsid": { - "$$sessionLsid": "session" } } } @@ -164,6 +165,10 @@ }, "db.query.summary": "commitTransaction admin", "db.command.name": "commitTransaction", + "db.mongodb.lsid": { + "$$sessionLsid": "session" + }, + "db.mongodb.txn_number": 1, "db.query.text": { "$$matchAsDocument": { "$$matchAsRoot": { diff --git a/source/open-telemetry/tests/transaction/convenient.yml b/source/open-telemetry/tests/transaction/convenient.yml index 76f45b4004..60dda239aa 100644 --- a/source/open-telemetry/tests/transaction/convenient.yml +++ b/source/open-telemetry/tests/transaction/convenient.yml @@ -71,6 +71,8 @@ tests: server.port: { $$type: [ 'long', 'string' ] } server.type: { $$type: string } db.query.summary: insert convenient-transaction-tests.test + db.mongodb.lsid: { $$sessionLsid: *session } + db.mongodb.txn_number: 1 db.query.text: $$matchAsDocument: $$matchAsRoot: @@ -81,7 +83,6 @@ tests: autocommit: false documents: - _id: 1 - db.mongodb.lsid: { $$sessionLsid: *session } - name: commitTransaction admin attributes: db.system: mongodb @@ -96,12 +97,15 @@ tests: db.collection.name: { $$exists: false } db.query.summary: commitTransaction admin db.command.name: commitTransaction + db.mongodb.lsid: { $$sessionLsid: *session } + db.mongodb.txn_number: 1 db.query.text: $$matchAsDocument: $$matchAsRoot: commitTransaction: 1 txnNumber: 1 autocommit: false + - name: find convenient-transaction-tests.test attributes: db.system: mongodb diff --git a/source/open-telemetry/tests/transaction/core_api.json b/source/open-telemetry/tests/transaction/core_api.json index e37e2ac2d3..7574d48684 100644 --- a/source/open-telemetry/tests/transaction/core_api.json +++ b/source/open-telemetry/tests/transaction/core_api.json @@ -126,6 +126,10 @@ "$$type": "string" }, "db.query.summary": "insert transaction-tests.test", + "db.mongodb.lsid": { + "$$sessionLsid": "session0" + }, + "db.mongodb.txn_number": 1, "db.query.text": { "$$matchAsDocument": { "$$matchAsRoot": { @@ -141,9 +145,6 @@ ] } } - }, - "db.mongodb.lsid": { - "$$sessionLsid": "session0" } } } @@ -170,6 +171,10 @@ }, "db.query.summary": "commitTransaction admin", "db.command.name": "commitTransaction", + "db.mongodb.lsid": { + "$$sessionLsid": "session0" + }, + "db.mongodb.txn_number": 1, "db.query.text": { "$$matchAsDocument": { "$$matchAsRoot": { @@ -296,6 +301,10 @@ "$$type": "string" }, "db.query.summary": "insert transaction-tests.test", + "db.mongodb.lsid": { + "$$sessionLsid": "session0" + }, + "db.mongodb.txn_number": 1, "db.query.text": { "$$matchAsDocument": { "$$matchAsRoot": { @@ -311,9 +320,6 @@ ] } } - }, - "db.mongodb.lsid": { - "$$sessionLsid": "session0" } } } @@ -340,6 +346,10 @@ }, "db.query.summary": "abortTransaction admin", "db.command.name": "abortTransaction", + "db.mongodb.lsid": { + "$$sessionLsid": "session0" + }, + "db.mongodb.txn_number": 1, "db.query.text": { "$$matchAsDocument": { "$$matchAsRoot": { diff --git a/source/open-telemetry/tests/transaction/core_api.yml b/source/open-telemetry/tests/transaction/core_api.yml index 11d14e1958..2523d87293 100644 --- a/source/open-telemetry/tests/transaction/core_api.yml +++ b/source/open-telemetry/tests/transaction/core_api.yml @@ -71,6 +71,8 @@ tests: server.port: { $$type: ['long', 'string'] } server.type: { $$type: string } db.query.summary: insert transaction-tests.test + db.mongodb.lsid: { $$sessionLsid: *session0 } + db.mongodb.txn_number: 1 db.query.text: $$matchAsDocument: $$matchAsRoot: @@ -81,7 +83,6 @@ tests: autocommit: false documents: - _id: 1 - db.mongodb.lsid: { $$sessionLsid: *session0 } - name: commitTransaction admin attributes: db.system: mongodb @@ -96,6 +97,8 @@ tests: db.collection.name: { $$exists: false } db.query.summary: commitTransaction admin db.command.name: commitTransaction + db.mongodb.lsid: { $$sessionLsid: *session0 } + db.mongodb.txn_number: 1 db.query.text: $$matchAsDocument: $$matchAsRoot: @@ -164,6 +167,8 @@ tests: server.port: { $$type: ['long', 'string'] } server.type: { $$type: string } db.query.summary: insert transaction-tests.test + db.mongodb.lsid: { $$sessionLsid: *session0 } + db.mongodb.txn_number: 1 db.query.text: $$matchAsDocument: $$matchAsRoot: @@ -174,7 +179,6 @@ tests: autocommit: false documents: - _id: 1 - db.mongodb.lsid: { $$sessionLsid: *session0 } - name: abortTransaction admin attributes: db.system: mongodb @@ -189,6 +193,8 @@ tests: db.collection.name: { $$exists: false } db.query.summary: abortTransaction admin db.command.name: abortTransaction + db.mongodb.lsid: { $$sessionLsid: *session0 } + db.mongodb.txn_number: 1 db.query.text: $$matchAsDocument: $$matchAsRoot: @@ -200,4 +206,3 @@ tests: - collectionName: test databaseName: transaction-tests documents: [] - From 99f7ed3c976060146071919e0283b425c46de756 Mon Sep 17 00:00:00 2001 From: Dmitry Rybakov <160598371+comandeo-mongo@users.noreply.github.com> Date: Tue, 16 Sep 2025 16:00:06 +0200 Subject: [PATCH 51/62] Update source/open-telemetry/tests/operation/atlas_search.yml Co-authored-by: Jeremy Mikola --- source/open-telemetry/tests/operation/atlas_search.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/open-telemetry/tests/operation/atlas_search.yml b/source/open-telemetry/tests/operation/atlas_search.yml index ae88278367..a342f246fc 100644 --- a/source/open-telemetry/tests/operation/atlas_search.yml +++ b/source/open-telemetry/tests/operation/atlas_search.yml @@ -35,7 +35,7 @@ tests: arguments: model: { definition: { mappings: { dynamic: true } } , type: 'search' } expectError: - # This test always errors in a non-Atlas environment. The test functions as a unit test by asserting + # This test always errors in a non-Atlas environment. The test functions as a unit test by asserting # that the driver constructs and sends the correct command. # The expected error message was changed in SERVER-83003. Check for the substring "Atlas" shared by both error messages. isError: true From 50966ddf5174b18d65e046b1643af74177d84a37 Mon Sep 17 00:00:00 2001 From: Nabil Hachicha Date: Wed, 17 Sep 2025 12:31:31 +0100 Subject: [PATCH 52/62] Tests formating --- .../open-telemetry/tests/cursor/cursor.json | 293 ------------------ source/open-telemetry/tests/cursor/cursor.yml | 129 -------- .../tests/operation/aggregate.yml | 10 +- .../tests/operation/atlas_search.json | 2 +- .../tests/operation/atlas_search.yml | 8 +- .../tests/operation/bulk_write.json | 2 +- .../tests/operation/bulk_write.yml | 8 +- .../open-telemetry/tests/operation/count.yml | 6 +- .../tests/operation/create_collection.yml | 6 +- .../tests/operation/create_indexes.json | 2 +- .../tests/operation/create_indexes.yml | 8 +- .../tests/operation/create_view.json | 2 +- .../tests/operation/create_view.yml | 8 +- .../open-telemetry/tests/operation/delete.yml | 2 +- .../tests/operation/distinct.yml | 6 +- .../tests/operation/drop_collection.yml | 6 +- .../tests/operation/drop_indexes.yml | 6 +- .../open-telemetry/tests/operation/find.yml | 6 +- .../tests/operation/find_and_modify.json | 2 +- .../tests/operation/find_and_modify.yml | 10 +- .../tests/operation/find_retries.json | 4 +- .../tests/operation/find_retries.yml | 44 +-- .../open-telemetry/tests/operation/insert.yml | 2 +- .../tests/operation/list_collections.json | 2 +- .../tests/operation/list_collections.yml | 8 +- .../tests/operation/list_databases.json | 2 +- .../tests/operation/list_databases.yml | 8 +- .../tests/operation/list_indexes.json | 2 +- .../tests/operation/list_indexes.yml | 10 +- .../tests/operation/map_reduce.yml | 6 +- .../tests/operation/retries.json | 2 +- .../tests/operation/retries.yml | 46 +-- .../open-telemetry/tests/operation/update.yml | 2 +- 33 files changed, 119 insertions(+), 541 deletions(-) delete mode 100644 source/open-telemetry/tests/cursor/cursor.json delete mode 100644 source/open-telemetry/tests/cursor/cursor.yml diff --git a/source/open-telemetry/tests/cursor/cursor.json b/source/open-telemetry/tests/cursor/cursor.json deleted file mode 100644 index 9b3cc80163..0000000000 --- a/source/open-telemetry/tests/cursor/cursor.json +++ /dev/null @@ -1,293 +0,0 @@ -{ - "description": "cursor retrieval", - "schemaVersion": "1.26", - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": false, - "observeTracingMessages": { - "enableCommandPayload": true - } - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "cursor" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "test" - } - } - ], - "initialData": [ - { - "collectionName": "test", - "databaseName": "cursor", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - }, - { - "_id": 3 - }, - { - "_id": 4 - }, - { - "_id": 5 - }, - { - "_id": 6 - } - ] - } - ], - "tests": [ - { - "description": "find with a cursor", - "operations": [ - { - "name": "find", - "object": "collection0", - "arguments": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "batchSize": 2 - }, - "expectResult": [ - { - "_id": 2 - }, - { - "_id": 3 - }, - { - "_id": 4 - }, - { - "_id": 5 - }, - { - "_id": 6 - } - ] - } - ], - "expectTracingMessages": [ - { - "client": "client0", - "ignoreExtraSpans": false, - "spans": [ - { - "name": "find cursor.test", - "attributes": { - "db.system": "mongodb", - "db.namespace": "cursor", - "db.collection.name": "test", - "db.operation.name": "find", - "db.operation.summary": "find cursor.test" - }, - "nested": [ - { - "name": "find", - "attributes": { - "db.system": "mongodb", - "db.namespace": "cursor", - "db.collection.name": "test", - "db.command.name": "find", - "network.transport": "tcp", - "db.mongodb.cursor_id": { - "$$exists": false - }, - "db.response.status_code": { - "$$exists": false - }, - "exception.message": { - "$$exists": false - }, - "exception.type": { - "$$exists": false - }, - "exception.stacktrace": { - "$$exists": false - }, - "server.address": { - "$$type": "string" - }, - "server.port": { - "$$type": [ - "int", - "long" - ] - }, - "db.query.summary": "find cursor.test", - "db.query.text": { - "$$matchAsDocument": { - "$$matchAsRoot": { - "find": "test", - "filter": { - "_id": { - "$gt": 1 - } - }, - "batchSize": 2 - } - } - }, - "db.mongodb.server_connection_id": { - "$$type": [ - "int", - "long" - ] - }, - "db.mongodb.driver_connection_id": { - "$$type": [ - "int", - "long" - ] - } - } - }, - { - "name": "getMore", - "attributes": { - "db.system": "mongodb", - "db.namespace": "cursor", - "db.collection.name": "test", - "db.command.name": "getMore", - "network.transport": "tcp", - "db.mongodb.cursor_id": { - "$$type": [ - "int", - "long" - ] - }, - "db.response.status_code": { - "$$exists": false - }, - "exception.message": { - "$$exists": false - }, - "exception.type": { - "$$exists": false - }, - "exception.stacktrace": { - "$$exists": false - }, - "server.address": { - "$$type": "string" - }, - "server.port": { - "$$type": [ - "int", - "long" - ] - }, - "db.query.summary": "getMore cursor.test", - "db.query.text": { - "$$matchAsDocument": { - "$$matchAsRoot": { - "getMore": { - "$$type": "long" - }, - "collection": "test", - "batchSize": 2 - } - } - }, - "db.mongodb.server_connection_id": { - "$$type": [ - "int", - "long" - ] - }, - "db.mongodb.driver_connection_id": { - "$$type": [ - "int", - "long" - ] - } - } - }, - { - "name": "getMore", - "attributes": { - "db.system": "mongodb", - "db.namespace": "cursor", - "db.collection.name": "test", - "db.command.name": "getMore", - "network.transport": "tcp", - "db.mongodb.cursor_id": { - "$$type": [ - "int", - "long" - ] - }, - "db.response.status_code": { - "$$exists": false - }, - "exception.message": { - "$$exists": false - }, - "exception.type": { - "$$exists": false - }, - "exception.stacktrace": { - "$$exists": false - }, - "server.address": { - "$$type": "string" - }, - "server.port": { - "$$type": [ - "int", - "long" - ] - }, - "db.query.summary": "getMore cursor.test", - "db.query.text": { - "$$matchAsDocument": { - "$$matchAsRoot": { - "getMore": { - "$$type": "long" - }, - "collection": "test", - "batchSize": 2 - } - } - }, - "db.mongodb.server_connection_id": { - "$$type": [ - "int", - "long" - ] - }, - "db.mongodb.driver_connection_id": { - "$$type": [ - "int", - "long" - ] - } - } - } - ] - } - ] - } - ] - } - ] -} diff --git a/source/open-telemetry/tests/cursor/cursor.yml b/source/open-telemetry/tests/cursor/cursor.yml deleted file mode 100644 index a2b0041304..0000000000 --- a/source/open-telemetry/tests/cursor/cursor.yml +++ /dev/null @@ -1,129 +0,0 @@ -description: cursor retrieval -schemaVersion: '1.26' -createEntities: - - client: - id: &client0 client0 - useMultipleMongoses: false - observeTracingMessages: - enableCommandPayload: true - - database: - id: &database0 database0 - client: *client0 - databaseName: cursor - - collection: - id: &collection0 collection0 - database: *database0 - collectionName: &collectionName0 test -initialData: - - collectionName: test - databaseName: cursor - documents: - - { _id: 1 } - - { _id: 2 } - - { _id: 3 } - - { _id: 4 } - - { _id: 5 } - - { _id: 6 } -tests: - - description: find with a cursor - operations: - - name: find - object: *collection0 - arguments: - filter: { _id: { $gt: 1 } } - batchSize: 2 - expectResult: - - { _id: 2 } - - { _id: 3 } - - { _id: 4 } - - { _id: 5 } - - { _id: 6 } - expectTracingMessages: - - client: *client0 - ignoreExtraSpans: false - spans: - - name: find cursor.test - attributes: - db.system: mongodb - db.namespace: cursor - db.collection.name: test - db.operation.name: find - db.operation.summary: find cursor.test - nested: - - name: find - attributes: - db.system: mongodb - db.namespace: cursor - db.collection.name: *collectionName0 - db.command.name: find - network.transport: tcp - db.mongodb.cursor_id: { $$exists: false } - db.response.status_code: { $$exists: false } - exception.message: { $$exists: false } - exception.type: { $$exists: false } - exception.stacktrace: { $$exists: false } - server.address: { $$type: string } - server.port: { $$type: ['int', 'long'] } - db.query.summary: find cursor.test - db.query.text: - $$matchAsDocument: - $$matchAsRoot: - find: test - filter: { _id: { $gt: 1 } } - batchSize: 2 - db.mongodb.server_connection_id: - $$type: [ 'int', 'long' ] - db.mongodb.driver_connection_id: - $$type: [ 'int', 'long' ] - - - name: getMore - attributes: - db.system: mongodb - db.namespace: cursor - db.collection.name: *collectionName0 - db.command.name: getMore - network.transport: tcp - db.mongodb.cursor_id: { $$type: [ 'int', 'long' ] } - db.response.status_code: { $$exists: false } - exception.message: { $$exists: false } - exception.type: { $$exists: false } - exception.stacktrace: { $$exists: false } - server.address: { $$type: string } - server.port: { $$type: ['int', 'long'] } - db.query.summary: getMore cursor.test - db.query.text: - $$matchAsDocument: - $$matchAsRoot: - getMore: { $$type: long } - collection: test - batchSize: 2 - db.mongodb.server_connection_id: - $$type: [ 'int', 'long' ] - db.mongodb.driver_connection_id: - $$type: [ 'int', 'long' ] - - - name: getMore - attributes: - db.system: mongodb - db.namespace: cursor - db.collection.name: *collectionName0 - db.command.name: getMore - network.transport: tcp - db.mongodb.cursor_id: { $$type: [ 'int', 'long' ] } - db.response.status_code: { $$exists: false } - exception.message: { $$exists: false } - exception.type: { $$exists: false } - exception.stacktrace: { $$exists: false } - server.address: { $$type: string } - server.port: { $$type: ['int', 'long'] } - db.query.summary: getMore cursor.test - db.query.text: - $$matchAsDocument: - $$matchAsRoot: - getMore: { $$type: long } - collection: test - batchSize: 2 - db.mongodb.server_connection_id: - $$type: [ 'int', 'long' ] - db.mongodb.driver_connection_id: - $$type: [ 'int', 'long' ] diff --git a/source/open-telemetry/tests/operation/aggregate.yml b/source/open-telemetry/tests/operation/aggregate.yml index d8e91387fa..4ff85e8fcb 100644 --- a/source/open-telemetry/tests/operation/aggregate.yml +++ b/source/open-telemetry/tests/operation/aggregate.yml @@ -21,7 +21,7 @@ tests: - name: aggregate object: *collection0 arguments: - pipeline: &pipeline1 + pipeline: &pipeline0 - $match: { _id: 1 } expectTracingMessages: @@ -49,14 +49,14 @@ tests: exception.type: { $$exists: false } exception.stacktrace: { $$exists: false } server.address: { $$type: string } - server.port: { $$type: ['int', 'long'] } + server.port: { $$type: [int, long] } db.query.summary: aggregate operation-aggregate.test db.query.text: $$matchAsDocument: $$matchAsRoot: aggregate: test - pipeline: *pipeline1 + pipeline: *pipeline0 db.mongodb.server_connection_id: - $$type: [ 'int', 'long' ] + $$type: [ int, long ] db.mongodb.driver_connection_id: - $$type: [ 'int', 'long' ] + $$type: [ int, long ] diff --git a/source/open-telemetry/tests/operation/atlas_search.json b/source/open-telemetry/tests/operation/atlas_search.json index 0774355213..9a2e6a5099 100644 --- a/source/open-telemetry/tests/operation/atlas_search.json +++ b/source/open-telemetry/tests/operation/atlas_search.json @@ -1,5 +1,5 @@ { - "description": "operation atlas search", + "description": "operation atlas_search", "schemaVersion": "1.26", "createEntities": [ { diff --git a/source/open-telemetry/tests/operation/atlas_search.yml b/source/open-telemetry/tests/operation/atlas_search.yml index a342f246fc..11f5fa7dd5 100644 --- a/source/open-telemetry/tests/operation/atlas_search.yml +++ b/source/open-telemetry/tests/operation/atlas_search.yml @@ -1,4 +1,4 @@ -description: operation atlas search +description: operation atlas_search schemaVersion: '1.26' createEntities: - client: @@ -82,7 +82,7 @@ tests: db.namespace: operation-atlas-search db.collection.name: test server.address: { $$type: string } - server.port: { $$type: [ 'long', 'string' ] } + server.port: { $$type: [ long, string ] } server.type: { $$type: string } db.query.summary: createSearchIndexes operation-atlas-search.test db.query.text: @@ -105,7 +105,7 @@ tests: db.namespace: operation-atlas-search db.collection.name: test server.address: { $$type: string } - server.port: { $$type: [ 'long', 'string' ] } + server.port: { $$type: [ long, string ] } server.type: { $$type: string } db.query.summary: updateSearchIndex operation-atlas-search.test db.query.text: @@ -129,7 +129,7 @@ tests: db.namespace: operation-atlas-search db.collection.name: test server.address: { $$type: string } - server.port: { $$type: [ 'long', 'string' ] } + server.port: { $$type: [ long, string ] } server.type: { $$type: string } db.query.summary: dropSearchIndex operation-atlas-search.test db.query.text: diff --git a/source/open-telemetry/tests/operation/bulk_write.json b/source/open-telemetry/tests/operation/bulk_write.json index 8b4ef65b4c..79f29dd9c0 100644 --- a/source/open-telemetry/tests/operation/bulk_write.json +++ b/source/open-telemetry/tests/operation/bulk_write.json @@ -1,5 +1,5 @@ { - "description": "operation bulkwrite", + "description": "operation bulk_write", "schemaVersion": "1.26", "runOnRequirements": [ { diff --git a/source/open-telemetry/tests/operation/bulk_write.yml b/source/open-telemetry/tests/operation/bulk_write.yml index e6f212f4c3..f56f62f2b7 100644 --- a/source/open-telemetry/tests/operation/bulk_write.yml +++ b/source/open-telemetry/tests/operation/bulk_write.yml @@ -1,4 +1,4 @@ -description: operation bulkwrite +description: operation bulk_write schemaVersion: '1.26' runOnRequirements: - minServerVersion: "8.0" @@ -96,7 +96,7 @@ tests: exception.type: { $$exists: false } exception.stacktrace: { $$exists: false } server.address: { $$type: string } - server.port: { $$type: [ 'int', 'long' ] } + server.port: { $$type: [ int, long ] } server.type: { $$type: string } db.query.summary: bulkWrite admin db.query.text: @@ -194,6 +194,6 @@ tests: } ] db.mongodb.server_connection_id: - $$type: [ 'int', 'long' ] + $$type: [ int, long ] db.mongodb.driver_connection_id: - $$type: [ 'int', 'long' ] + $$type: [ int, long ] diff --git a/source/open-telemetry/tests/operation/count.yml b/source/open-telemetry/tests/operation/count.yml index d9e4956987..d217249da1 100644 --- a/source/open-telemetry/tests/operation/count.yml +++ b/source/open-telemetry/tests/operation/count.yml @@ -51,13 +51,13 @@ tests: exception.type: { $$exists: false } exception.stacktrace: { $$exists: false } server.address: { $$type: string } - server.port: { $$type: ['int', 'long'] } + server.port: { $$type: [int, long] } db.query.summary: count operation-count.test db.query.text: $$matchAsDocument: $$matchAsRoot: count: test db.mongodb.server_connection_id: - $$type: [ 'int', 'long' ] + $$type: [ int, long ] db.mongodb.driver_connection_id: - $$type: [ 'int', 'long' ] + $$type: [ int, long ] diff --git a/source/open-telemetry/tests/operation/create_collection.yml b/source/open-telemetry/tests/operation/create_collection.yml index e0f8ae9b72..05a6dd55ac 100644 --- a/source/open-telemetry/tests/operation/create_collection.yml +++ b/source/open-telemetry/tests/operation/create_collection.yml @@ -43,13 +43,13 @@ tests: exception.type: { $$exists: false } exception.stacktrace: { $$exists: false } server.address: { $$type: string } - server.port: { $$type: ['int', 'long'] } + server.port: { $$type: [int, long] } db.query.summary: create operation-create-collection.newlyCreatedCollection db.query.text: $$matchAsDocument: $$matchAsRoot: create: newlyCreatedCollection db.mongodb.server_connection_id: - $$type: [ 'int', 'long' ] + $$type: [ int, long ] db.mongodb.driver_connection_id: - $$type: [ 'int', 'long' ] + $$type: [ int, long ] diff --git a/source/open-telemetry/tests/operation/create_indexes.json b/source/open-telemetry/tests/operation/create_indexes.json index 1fe66ca54a..40324871ac 100644 --- a/source/open-telemetry/tests/operation/create_indexes.json +++ b/source/open-telemetry/tests/operation/create_indexes.json @@ -1,5 +1,5 @@ { - "description": "operation create indexes", + "description": "operation create_indexes", "schemaVersion": "1.26", "createEntities": [ { diff --git a/source/open-telemetry/tests/operation/create_indexes.yml b/source/open-telemetry/tests/operation/create_indexes.yml index 377d331d7b..4b67f2a654 100644 --- a/source/open-telemetry/tests/operation/create_indexes.yml +++ b/source/open-telemetry/tests/operation/create_indexes.yml @@ -1,4 +1,4 @@ -description: operation create indexes +description: operation create_indexes schemaVersion: '1.26' createEntities: - client: @@ -47,7 +47,7 @@ tests: exception.type: { $$exists: false } exception.stacktrace: { $$exists: false } server.address: { $$type: string } - server.port: { $$type: ['int', 'long'] } + server.port: { $$type: [int, long] } db.query.summary: createIndexes operation-create-indexes.test db.query.text: $$matchAsDocument: @@ -55,6 +55,6 @@ tests: createIndexes: test indexes: [ { key: { x: 1 }, name: "x_1" } ] db.mongodb.server_connection_id: - $$type: [ 'int', 'long' ] + $$type: [ int, long ] db.mongodb.driver_connection_id: - $$type: [ 'int', 'long' ] + $$type: [ int, long ] diff --git a/source/open-telemetry/tests/operation/create_view.json b/source/open-telemetry/tests/operation/create_view.json index 3ef4e55eda..b7ada8ca64 100644 --- a/source/open-telemetry/tests/operation/create_view.json +++ b/source/open-telemetry/tests/operation/create_view.json @@ -1,5 +1,5 @@ { - "description": "operation create view", + "description": "operation create_view", "schemaVersion": "1.26", "createEntities": [ { diff --git a/source/open-telemetry/tests/operation/create_view.yml b/source/open-telemetry/tests/operation/create_view.yml index 9cc656cf44..b7fa6cdaea 100644 --- a/source/open-telemetry/tests/operation/create_view.yml +++ b/source/open-telemetry/tests/operation/create_view.yml @@ -1,4 +1,4 @@ -description: operation create view +description: operation create_view schemaVersion: '1.26' createEntities: - client: @@ -50,7 +50,7 @@ tests: exception.type: { $$exists: false } exception.stacktrace: { $$exists: false } server.address: { $$type: string } - server.port: { $$type: ['int', 'long'] } + server.port: { $$type: [int, long] } server.type: { $$type: string } db.query.summary: create operation-create-view.my_view db.query.text: @@ -60,6 +60,6 @@ tests: viewOn: test pipeline: *pipeline db.mongodb.server_connection_id: - $$type: [ 'int', 'long' ] + $$type: [ int, long ] db.mongodb.driver_connection_id: - $$type: [ 'int', 'long' ] + $$type: [ int, long ] diff --git a/source/open-telemetry/tests/operation/delete.yml b/source/open-telemetry/tests/operation/delete.yml index b931393bd8..ad36f1069c 100644 --- a/source/open-telemetry/tests/operation/delete.yml +++ b/source/open-telemetry/tests/operation/delete.yml @@ -41,7 +41,7 @@ tests: db.namespace: operation-delete db.collection.name: test server.address: { $$type: string } - server.port: { $$type: [ 'long', 'string' ] } + server.port: { $$type: [ long, string ] } db.query.summary: delete operation-delete.test db.query.text: $$matchAsDocument: diff --git a/source/open-telemetry/tests/operation/distinct.yml b/source/open-telemetry/tests/operation/distinct.yml index 0cdaaf1760..3f4b2e0add 100644 --- a/source/open-telemetry/tests/operation/distinct.yml +++ b/source/open-telemetry/tests/operation/distinct.yml @@ -52,7 +52,7 @@ tests: exception.type: { $$exists: false } exception.stacktrace: { $$exists: false } server.address: { $$type: string } - server.port: { $$type: ['int', 'long'] } + server.port: { $$type: [int, long] } db.query.summary: distinct operation-distinct.test db.query.text: $$matchAsDocument: @@ -61,6 +61,6 @@ tests: key: x query: { } db.mongodb.server_connection_id: - $$type: [ 'int', 'long' ] + $$type: [ int, long ] db.mongodb.driver_connection_id: - $$type: [ 'int', 'long' ] + $$type: [ int, long ] diff --git a/source/open-telemetry/tests/operation/drop_collection.yml b/source/open-telemetry/tests/operation/drop_collection.yml index 1b8ea70809..eda6516af5 100644 --- a/source/open-telemetry/tests/operation/drop_collection.yml +++ b/source/open-telemetry/tests/operation/drop_collection.yml @@ -48,13 +48,13 @@ tests: exception.type: { $$exists: false } exception.stacktrace: { $$exists: false } server.address: { $$type: string } - server.port: { $$type: ['int', 'long'] } + server.port: { $$type: [int, long] } db.query.summary: drop operation-drop-collection.test db.query.text: $$matchAsDocument: $$matchAsRoot: drop: test db.mongodb.server_connection_id: - $$type: [ 'int', 'long' ] + $$type: [ int, long ] db.mongodb.driver_connection_id: - $$type: [ 'int', 'long' ] + $$type: [ int, long ] diff --git a/source/open-telemetry/tests/operation/drop_indexes.yml b/source/open-telemetry/tests/operation/drop_indexes.yml index ab6aa82910..d6526e347f 100644 --- a/source/open-telemetry/tests/operation/drop_indexes.yml +++ b/source/open-telemetry/tests/operation/drop_indexes.yml @@ -65,7 +65,7 @@ tests: exception.type: { $$exists: false } exception.stacktrace: { $$exists: false } server.address: { $$type: string } - server.port: { $$type: ['int', 'long'] } + server.port: { $$type: [int, long] } db.query.summary: dropIndexes operation-drop-indexes.test db.query.text: $$matchAsDocument: @@ -73,6 +73,6 @@ tests: dropIndexes: test index: '*' db.mongodb.server_connection_id: - $$type: [ 'int', 'long' ] + $$type: [ int, long ] db.mongodb.driver_connection_id: - $$type: [ 'int', 'long' ] + $$type: [ int, long ] diff --git a/source/open-telemetry/tests/operation/find.yml b/source/open-telemetry/tests/operation/find.yml index 2d0a943db9..cee9fdb04d 100644 --- a/source/open-telemetry/tests/operation/find.yml +++ b/source/open-telemetry/tests/operation/find.yml @@ -50,7 +50,7 @@ tests: exception.type: { $$exists: false } exception.stacktrace: { $$exists: false } server.address: { $$type: string } - server.port: { $$type: ['int', 'long'] } + server.port: { $$type: [int, long] } server.type: { $$type: string } db.query.summary: find operation-find.test db.query.text: @@ -60,6 +60,6 @@ tests: filter: x: 1 db.mongodb.server_connection_id: - $$type: [ 'int', 'long' ] + $$type: [ int, long ] db.mongodb.driver_connection_id: - $$type: [ 'int', 'long' ] + $$type: [ int, long ] diff --git a/source/open-telemetry/tests/operation/find_and_modify.json b/source/open-telemetry/tests/operation/find_and_modify.json index d3541ea056..03ae750fc1 100644 --- a/source/open-telemetry/tests/operation/find_and_modify.json +++ b/source/open-telemetry/tests/operation/find_and_modify.json @@ -1,5 +1,5 @@ { - "description": "operation findOneAndUpdate", + "description": "operation find_one_and_update", "schemaVersion": "1.26", "createEntities": [ { diff --git a/source/open-telemetry/tests/operation/find_and_modify.yml b/source/open-telemetry/tests/operation/find_and_modify.yml index 32721492cb..fd6a589981 100644 --- a/source/open-telemetry/tests/operation/find_and_modify.yml +++ b/source/open-telemetry/tests/operation/find_and_modify.yml @@ -1,4 +1,4 @@ -description: operation findOneAndUpdate +description: operation find_one_and_update schemaVersion: '1.26' createEntities: - client: @@ -24,7 +24,7 @@ tests: filter: &filter _id: 1 update: &update - - $set: {x: 5 } + - $set: { x: 5 } comment: "comment" expectTracingMessages: @@ -52,7 +52,7 @@ tests: exception.type: { $$exists: false } exception.stacktrace: { $$exists: false } server.address: { $$type: string } - server.port: { $$type: ['int', 'long'] } + server.port: { $$type: [ int, long ] } db.query.summary: findAndModify operation-aggregate.test db.query.text: $$matchAsDocument: @@ -62,6 +62,6 @@ tests: update: *update comment: "comment" db.mongodb.server_connection_id: - $$type: [ 'int', 'long' ] + $$type: [ int, long ] db.mongodb.driver_connection_id: - $$type: [ 'int', 'long' ] + $$type: [ int, long ] diff --git a/source/open-telemetry/tests/operation/find_retries.json b/source/open-telemetry/tests/operation/find_retries.json index 1d1f4a582d..8220bb0450 100644 --- a/source/open-telemetry/tests/operation/find_retries.json +++ b/source/open-telemetry/tests/operation/find_retries.json @@ -1,5 +1,5 @@ { - "description": "operation find retrying failed command", + "description": "operation find_retries", "schemaVersion": "1.26", "createEntities": [ { @@ -35,7 +35,7 @@ ], "tests": [ { - "description": "find an element", + "description": "find an element retrying failed command", "operations": [ { "name": "failPoint", diff --git a/source/open-telemetry/tests/operation/find_retries.yml b/source/open-telemetry/tests/operation/find_retries.yml index e3d2984596..9a5bc22ada 100644 --- a/source/open-telemetry/tests/operation/find_retries.yml +++ b/source/open-telemetry/tests/operation/find_retries.yml @@ -1,4 +1,4 @@ -description: operation find retrying failed command +description: operation find_retries schemaVersion: '1.26' createEntities: - client: @@ -17,26 +17,26 @@ createEntities: initialData: - collectionName: test databaseName: operation-find-retries - documents: [] + documents: [ ] tests: - - description: find an element + - description: find an element retrying failed command operations: - - name: failPoint - object: testRunner - arguments: - client: *client0 - failPoint: - configureFailPoint: failCommand - mode: { times: 1 } - data: - failCommands: [ find ] - errorCode: 89 - errorLabels: [ RetryableWriteError ] + - name: failPoint + object: testRunner + arguments: + client: *client0 + failPoint: + configureFailPoint: failCommand + mode: { times: 1 } + data: + failCommands: [ find ] + errorCode: 89 + errorLabels: [ RetryableWriteError ] - - name: find - object: *collection0 - arguments: - filter: { x: 1 } + - name: find + object: *collection0 + arguments: + filter: { x: 1 } expectTracingMessages: - client: *client0 ignoreExtraSpans: true @@ -62,7 +62,7 @@ tests: exception.type: { $$type: string } exception.stacktrace: { $$type: string } server.address: { $$type: string } - server.port: { $$type: ['long', 'string'] } + server.port: { $$type: [ 'long', 'string' ] } server.type: { $$type: string } db.query.summary: find operation-find-retries.test db.query.text: @@ -88,7 +88,7 @@ tests: exception.type: { $$exists: false } exception.stacktrace: { $$exists: false } server.address: { $$type: string } - server.port: { $$type: ['int', 'long'] } + server.port: { $$type: [ int, long ] } server.type: { $$type: string } db.query.summary: find operation-find-retries.test db.query.text: @@ -98,6 +98,6 @@ tests: filter: x: 1 db.mongodb.server_connection_id: - $$type: [ 'int', 'long' ] + $$type: [ int, long ] db.mongodb.driver_connection_id: - $$type: [ 'int', 'long' ] + $$type: [ int, long ] diff --git a/source/open-telemetry/tests/operation/insert.yml b/source/open-telemetry/tests/operation/insert.yml index 7e220426e8..90a89e7ae0 100644 --- a/source/open-telemetry/tests/operation/insert.yml +++ b/source/open-telemetry/tests/operation/insert.yml @@ -42,7 +42,7 @@ tests: db.system: mongodb db.namespace: operation-insert server.address: { $$type: string } - server.port: { $$type: [ 'long', 'string' ] } + server.port: { $$type: [ long, string ] } server.type: { $$type: string } db.query.summary: insert operation-insert.test db.query.text: diff --git a/source/open-telemetry/tests/operation/list_collections.json b/source/open-telemetry/tests/operation/list_collections.json index 1b88bcb659..ed065fbbef 100644 --- a/source/open-telemetry/tests/operation/list_collections.json +++ b/source/open-telemetry/tests/operation/list_collections.json @@ -1,5 +1,5 @@ { - "description": "operation list collections", + "description": "operation list_collections", "schemaVersion": "1.26", "createEntities": [ { diff --git a/source/open-telemetry/tests/operation/list_collections.yml b/source/open-telemetry/tests/operation/list_collections.yml index 1796722277..9ee3cf55c8 100644 --- a/source/open-telemetry/tests/operation/list_collections.yml +++ b/source/open-telemetry/tests/operation/list_collections.yml @@ -1,4 +1,4 @@ -description: operation list collections +description: operation list_collections schemaVersion: '1.26' createEntities: - client: @@ -39,7 +39,7 @@ tests: exception.type: { $$exists: false } exception.stacktrace: { $$exists: false } server.address: { $$type: string } - server.port: { $$type: ['int', 'long'] } + server.port: { $$type: [ int, long ] } db.query.summary: listCollections operation-list-collections db.query.text: $$matchAsDocument: @@ -47,6 +47,6 @@ tests: listCollections: 1 cursor: {} db.mongodb.server_connection_id: - $$type: [ 'int', 'long' ] + $$type: [ int, long ] db.mongodb.driver_connection_id: - $$type: [ 'int', 'long' ] + $$type: [ int, long ] diff --git a/source/open-telemetry/tests/operation/list_databases.json b/source/open-telemetry/tests/operation/list_databases.json index 12ad82a559..2f61bde046 100644 --- a/source/open-telemetry/tests/operation/list_databases.json +++ b/source/open-telemetry/tests/operation/list_databases.json @@ -1,5 +1,5 @@ { - "description": "operation list databases", + "description": "operation list_databases", "schemaVersion": "1.26", "createEntities": [ { diff --git a/source/open-telemetry/tests/operation/list_databases.yml b/source/open-telemetry/tests/operation/list_databases.yml index f453b86052..3b350a5aa9 100644 --- a/source/open-telemetry/tests/operation/list_databases.yml +++ b/source/open-telemetry/tests/operation/list_databases.yml @@ -1,4 +1,4 @@ -description: operation list databases +description: operation list_databases schemaVersion: '1.26' createEntities: - client: @@ -36,13 +36,13 @@ tests: exception.type: { $$exists: false } exception.stacktrace: { $$exists: false } server.address: { $$type: string } - server.port: { $$type: ['int', 'long'] } + server.port: { $$type: [ int, long ] } db.query.summary: listDatabases admin db.query.text: $$matchAsDocument: $$matchAsRoot: listDatabases: 1 db.mongodb.server_connection_id: - $$type: [ 'int', 'long' ] + $$type: [ int, long ] db.mongodb.driver_connection_id: - $$type: [ 'int', 'long' ] + $$type: [ int, long ] diff --git a/source/open-telemetry/tests/operation/list_indexes.json b/source/open-telemetry/tests/operation/list_indexes.json index 487f630c1c..1482ca721f 100644 --- a/source/open-telemetry/tests/operation/list_indexes.json +++ b/source/open-telemetry/tests/operation/list_indexes.json @@ -1,5 +1,5 @@ { - "description": "operation list indexes", + "description": "operation list_indexes", "schemaVersion": "1.26", "createEntities": [ { diff --git a/source/open-telemetry/tests/operation/list_indexes.yml b/source/open-telemetry/tests/operation/list_indexes.yml index ee3865c4e4..8df75dc50d 100644 --- a/source/open-telemetry/tests/operation/list_indexes.yml +++ b/source/open-telemetry/tests/operation/list_indexes.yml @@ -1,4 +1,4 @@ -description: operation list indexes +description: operation list_indexes schemaVersion: '1.26' createEntities: - client: @@ -17,7 +17,7 @@ createEntities: initialData: - collectionName: test databaseName: operation-list-indexes - documents: [] + documents: [ ] tests: - description: List indexes operations: @@ -49,13 +49,13 @@ tests: exception.type: { $$exists: false } exception.stacktrace: { $$exists: false } server.address: { $$type: string } - server.port: { $$type: ['int', 'long'] } + server.port: { $$type: [ int, long ] } db.query.summary: listIndexes operation-list-indexes.test db.query.text: $$matchAsDocument: $$matchAsRoot: listIndexes: test db.mongodb.server_connection_id: - $$type: [ 'int', 'long' ] + $$type: [ int, long ] db.mongodb.driver_connection_id: - $$type: [ 'int', 'long' ] + $$type: [ int, long ] diff --git a/source/open-telemetry/tests/operation/map_reduce.yml b/source/open-telemetry/tests/operation/map_reduce.yml index 99168cea8a..09c0e393f4 100644 --- a/source/open-telemetry/tests/operation/map_reduce.yml +++ b/source/open-telemetry/tests/operation/map_reduce.yml @@ -83,7 +83,7 @@ tests: exception.type: { $$exists: false } exception.stacktrace: { $$exists: false } server.address: { $$type: string } - server.port: { $$type: [ 'int', 'long' ] } + server.port: { $$type: [ int, long ] } server.type: { $$type: string } db.query.summary: mapReduce operation-map-reduce.test db.query.text: @@ -94,6 +94,6 @@ tests: reduce: { $code: 'function sum(key, values) { return values.reduce((acc, x) => acc + x); }' } out: { inline: 1 } db.mongodb.server_connection_id: - $$type: [ 'int', 'long' ] + $$type: [ int, long ] db.mongodb.driver_connection_id: - $$type: [ 'int', 'long' ] + $$type: [ int, long ] diff --git a/source/open-telemetry/tests/operation/retries.json b/source/open-telemetry/tests/operation/retries.json index bb95c953ae..9e0584540f 100644 --- a/source/open-telemetry/tests/operation/retries.json +++ b/source/open-telemetry/tests/operation/retries.json @@ -1,5 +1,5 @@ { - "description": "retrying failed command", + "description": "retries", "schemaVersion": "1.26", "createEntities": [ { diff --git a/source/open-telemetry/tests/operation/retries.yml b/source/open-telemetry/tests/operation/retries.yml index fcc4b8f3cc..6faa9df24b 100644 --- a/source/open-telemetry/tests/operation/retries.yml +++ b/source/open-telemetry/tests/operation/retries.yml @@ -1,4 +1,4 @@ -description: retrying failed command +description: retries schemaVersion: '1.26' createEntities: - client: @@ -20,26 +20,26 @@ createEntities: initialData: - collectionName: test databaseName: operation-find-retries - documents: [] + documents: [ ] tests: - description: find an element with retries operations: - - name: failPoint - object: testRunner - arguments: - client: *failPointClient - failPoint: - configureFailPoint: failCommand - mode: { times: 1 } - data: - failCommands: [ find ] - errorCode: 89 - errorLabels: [ RetryableWriteError ] + - name: failPoint + object: testRunner + arguments: + client: *failPointClient + failPoint: + configureFailPoint: failCommand + mode: { times: 1 } + data: + failCommands: [ find ] + errorCode: 89 + errorLabels: [ RetryableWriteError ] - - name: find - object: *collection0 - arguments: - filter: { x: 1 } + - name: find + object: *collection0 + arguments: + filter: { x: 1 } expectTracingMessages: - client: *client0 @@ -66,7 +66,7 @@ tests: exception.type: { $$exists: true } exception.stacktrace: { $$exists: true } server.address: { $$type: string } - server.port: { $$type: ['long', 'string'] } + server.port: { $$type: [ long, string ] } db.query.summary: find operation-find-retries.test db.query.text: $$matchAsDocument: @@ -75,9 +75,9 @@ tests: filter: x: 1 db.mongodb.server_connection_id: - $$type: [ 'int', 'long' ] + $$type: [ int, long ] db.mongodb.driver_connection_id: - $$type: [ 'int', 'long' ] + $$type: [ int, long ] - name: find attributes: db.system: mongodb @@ -91,7 +91,7 @@ tests: exception.type: { $$exists: false } exception.stacktrace: { $$exists: false } server.address: { $$type: string } - server.port: { $$type: ['int', 'long'] } + server.port: { $$type: [ int, long ] } db.query.summary: find operation-find-retries.test db.query.text: $$matchAsDocument: @@ -100,6 +100,6 @@ tests: filter: x: 1 db.mongodb.server_connection_id: - $$type: [ 'int', 'long' ] + $$type: [ int, long ] db.mongodb.driver_connection_id: - $$type: [ 'int', 'long' ] + $$type: [ int, long ] diff --git a/source/open-telemetry/tests/operation/update.yml b/source/open-telemetry/tests/operation/update.yml index 0a7a33295d..3f06b53d50 100644 --- a/source/open-telemetry/tests/operation/update.yml +++ b/source/open-telemetry/tests/operation/update.yml @@ -42,7 +42,7 @@ tests: db.system: mongodb db.namespace: operation-update server.address: { $$type: string } - server.port: { $$type: [ 'long', 'string' ] } + server.port: { $$type: [ long, string ] } db.query.summary: update operation-update.test db.query.text: $$matchAsDocument: From 39863b0808b84d0c58f53cdba8bc9b3619794d05 Mon Sep 17 00:00:00 2001 From: Nabil Hachicha Date: Wed, 17 Sep 2025 12:51:16 +0100 Subject: [PATCH 53/62] Fix linting --- source/open-telemetry/tests/README.md | 4 ++-- source/unified-test-format/unified-test-format.md | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/source/open-telemetry/tests/README.md b/source/open-telemetry/tests/README.md index c3d14f6c93..fb213f0207 100644 --- a/source/open-telemetry/tests/README.md +++ b/source/open-telemetry/tests/README.md @@ -20,8 +20,8 @@ createEntities: enableCommandPayload: true ``` -These tests require the ability to collect tracing [spans](../open-telemetry.md#span) data in a structured form as -described in the +These tests require the ability to collect tracing [spans](../open-telemetry.md) data in a structured form as described +in the [Unified Test Format specification.expectTracingMessages](../../unified-test-format/unified-test-format.md#expectTracingMessages). For example the Java driver uses [Micrometer](https://jira.mongodb.org/browse/JAVA-5732) to collect tracing spans. diff --git a/source/unified-test-format/unified-test-format.md b/source/unified-test-format/unified-test-format.md index 067a4e91c1..59700ff510 100644 --- a/source/unified-test-format/unified-test-format.md +++ b/source/unified-test-format/unified-test-format.md @@ -785,8 +785,8 @@ The structure of this object is as follows: -- `expectTracingMessages`: Optional object that defines expected tracing - [spans](../open-telemetry/open-telemetry.md#span) for a test. The structure of this object is as follows: +- `expectTracingMessages`: Optional object that defines expected tracing [spans](../open-telemetry/open-telemetry.md) + for a test. The structure of this object is as follows: - `client`: Required string. The ID of the client entity associated with these tracing spans. From 92bea1077d732893cd90902443b13260ef80e3ea Mon Sep 17 00:00:00 2001 From: Nabil Hachicha Date: Thu, 18 Sep 2025 10:33:00 +0100 Subject: [PATCH 54/62] Adding prose tests description --- source/open-telemetry/tests/README.md | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/source/open-telemetry/tests/README.md b/source/open-telemetry/tests/README.md index fb213f0207..8a94bfc3b4 100644 --- a/source/open-telemetry/tests/README.md +++ b/source/open-telemetry/tests/README.md @@ -32,3 +32,29 @@ expectTracingMessages: spans: ... ``` + +### Prose Tests + +*Test 1: Tracing Enable/Disable via Environment Variable* + +1. Set the environment variable `OTEL_#{LANG}_INSTRUMENTATION_MONGODB_ENABLED` to `false`. +2. Create a `MongoClient` without explicitly enabling tracing. +3. Perform a database operation (e.g., `find()` on a test collection). +4. Assert that no OpenTelemetry tracing spans are emitted for the operation. +5. Set the environment variable `OTEL_#{LANG}_INSTRUMENTATION_MONGODB_ENABLED` to `true`. +6. Create a new `MongoClient` without explicitly enabling tracing. +7. Perform the same database operation. +8. Assert that OpenTelemetry tracing spans are emitted for the operation. + +*Test 2: Command Payload Emission via Environment Variable* + +1. Set the environment variable `OTEL_#{LANG}_INSTRUMENTATION_MONGODB_QUERY_TEXT_MAX_LENGTH` to `true`. +2. Set the environment variable `OTEL_#{LANG}_INSTRUMENTATION_MONGODB_QUERY_TEXT_MAX_LENGTH` to a positive integer + (e.g., 100). +3. Create a `MongoClient` without explicitly enabling command payload emission. +4. Perform a database operation (e.g., `find()`). +5. Assert that the emitted tracing span includes the `db.query.text` attribute. +6. Unset the environment variable `OTEL_#{LANG}_INSTRUMENTATION_MONGODB_QUERY_TEXT_MAX_LENGTH`. +7. Create a new `MongoClient`. +8. Perform the same database operation. +9. Assert that the emitted tracing span does not include the `db.query.text` attribute. From e2d5ead08f00a39ab2a2e331828cf37ceeaa0e33 Mon Sep 17 00:00:00 2001 From: Nabil Hachicha Date: Thu, 18 Sep 2025 10:56:00 +0100 Subject: [PATCH 55/62] Folding find_reties test under find --- .../open-telemetry/tests/operation/find.json | 174 ++++++++++++++ .../open-telemetry/tests/operation/find.yml | 83 +++++++ .../tests/operation/find_retries.json | 212 ------------------ .../tests/operation/find_retries.yml | 103 --------- 4 files changed, 257 insertions(+), 315 deletions(-) delete mode 100644 source/open-telemetry/tests/operation/find_retries.json delete mode 100644 source/open-telemetry/tests/operation/find_retries.yml diff --git a/source/open-telemetry/tests/operation/find.json b/source/open-telemetry/tests/operation/find.json index 933fd434f2..53dfcb1d24 100644 --- a/source/open-telemetry/tests/operation/find.json +++ b/source/open-telemetry/tests/operation/find.json @@ -127,6 +127,180 @@ ] } ] + }, + { + "description": "find an element retrying failed command", + "operations": [ + { + "name": "failPoint", + "object": "testRunner", + "arguments": { + "client": "client0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "find" + ], + "errorCode": 89, + "errorLabels": [ + "RetryableWriteError" + ] + } + } + } + }, + { + "name": "find", + "object": "collection0", + "arguments": { + "filter": { + "x": 1 + } + } + } + ], + "expectTracingMessages": [ + { + "client": "client0", + "ignoreExtraSpans": true, + "spans": [ + { + "name": "find operation-find.test", + "attributes": { + "db.system": "mongodb", + "db.namespace": "operation-find", + "db.collection.name": "test", + "db.operation.name": "find", + "db.operation.summary": "find operation-find.test" + }, + "nested": [ + { + "name": "find", + "attributes": { + "db.system": "mongodb", + "db.namespace": "operation-find", + "db.collection.name": "test", + "db.command.name": "find", + "network.transport": "tcp", + "db.mongodb.cursor_id": { + "$$exists": false + }, + "db.response.status_code": "89", + "exception.message": { + "$$type": "string" + }, + "exception.type": { + "$$type": "string" + }, + "exception.stacktrace": { + "$$type": "string" + }, + "server.address": { + "$$type": "string" + }, + "server.port": { + "$$type": [ + "long", + "string" + ] + }, + "server.type": { + "$$type": "string" + }, + "db.query.summary": "find operation-find.test", + "db.query.text": { + "$$matchAsDocument": { + "$$matchAsRoot": { + "find": "test", + "filter": { + "x": 1 + } + } + } + }, + "db.mongodb.server_connection_id": { + "$$type": [ + "int", + "long" + ] + }, + "db.mongodb.driver_connection_id": { + "$$type": [ + "int", + "long" + ] + } + } + }, + { + "name": "find", + "attributes": { + "db.system": "mongodb", + "db.namespace": "operation-find", + "db.collection.name": "test", + "db.command.name": "find", + "network.transport": "tcp", + "db.mongodb.cursor_id": { + "$$exists": false + }, + "db.response.status_code": { + "$$exists": false + }, + "exception.message": { + "$$exists": false + }, + "exception.type": { + "$$exists": false + }, + "exception.stacktrace": { + "$$exists": false + }, + "server.address": { + "$$type": "string" + }, + "server.port": { + "$$type": [ + "int", + "long" + ] + }, + "server.type": { + "$$type": "string" + }, + "db.query.summary": "find operation-find.test", + "db.query.text": { + "$$matchAsDocument": { + "$$matchAsRoot": { + "find": "test", + "filter": { + "x": 1 + } + } + } + }, + "db.mongodb.server_connection_id": { + "$$type": [ + "int", + "long" + ] + }, + "db.mongodb.driver_connection_id": { + "$$type": [ + "int", + "long" + ] + } + } + } + ] + } + ] + } + ] } ] } diff --git a/source/open-telemetry/tests/operation/find.yml b/source/open-telemetry/tests/operation/find.yml index 38936fc0f9..82f42b90cf 100644 --- a/source/open-telemetry/tests/operation/find.yml +++ b/source/open-telemetry/tests/operation/find.yml @@ -63,3 +63,86 @@ tests: $$type: [ int, long ] db.mongodb.driver_connection_id: $$type: [ int, long ] + + - description: find an element retrying failed command + operations: + - name: failPoint + object: testRunner + arguments: + client: *client0 + failPoint: + configureFailPoint: failCommand + mode: { times: 1 } + data: + failCommands: [ find ] + errorCode: 89 + errorLabels: [ RetryableWriteError ] + + - name: find + object: *collection0 + arguments: + filter: { x: 1 } + expectTracingMessages: + - client: *client0 + ignoreExtraSpans: true + spans: + - name: find operation-find.test + attributes: + db.system: mongodb + db.namespace: operation-find + db.collection.name: test + db.operation.name: find + db.operation.summary: find operation-find.test + nested: + - name: find + attributes: + db.system: mongodb + db.namespace: operation-find + db.collection.name: test + db.command.name: find + network.transport: tcp + db.mongodb.cursor_id: { $$exists: false } + db.response.status_code: '89' + exception.message: { $$type: string } + exception.type: { $$type: string } + exception.stacktrace: { $$type: string } + server.address: { $$type: string } + server.port: { $$type: [ long, string ] } + server.type: { $$type: string } + db.query.summary: find operation-find.test + db.query.text: + $$matchAsDocument: + $$matchAsRoot: + find: test + filter: + x: 1 + db.mongodb.server_connection_id: + $$type: [ int, long ] + db.mongodb.driver_connection_id: + $$type: [ int, long ] + - name: find + attributes: + db.system: mongodb + db.namespace: operation-find + db.collection.name: test + db.command.name: find + network.transport: tcp + db.mongodb.cursor_id: { $$exists: false } + db.response.status_code: { $$exists: false } + exception.message: { $$exists: false } + exception.type: { $$exists: false } + exception.stacktrace: { $$exists: false } + server.address: { $$type: string } + server.port: { $$type: [ int, long ] } + server.type: { $$type: string } + db.query.summary: find operation-find.test + db.query.text: + $$matchAsDocument: + $$matchAsRoot: + find: test + filter: + x: 1 + db.mongodb.server_connection_id: + $$type: [ int, long ] + db.mongodb.driver_connection_id: + $$type: [ int, long ] diff --git a/source/open-telemetry/tests/operation/find_retries.json b/source/open-telemetry/tests/operation/find_retries.json deleted file mode 100644 index f946ba580b..0000000000 --- a/source/open-telemetry/tests/operation/find_retries.json +++ /dev/null @@ -1,212 +0,0 @@ -{ - "description": "operation find_retries", - "schemaVersion": "1.27", - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": false, - "observeTracingMessages": { - "enableCommandPayload": true - } - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "operation-find-retries" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "test" - } - } - ], - "initialData": [ - { - "collectionName": "test", - "databaseName": "operation-find-retries", - "documents": [] - } - ], - "tests": [ - { - "description": "find an element retrying failed command", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "find" - ], - "errorCode": 89, - "errorLabels": [ - "RetryableWriteError" - ] - } - } - } - }, - { - "name": "find", - "object": "collection0", - "arguments": { - "filter": { - "x": 1 - } - } - } - ], - "expectTracingMessages": [ - { - "client": "client0", - "ignoreExtraSpans": true, - "spans": [ - { - "name": "find operation-find-retries.test", - "attributes": { - "db.system": "mongodb", - "db.namespace": "operation-find-retries", - "db.collection.name": "test", - "db.operation.name": "find", - "db.operation.summary": "find operation-find-retries.test" - }, - "nested": [ - { - "name": "find", - "attributes": { - "db.system": "mongodb", - "db.namespace": "operation-find-retries", - "db.collection.name": "test", - "db.command.name": "find", - "network.transport": "tcp", - "db.mongodb.cursor_id": { - "$$exists": false - }, - "db.response.status_code": "89", - "exception.message": { - "$$type": "string" - }, - "exception.type": { - "$$type": "string" - }, - "exception.stacktrace": { - "$$type": "string" - }, - "server.address": { - "$$type": "string" - }, - "server.port": { - "$$type": [ - "long", - "string" - ] - }, - "server.type": { - "$$type": "string" - }, - "db.query.summary": "find operation-find-retries.test", - "db.query.text": { - "$$matchAsDocument": { - "$$matchAsRoot": { - "find": "test", - "filter": { - "x": 1 - } - } - } - }, - "db.mongodb.server_connection_id": { - "$$type": [ - "int", - "long" - ] - }, - "db.mongodb.driver_connection_id": { - "$$type": [ - "int", - "long" - ] - } - } - }, - { - "name": "find", - "attributes": { - "db.system": "mongodb", - "db.namespace": "operation-find-retries", - "db.collection.name": "test", - "db.command.name": "find", - "network.transport": "tcp", - "db.mongodb.cursor_id": { - "$$exists": false - }, - "db.response.status_code": { - "$$exists": false - }, - "exception.message": { - "$$exists": false - }, - "exception.type": { - "$$exists": false - }, - "exception.stacktrace": { - "$$exists": false - }, - "server.address": { - "$$type": "string" - }, - "server.port": { - "$$type": [ - "int", - "long" - ] - }, - "server.type": { - "$$type": "string" - }, - "db.query.summary": "find operation-find-retries.test", - "db.query.text": { - "$$matchAsDocument": { - "$$matchAsRoot": { - "find": "test", - "filter": { - "x": 1 - } - } - } - }, - "db.mongodb.server_connection_id": { - "$$type": [ - "int", - "long" - ] - }, - "db.mongodb.driver_connection_id": { - "$$type": [ - "int", - "long" - ] - } - } - } - ] - } - ] - } - ] - } - ] -} diff --git a/source/open-telemetry/tests/operation/find_retries.yml b/source/open-telemetry/tests/operation/find_retries.yml deleted file mode 100644 index 0ba793488d..0000000000 --- a/source/open-telemetry/tests/operation/find_retries.yml +++ /dev/null @@ -1,103 +0,0 @@ -description: operation find_retries -schemaVersion: '1.27' -createEntities: - - client: - id: &client0 client0 - useMultipleMongoses: false - observeTracingMessages: - enableCommandPayload: true - - database: - id: &database0 database0 - client: *client0 - databaseName: operation-find-retries - - collection: - id: &collection0 collection0 - database: *database0 - collectionName: test -initialData: - - collectionName: test - databaseName: operation-find-retries - documents: [ ] -tests: - - description: find an element retrying failed command - operations: - - name: failPoint - object: testRunner - arguments: - client: *client0 - failPoint: - configureFailPoint: failCommand - mode: { times: 1 } - data: - failCommands: [ find ] - errorCode: 89 - errorLabels: [ RetryableWriteError ] - - - name: find - object: *collection0 - arguments: - filter: { x: 1 } - expectTracingMessages: - - client: *client0 - ignoreExtraSpans: true - spans: - - name: find operation-find-retries.test - attributes: - db.system: mongodb - db.namespace: operation-find-retries - db.collection.name: test - db.operation.name: find - db.operation.summary: find operation-find-retries.test - nested: - - name: find - attributes: - db.system: mongodb - db.namespace: operation-find-retries - db.collection.name: test - db.command.name: find - network.transport: tcp - db.mongodb.cursor_id: { $$exists: false } - db.response.status_code: '89' - exception.message: { $$type: string } - exception.type: { $$type: string } - exception.stacktrace: { $$type: string } - server.address: { $$type: string } - server.port: { $$type: [ 'long', 'string' ] } - server.type: { $$type: string } - db.query.summary: find operation-find-retries.test - db.query.text: - $$matchAsDocument: - $$matchAsRoot: - find: test - filter: - x: 1 - db.mongodb.server_connection_id: - $$type: [ 'int', 'long' ] - db.mongodb.driver_connection_id: - $$type: [ 'int', 'long' ] - - name: find - attributes: - db.system: mongodb - db.namespace: operation-find-retries - db.collection.name: test - db.command.name: find - network.transport: tcp - db.mongodb.cursor_id: { $$exists: false } - db.response.status_code: { $$exists: false } - exception.message: { $$exists: false } - exception.type: { $$exists: false } - exception.stacktrace: { $$exists: false } - server.address: { $$type: string } - server.port: { $$type: [ int, long ] } - server.type: { $$type: string } - db.query.summary: find operation-find-retries.test - db.query.text: - $$matchAsDocument: - $$matchAsRoot: - find: test - filter: - x: 1 - db.mongodb.server_connection_id: - $$type: [ int, long ] - db.mongodb.driver_connection_id: - $$type: [ int, long ] From 80ae25fa9099b12b643bf8ebe0c0fd8d3643235a Mon Sep 17 00:00:00 2001 From: Dmitry Rybakov Date: Thu, 18 Sep 2025 10:56:04 +0100 Subject: [PATCH 56/62] Clarify configuration options --- source/open-telemetry/open-telemetry.md | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/source/open-telemetry/open-telemetry.md b/source/open-telemetry/open-telemetry.md index 8fbd21b86b..11870c9995 100644 --- a/source/open-telemetry/open-telemetry.md +++ b/source/open-telemetry/open-telemetry.md @@ -57,7 +57,7 @@ Drivers MAY add a dependency to the corresponding OpenTelemetry API. This is the OpenTelemetry in libraries. Alternatively, drivers can implement OpenTelemetry support using any suitable tools within the driver ecosystem. Drivers MUST NOT add a dependency to OpenTelemetry SDK. -#### Enabling and Disabling OpenTelemetry +#### Enabling, Disabling, and Configuring OpenTelemetry OpenTelemetry SHOULD be disabled by default. @@ -76,6 +76,28 @@ Drivers SHOULD support configuring OpenTelemetry on multiple levels. Ruby), and a driver can detect this, OpenTelemetry SHOULD be enabled in the driver. Drivers MUST NOT try to detect whether the OpenTelemetry SDK library is available, and enable tracing based on this. +Drivers MUST NOT add means that configure OpenTelemetry SDK (e.g., setting a specific exporter). Drivers MUST NOT add +means that configure OpenTelemetry on the host application level (e.g., setting a specific sampler). + +##### `MongoClient` Options for configuring OpenTelemetry on the client level + +Drivers SHOULD add new options to `MongoClient` for configuring OpenTelemetry as described above. These options SHOULD +be a dictionary that groups all OpenTelemetry-related options, the name of the dictionary SHOULD be `tracing`. The +dictionary SHOULD contain at least the following options: + +- `enabled`: A boolean that enables or disables OpenTelemetry for this `MongoClient` instance. Default is `false` (i.e., + use the driver-level setting). +- `query_text_max_length`: An integer that sets the maximum length of the `db.query.text` attribute of command spans. + Default is `0` (i.e., do not add the attribute). + +#### Environment Variables for configuring OpenTelemetry + +Drivers SHOULD support configuration of OpenTelemetry on the driver level via at least the following environment +variables: + +- `OTEL_#{LANG}_INSTRUMENTATION_MONGODB_ENABLED`: enables OpenTelemetry when set to `1`, `true`, `yes`. +- `OTEL_#{LANG}_INSTRUMENTATION_MONGODB_QUERY_TEXT_MAX_LENGTH`: An integer that sets the maximum length of the + `db.query.text` attribute of command spans. Default is `0` (i.e., do not add the attribute). #### Tracer Attributes From 682d6b81b02436ac6822506a4b0938d301982016 Mon Sep 17 00:00:00 2001 From: Dmitry Rybakov Date: Thu, 18 Sep 2025 11:27:53 +0100 Subject: [PATCH 57/62] Address code review remarks --- source/open-telemetry/open-telemetry.md | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/source/open-telemetry/open-telemetry.md b/source/open-telemetry/open-telemetry.md index 11870c9995..14deb03718 100644 --- a/source/open-telemetry/open-telemetry.md +++ b/source/open-telemetry/open-telemetry.md @@ -301,7 +301,7 @@ If the command returns a cursor, or uses a cursor, the `cursor_id` attribute SHO ##### Exceptions If the server command fails with an exception, drivers MUST record an exception to the current command span. When -recording an exception, drivers SHOULD add the following attributes to the span, when the content for the attribute if +recording an exception, drivers SHOULD add the following attributes to the span, when the content for the attribute is available: - `exception.message` @@ -371,3 +371,20 @@ disable it completely. ## Security Implication Drivers MUST take care to avoid exposing sensitive information (e.g. authentication credentials) in traces. + +## Future Work + +### Query Parametrization + +It might be beneficial to implement query parametrization for the `db.query.text` attribute. This means that drivers +replace literal values in queries with placeholders. For example, the query + +```json +{ find: "users", filter: { age: { $gt: 30 } } } +``` + +will be transformed to + +```json +{ find: "users", filter: { age: { $gt: "?" } } } +``` From 5fa16faae1c2e2f2b7d5e601a152631b196a6eec Mon Sep 17 00:00:00 2001 From: Dmitry Rybakov Date: Thu, 18 Sep 2025 13:12:18 +0100 Subject: [PATCH 58/62] Add tests for client configuration --- source/open-telemetry/tests/README.md | 4 +- .../operation/find_without_query_text.json | 113 ++++++++++++++++++ .../operation/find_without_query_text.yml | 56 +++++++++ .../tests/operation/find_without_tracing.json | 56 +++++++++ .../tests/operation/find_without_tracing.yml | 30 +++++ 5 files changed, 257 insertions(+), 2 deletions(-) create mode 100644 source/open-telemetry/tests/operation/find_without_query_text.json create mode 100644 source/open-telemetry/tests/operation/find_without_query_text.yml create mode 100644 source/open-telemetry/tests/operation/find_without_tracing.json create mode 100644 source/open-telemetry/tests/operation/find_without_tracing.yml diff --git a/source/open-telemetry/tests/README.md b/source/open-telemetry/tests/README.md index 8a94bfc3b4..99bcc8d293 100644 --- a/source/open-telemetry/tests/README.md +++ b/source/open-telemetry/tests/README.md @@ -48,9 +48,9 @@ expectTracingMessages: *Test 2: Command Payload Emission via Environment Variable* -1. Set the environment variable `OTEL_#{LANG}_INSTRUMENTATION_MONGODB_QUERY_TEXT_MAX_LENGTH` to `true`. +1. Set the environment variable `OTEL_#{LANG}_INSTRUMENTATION_MONGODB_ENABLED` to `true`. 2. Set the environment variable `OTEL_#{LANG}_INSTRUMENTATION_MONGODB_QUERY_TEXT_MAX_LENGTH` to a positive integer - (e.g., 100). + (e.g., 1024). 3. Create a `MongoClient` without explicitly enabling command payload emission. 4. Perform a database operation (e.g., `find()`). 5. Assert that the emitted tracing span includes the `db.query.text` attribute. diff --git a/source/open-telemetry/tests/operation/find_without_query_text.json b/source/open-telemetry/tests/operation/find_without_query_text.json new file mode 100644 index 0000000000..df50865cef --- /dev/null +++ b/source/open-telemetry/tests/operation/find_without_query_text.json @@ -0,0 +1,113 @@ +{ + "description": "operation find without db.query.text", + "schemaVersion": "1.27", + "createEntities": [ + { + "client": { + "id": "client0", + "useMultipleMongoses": false, + "observeTracingMessages": { + "enableCommandPayload": false + } + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "operation-find" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "test" + } + } + ], + "initialData": [ + { + "collectionName": "test", + "databaseName": "operation-find", + "documents": [] + } + ], + "tests": [ + { + "description": "find an element", + "operations": [ + { + "name": "find", + "object": "collection0", + "arguments": { + "filter": { + "x": 1 + } + } + } + ], + "expectTracingMessages": [ + { + "client": "client0", + "ignoreExtraSpans": false, + "spans": [ + { + "name": "find operation-find.test", + "attributes": { + "db.system": "mongodb", + "db.namespace": "operation-find", + "db.collection.name": "test", + "db.operation.name": "find", + "db.operation.summary": "find operation-find.test" + }, + "nested": [ + { + "name": "find", + "attributes": { + "db.system": "mongodb", + "db.namespace": "operation-find", + "db.collection.name": "test", + "db.command.name": "find", + "network.transport": "tcp", + "db.mongodb.cursor_id": { + "$$exists": false + }, + "db.response.status_code": { + "$$exists": false + }, + "exception.message": { + "$$exists": false + }, + "exception.type": { + "$$exists": false + }, + "exception.stacktrace": { + "$$exists": false + }, + "server.address": { + "$$type": "string" + }, + "server.port": { + "$$type": [ + "int", + "long" + ] + }, + "server.type": { + "$$type": "string" + }, + "db.query.summary": "find operation-find.test", + "db.query.text": { + "$$exists": false + } + } + } + ] + } + ] + } + ] + } + ] +} diff --git a/source/open-telemetry/tests/operation/find_without_query_text.yml b/source/open-telemetry/tests/operation/find_without_query_text.yml new file mode 100644 index 0000000000..26b53b979d --- /dev/null +++ b/source/open-telemetry/tests/operation/find_without_query_text.yml @@ -0,0 +1,56 @@ +description: operation find without db.query.text +schemaVersion: '1.27' +createEntities: + - client: + id: &client0 client0 + useMultipleMongoses: false + observeTracingMessages: + enableCommandPayload: false + - database: + id: &database0 database0 + client: *client0 + databaseName: operation-find + - collection: + id: &collection0 collection0 + database: database0 + collectionName: &collection0Name test +initialData: + - collectionName: test + databaseName: operation-find + documents: [] +tests: + - description: find an element + operations: + - name: find + object: *collection0 + arguments: { filter: { x: 1 } } + + expectTracingMessages: + - client: *client0 + ignoreExtraSpans: false + spans: + - name: find operation-find.test + attributes: + db.system: mongodb + db.namespace: operation-find + db.collection.name: test + db.operation.name: find + db.operation.summary: find operation-find.test + nested: + - name: find + attributes: + db.system: mongodb + db.namespace: operation-find + db.collection.name: test + db.command.name: find + network.transport: tcp + db.mongodb.cursor_id: { $$exists: false } + db.response.status_code: { $$exists: false } + exception.message: { $$exists: false } + exception.type: { $$exists: false } + exception.stacktrace: { $$exists: false } + server.address: { $$type: string } + server.port: { $$type: [int, long] } + server.type: { $$type: string } + db.query.summary: find operation-find.test + db.query.text: { $$exists: false } diff --git a/source/open-telemetry/tests/operation/find_without_tracing.json b/source/open-telemetry/tests/operation/find_without_tracing.json new file mode 100644 index 0000000000..8155230e0b --- /dev/null +++ b/source/open-telemetry/tests/operation/find_without_tracing.json @@ -0,0 +1,56 @@ +{ + "description": "operation find without tracing", + "schemaVersion": "1.27", + "createEntities": [ + { + "client": { + "id": "client0", + "useMultipleMongoses": false + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "operation-find" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "test" + } + } + ], + "initialData": [ + { + "collectionName": "test", + "databaseName": "operation-find", + "documents": [] + } + ], + "tests": [ + { + "description": "find an element", + "operations": [ + { + "name": "find", + "object": "collection0", + "arguments": { + "filter": { + "x": 1 + } + } + } + ], + "expectTracingMessages": [ + { + "client": "client0", + "ignoreExtraSpans": false, + "spans": [] + } + ] + } + ] +} diff --git a/source/open-telemetry/tests/operation/find_without_tracing.yml b/source/open-telemetry/tests/operation/find_without_tracing.yml new file mode 100644 index 0000000000..a23e8acaba --- /dev/null +++ b/source/open-telemetry/tests/operation/find_without_tracing.yml @@ -0,0 +1,30 @@ +description: operation find without tracing +schemaVersion: '1.27' +createEntities: + # Tracing is disabled by default. + - client: + id: &client0 client0 + useMultipleMongoses: false + - database: + id: &database0 database0 + client: *client0 + databaseName: operation-find + - collection: + id: &collection0 collection0 + database: database0 + collectionName: &collection0Name test +initialData: + - collectionName: test + databaseName: operation-find + documents: [] +tests: + - description: find an element + operations: + - name: find + object: *collection0 + arguments: { filter: { x: 1 } } + + expectTracingMessages: + - client: *client0 + ignoreExtraSpans: false + spans: [] From 0895547be5bfe6279eec46cb9358154ae625df39 Mon Sep 17 00:00:00 2001 From: Dmitry Rybakov Date: Thu, 18 Sep 2025 13:39:33 +0100 Subject: [PATCH 59/62] Remove non compliats tests --- .../tests/operation/find_without_tracing.json | 56 ------------------- .../tests/operation/find_without_tracing.yml | 30 ---------- 2 files changed, 86 deletions(-) delete mode 100644 source/open-telemetry/tests/operation/find_without_tracing.json delete mode 100644 source/open-telemetry/tests/operation/find_without_tracing.yml diff --git a/source/open-telemetry/tests/operation/find_without_tracing.json b/source/open-telemetry/tests/operation/find_without_tracing.json deleted file mode 100644 index 8155230e0b..0000000000 --- a/source/open-telemetry/tests/operation/find_without_tracing.json +++ /dev/null @@ -1,56 +0,0 @@ -{ - "description": "operation find without tracing", - "schemaVersion": "1.27", - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": false - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "operation-find" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "test" - } - } - ], - "initialData": [ - { - "collectionName": "test", - "databaseName": "operation-find", - "documents": [] - } - ], - "tests": [ - { - "description": "find an element", - "operations": [ - { - "name": "find", - "object": "collection0", - "arguments": { - "filter": { - "x": 1 - } - } - } - ], - "expectTracingMessages": [ - { - "client": "client0", - "ignoreExtraSpans": false, - "spans": [] - } - ] - } - ] -} diff --git a/source/open-telemetry/tests/operation/find_without_tracing.yml b/source/open-telemetry/tests/operation/find_without_tracing.yml deleted file mode 100644 index a23e8acaba..0000000000 --- a/source/open-telemetry/tests/operation/find_without_tracing.yml +++ /dev/null @@ -1,30 +0,0 @@ -description: operation find without tracing -schemaVersion: '1.27' -createEntities: - # Tracing is disabled by default. - - client: - id: &client0 client0 - useMultipleMongoses: false - - database: - id: &database0 database0 - client: *client0 - databaseName: operation-find - - collection: - id: &collection0 collection0 - database: database0 - collectionName: &collection0Name test -initialData: - - collectionName: test - databaseName: operation-find - documents: [] -tests: - - description: find an element - operations: - - name: find - object: *collection0 - arguments: { filter: { x: 1 } } - - expectTracingMessages: - - client: *client0 - ignoreExtraSpans: false - spans: [] From d8ecaf0fe4eb7bc6b0ec1f09851df4a0a429d6d2 Mon Sep 17 00:00:00 2001 From: Dmitry Rybakov Date: Thu, 18 Sep 2025 19:03:47 +0100 Subject: [PATCH 60/62] Fix typos --- source/open-telemetry/open-telemetry.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source/open-telemetry/open-telemetry.md b/source/open-telemetry/open-telemetry.md index 14deb03718..854553fcf0 100644 --- a/source/open-telemetry/open-telemetry.md +++ b/source/open-telemetry/open-telemetry.md @@ -238,8 +238,8 @@ Spans SHOULD have the following attributes: | `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 | +| `db.mongodb.lsid` | `string` | Logical session id | Required if available | +| `db.mongodb.txn_number` | `int64` | Transaction number | Required if available | Besides the attributes listed in the table above, drivers MAY add other attributes from the [Semantic Conventions for Databases](https://opentelemetry.io/docs/specs/semconv/registry/attributes/db/) that are @@ -301,7 +301,7 @@ If the command returns a cursor, or uses a cursor, the `cursor_id` attribute SHO ##### Exceptions If the server command fails with an exception, drivers MUST record an exception to the current command span. When -recording an exception, drivers SHOULD add the following attributes to the span, when the content for the attribute is +recording an exception, drivers SHOULD add the following attributes to the span, when the content for the attribute if available: - `exception.message` From c9f1e94a4d588bb277d5981ba6ae875ed6e9baae Mon Sep 17 00:00:00 2001 From: Dmitry Rybakov Date: Fri, 19 Sep 2025 11:22:47 +0100 Subject: [PATCH 61/62] Address code review remarks --- source/open-telemetry/open-telemetry.md | 37 ++++- .../tests/operation/create_view.json | 140 ------------------ .../tests/operation/create_view.yml | 65 -------- 3 files changed, 32 insertions(+), 210 deletions(-) delete mode 100644 source/open-telemetry/tests/operation/create_view.json delete mode 100644 source/open-telemetry/tests/operation/create_view.yml diff --git a/source/open-telemetry/open-telemetry.md b/source/open-telemetry/open-telemetry.md index 854553fcf0..e70a3043a6 100644 --- a/source/open-telemetry/open-telemetry.md +++ b/source/open-telemetry/open-telemetry.md @@ -65,8 +65,8 @@ Drivers SHOULD support configuring OpenTelemetry on multiple levels. - **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`. + settings on higher levels. This configuration can be implemented with a `MongoClient` option. See + [Client Options](#client-options) section below. - **Driver Level**: Drivers SHOULD provide a global setting that enables or disables OpenTelemetry for all `MongoClient` instances (excluding those that explicitly override the setting). This configuration SHOULD be implemented with an environment variable `OTEL_#{LANG}_INSTRUMENTATION_MONGODB_ENABLED`. Drivers MAY provide other means to globally @@ -79,6 +79,8 @@ Drivers MUST NOT try to detect whether the OpenTelemetry SDK library is availabl Drivers MUST NOT add means that configure OpenTelemetry SDK (e.g., setting a specific exporter). Drivers MUST NOT add means that configure OpenTelemetry on the host application level (e.g., setting a specific sampler). + + ##### `MongoClient` Options for configuring OpenTelemetry on the client level Drivers SHOULD add new options to `MongoClient` for configuring OpenTelemetry as described above. These options SHOULD @@ -106,7 +108,9 @@ If a driver creates a Tracer using OpenTelemetry API, drivers MUST use the follo - `name`: A string that identifies the driver. It can be the name of a driver's component (e.g., "mongo", "PyMongo") or a package name (e.g., "com.mongo.Driver"). Drivers SHOULD select a name that is idiomatic for their language and ecosystem. Drivers SHOULD follow the Instrumentation Scope guidance. -- `version`: The version of the driver. +- `version`: A string that represents internal driver version. The version formatting is not defined; drivers SHOULD + apply the same formatting as the use for `client.driver.version` attribute of the + [handshake](https://github.com/mongodb/specifications/blob/master/source/mongodb-handshake/handshake.md#clientdriverversion). #### Instrumenting Driver Operations @@ -176,6 +180,11 @@ Examples: - `abortTransaction` → `admin` - client `bulkWrite` → `admin` +The name of this attribute is defined in the +[OpenTelemetry Specifications](https://opentelemetry.io/docs/specs/semconv/registry/attributes/db/#db-namespace). In +order to be compliant with these, we use this name even though the term `namespace` has a different +[meaning](https://www.mongodb.com/docs/manual/reference/glossary/) for MongoDB. + ###### db.collection.name This attribute should be set to the user's collection if the operation is executing against a collection, this field is @@ -258,6 +267,11 @@ Examples: - `abortTransaction` → `admin` - client `bulkWrite` → `admin` +The name of this attribute is defined in the +[OpenTelemetry Specifications](https://opentelemetry.io/docs/specs/semconv/registry/attributes/db/#db-namespace). In +order to be compliant with these, we use this name even though the term `namespace` has a different +[meaning](https://www.mongodb.com/docs/manual/reference/glossary/) for MongoDB. + ###### db.collection.name This attribute should be set to the user's collection if the operation is executing against a collection, this field is @@ -339,7 +353,6 @@ The OpenTelemetry specification covers all driver operations including but not l | `withTransaction` | [tests/transaction/convenient.yml](tests/transaction/convenient.yml) | | `createCollection` | [tests/operation/create_collection.yml](tests/operation/create_collection.yml) | | `createIndexes` | [tests/operation/create_indexes.yml](tests/operation/create_indexes.yml) | -| `createView` | [tests/operation/create_view.yml](tests/operation/create_view.yml) | | `distinct` | [tests/operation/distinct.yml](tests/operation/distinct.yml) | | `dropCollection` | [tests/operation/drop_collection.yml](tests/operation/drop_collection.yml) | | `dropIndexes` | [tests/operation/drop_indexes.yml](tests/operation/drop_indexes.yml) | @@ -370,7 +383,10 @@ disable it completely. ## Security Implication -Drivers MUST take care to avoid exposing sensitive information (e.g. authentication credentials) in traces. +Drivers MUST take care to avoid exposing sensitive information (e.g. authentication credentials) in traces. Drivers +SHOULD follow the +[Security](https://github.com/mongodb/specifications/blob/master/source/command-logging-and-monitoring/command-logging-and-monitoring.md#security) +guidance of the Command Logging and Monitoring spec. ## Future Work @@ -388,3 +404,14 @@ will be transformed to ```json { find: "users", filter: { age: { $gt: "?" } } } ``` + +## Design Rationale + +### No URI options + +Enabling tracing may have performance and security implications. Copying and using a connection string that enables +tracing may have unexpected negative outcome. + +Further, we already have two attributes that configure tracing, and we expect there might be more. + +A URI options can be added later if we realise our users need it, while the opposite is not easily accomplished. diff --git a/source/open-telemetry/tests/operation/create_view.json b/source/open-telemetry/tests/operation/create_view.json deleted file mode 100644 index b8b706f477..0000000000 --- a/source/open-telemetry/tests/operation/create_view.json +++ /dev/null @@ -1,140 +0,0 @@ -{ - "description": "operation create_view", - "schemaVersion": "1.27", - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": false, - "observeTracingMessages": { - "enableCommandPayload": true - } - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "operation-create-view" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "test" - } - } - ], - "tests": [ - { - "description": "create view", - "operations": [ - { - "name": "createCollection", - "object": "database0", - "arguments": { - "collection": "my_view", - "viewOn": "test", - "pipeline": [ - { - "$match": { - "_id": { - "$gt": 1 - } - } - } - ] - } - } - ], - "expectTracingMessages": [ - { - "client": "client0", - "ignoreExtraSpans": false, - "spans": [ - { - "name": "createView operation-create-view.my_view", - "attributes": { - "db.system": "mongodb", - "db.namespace": "operation-create-view", - "db.collection.name": "my_view", - "db.operation.name": "createView", - "db.operation.summary": "createView operation-create-view.my_view" - }, - "nested": [ - { - "name": "create", - "attributes": { - "db.system": "mongodb", - "db.namespace": "operation-create-view", - "db.collection.name": "my_view", - "db.command.name": "create", - "network.transport": "tcp", - "db.mongodb.cursor_id": { - "$$exists": false - }, - "db.response.status_code": { - "$$exists": false - }, - "exception.message": { - "$$exists": false - }, - "exception.type": { - "$$exists": false - }, - "exception.stacktrace": { - "$$exists": false - }, - "server.address": { - "$$type": "string" - }, - "server.port": { - "$$type": [ - "int", - "long" - ] - }, - "server.type": { - "$$type": "string" - }, - "db.query.summary": "create operation-create-view.my_view", - "db.query.text": { - "$$matchAsDocument": { - "$$matchAsRoot": { - "create": "my_view", - "viewOn": "test", - "pipeline": [ - { - "$match": { - "_id": { - "$gt": 1 - } - } - } - ] - } - } - }, - "db.mongodb.server_connection_id": { - "$$type": [ - "int", - "long" - ] - }, - "db.mongodb.driver_connection_id": { - "$$type": [ - "int", - "long" - ] - } - } - } - ] - } - ] - } - ] - } - ] -} diff --git a/source/open-telemetry/tests/operation/create_view.yml b/source/open-telemetry/tests/operation/create_view.yml deleted file mode 100644 index 73d0bddd55..0000000000 --- a/source/open-telemetry/tests/operation/create_view.yml +++ /dev/null @@ -1,65 +0,0 @@ -description: operation create_view -schemaVersion: '1.27' -createEntities: - - client: - id: &client0 client0 - useMultipleMongoses: false - observeTracingMessages: - enableCommandPayload: true - - database: - id: &database0 database0 - client: *client0 - databaseName: operation-create-view - - collection: - id: collection0 - database: *database0 - collectionName: &collection_name test -tests: - - description: create view - operations: - - name: createCollection - object: *database0 - arguments: - collection: my_view - viewOn: *collection_name - pipeline: &pipeline - - { $match: { _id: { $gt: 1 } } } - - expectTracingMessages: - - client: *client0 - ignoreExtraSpans: false - spans: - - name: createView operation-create-view.my_view - attributes: - db.system: mongodb - db.namespace: operation-create-view - db.collection.name: my_view - db.operation.name: createView - db.operation.summary: createView operation-create-view.my_view - nested: - - name: create - attributes: - db.system: mongodb - db.namespace: operation-create-view - db.collection.name: my_view - db.command.name: create - network.transport: tcp - db.mongodb.cursor_id: { $$exists: false } - db.response.status_code: { $$exists: false } - exception.message: { $$exists: false } - exception.type: { $$exists: false } - exception.stacktrace: { $$exists: false } - server.address: { $$type: string } - server.port: { $$type: [int, long] } - server.type: { $$type: string } - db.query.summary: create operation-create-view.my_view - db.query.text: - $$matchAsDocument: - $$matchAsRoot: - create: my_view - viewOn: test - pipeline: *pipeline - db.mongodb.server_connection_id: - $$type: [ int, long ] - db.mongodb.driver_connection_id: - $$type: [ int, long ] From b6e0eb9e26650132d138bf8d4a750b3f3bd52510 Mon Sep 17 00:00:00 2001 From: Dmitry Rybakov Date: Fri, 19 Sep 2025 15:00:33 +0100 Subject: [PATCH 62/62] Clarify query parametrization --- source/open-telemetry/open-telemetry.md | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/source/open-telemetry/open-telemetry.md b/source/open-telemetry/open-telemetry.md index e70a3043a6..0ab8ad8385 100644 --- a/source/open-telemetry/open-telemetry.md +++ b/source/open-telemetry/open-telemetry.md @@ -392,8 +392,9 @@ guidance of the Command Logging and Monitoring spec. ### Query Parametrization -It might be beneficial to implement query parametrization for the `db.query.text` attribute. This means that drivers -replace literal values in queries with placeholders. For example, the query +It might be beneficial to implement query parametrization for the `db.query.text` attribute. + +One might want to replace dynamic values in queries with placeholders. For example, the query ```json { find: "users", filter: { age: { $gt: 30 } } } @@ -405,6 +406,12 @@ will be transformed to { find: "users", filter: { age: { $gt: "?" } } } ``` +for purposes of obfuscating queries in traces 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 tracing, 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). + ## Design Rationale ### No URI options