Skip to content

Commit

Permalink
DRIVERS-2452 Add databaseName field to CommandFailedEvent and Command…
Browse files Browse the repository at this point in the history
…SucceededEvent (#1434)
  • Loading branch information
qingyang-hu authored Jun 21, 2023
1 parent a10e270 commit e7ee829
Show file tree
Hide file tree
Showing 10 changed files with 824 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,11 @@ See the `Load Balancer Specification <../load-balancers/load-balancers.rst#event
*/
commandName: String;
/**
* Returns the database name.
*/
databaseName: String;
/**
* Returns the driver generated request id.
*/
Expand Down Expand Up @@ -317,6 +322,11 @@ See the `Load Balancer Specification <../load-balancers/load-balancers.rst#event
*/
commandName: String;
/**
* Returns the database name.
*/
databaseName: String;
/**
* Returns the failure. Based on the language, this SHOULD be a message string, exception
* object, or error document.
Expand Down Expand Up @@ -560,3 +570,4 @@ Changelog
default port 27017 when relevant. Updated suggested unstructured forms of log messages to more
clearly label connection IDs and use more readable server address representations.
:2023-03-23: Updated ``serverConnectionId`` field to be Int64 as long-running servers can return Int64.
:2023-06-13: Added ``databaseName`` field to ``CommandFailedEvent`` and ``CommandSucceededEvent``.
26 changes: 17 additions & 9 deletions source/command-logging-and-monitoring/tests/monitoring/find.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"description": "find",
"schemaVersion": "1.1",
"schemaVersion": "1.15",
"createEntities": [
{
"client": {
Expand Down Expand Up @@ -103,7 +103,8 @@
]
}
},
"commandName": "find"
"commandName": "find",
"databaseName": "command-monitoring-tests"
}
}
]
Expand Down Expand Up @@ -198,7 +199,8 @@
]
}
},
"commandName": "find"
"commandName": "find",
"databaseName": "command-monitoring-tests"
}
}
]
Expand Down Expand Up @@ -262,7 +264,8 @@
]
}
},
"commandName": "find"
"commandName": "find",
"databaseName": "command-monitoring-tests"
}
}
]
Expand Down Expand Up @@ -338,7 +341,8 @@
]
}
},
"commandName": "find"
"commandName": "find",
"databaseName": "command-monitoring-tests"
}
},
{
Expand Down Expand Up @@ -376,7 +380,8 @@
]
}
},
"commandName": "getMore"
"commandName": "getMore",
"databaseName": "command-monitoring-tests"
}
}
]
Expand Down Expand Up @@ -464,7 +469,8 @@
]
}
},
"commandName": "find"
"commandName": "find",
"databaseName": "command-monitoring-tests"
}
},
{
Expand Down Expand Up @@ -498,7 +504,8 @@
]
}
},
"commandName": "getMore"
"commandName": "getMore",
"databaseName": "command-monitoring-tests"
}
}
]
Expand Down Expand Up @@ -539,7 +546,8 @@
},
{
"commandFailedEvent": {
"commandName": "find"
"commandName": "find",
"databaseName": "command-monitoring-tests"
}
}
]
Expand Down
10 changes: 9 additions & 1 deletion source/command-logging-and-monitoring/tests/monitoring/find.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
description: "find"

schemaVersion: "1.1"
schemaVersion: "1.15"

createEntities:
- client:
Expand Down Expand Up @@ -56,6 +56,7 @@ tests:
firstBatch:
- { _id: 1, x: 11 }
commandName: find
databaseName: *databaseName

- description: "A successful find with options"
operations:
Expand Down Expand Up @@ -98,6 +99,7 @@ tests:
- { x: 33 }
- { x: 22 }
commandName: find
databaseName: *databaseName

- description: "A successful find with showRecordId and returnKey"
operations:
Expand Down Expand Up @@ -131,6 +133,7 @@ tests:
- { _id: 4 }
- { _id: 5 }
commandName: find
databaseName: *databaseName

- description: "A successful find with a getMore"
operations:
Expand Down Expand Up @@ -162,6 +165,7 @@ tests:
- { _id: 2, x: 22 }
- { _id: 3, x: 33 }
commandName: find
databaseName: *databaseName
- commandStartedEvent:
command:
getMore: { $$type: [ int, long ] }
Expand All @@ -179,6 +183,7 @@ tests:
- { _id: 4, x: 44 }
- { _id: 5, x: 55 }
commandName: getMore
databaseName: *databaseName

- description: "A successful find event with a getmore and the server kills the cursor (<= 4.4)"
runOnRequirements:
Expand Down Expand Up @@ -216,6 +221,7 @@ tests:
- { _id: 2, x: 22 }
- { _id: 3, x: 33 }
commandName: find
databaseName: *databaseName
- commandStartedEvent:
command:
getMore: { $$type: [ int, long ] }
Expand All @@ -232,6 +238,7 @@ tests:
nextBatch:
- { _id: 4, x: 44 }
commandName: getMore
databaseName: *databaseName

- description: "A failed find event"
operations:
Expand All @@ -252,3 +259,4 @@ tests:
databaseName: *databaseName
- commandFailedEvent:
commandName: find
databaseName: *databaseName
Loading

0 comments on commit e7ee829

Please sign in to comment.