[DRIVERS-2575] Add collection name to all command logging and monitoring events Created: 15/Mar/23  Updated: 01/Feb/24

Status: Backlog
Project: Drivers
Component/s: Command Logging and Monitoring
Fix Version/s: None

Type: Improvement Priority: Unknown
Reporter: Matt Dale Assignee: Unassigned
Resolution: Unresolved Votes: 1
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to GODRIVER-1371 improve usability of the APM interface Closed
is related to DRIVERS-1409 Add CommandStartedEvent to CommandSuc... Closed
is related to DRIVERS-2452 Add databaseName property to command ... Implementing
Driver Changes: Needed

 Description   

Summary

Add collection name (if available) to all command logging and monitoring events.

Currently, no command events or logs contain the collection name. That can make using the command logging and monitoring events much more difficult if you need access to information that is spread across multiple events. For example, to use the duration values in CommandSucceededEvent or CommandFailedEvent to record metrics on per-collection command latencies, you need to manually extract the collection name from the command document. A much better experience is to include the database and collection names (if available) on all events or logs, making them individually much more useful.

Inspired by a recent community forum post asking how to get the collection name from a command monitoring event. Also, see a similar request in GODRIVER-1371.

Motivation

Who is the affected end user?

People using the command logging and monitoring feature who need access to collection name as well as the information in a "succeeded" or "failed" command event.

How does this affect the end user?

They must write a significant amount of logic to correlate events and extract information from raw command or reply BSON documents, requiring knowledge of the MongoDB wire protocol command structure.

How likely is it that this problem or use case will occur?

Based on the frequency of user requests, not many users are trying to use command monitoring and logging as described. However, that low frequency of requests may be due to users finding another way around due the high difficulty of correlating and extracting collection name.

If the problem does occur, what are the consequences and how severe are they?

Users may have to spend a significant amount of time to correlate and extract collection name. Correlating and extracting collection name via the command logging and monitoring APIs is significantly more error prone than adding the information while sending an operation, leading to possible bugs in client code.

Is this issue urgent?

No.

Is this ticket required by a downstream team?

No.

Is this ticket only for tests?

No.

Acceptance Criteria

A collectionName is specified on the CommandStartedEvent, CommandSucceededEvent, and CommandFailedEvent (and corresponding log messages) in the Command Logging and Monitoring spec.



 Comments   
Comment by Mayank Agarwal [ 01/Feb/24 ]

matt.dale@mongodb.com We need schema name in events, can you please share the timeline on when can we pick this change?

Comment by Durran Jordan [ 31/Jul/23 ]

Update spec to add optional collection name to the command started/failed/succeeded events. Drivers can determine to pass the collection name down or extract it from the command itself.

Comment by Durran Jordan [ 11/Apr/23 ]

I'm in agreement with Jeff's point that the intention was to have the event publishing at a low level that is unaware of the command's origin (Node and Ruby assume this as well). It wouldn't be difficult at the application layer to extract the collection name using the list of commands noted above that accept a collection name and then using the commandName in the event as the property name in the command object.

Comment by Matt Dale [ 07/Apr/23 ]

I just realized this has some overlap with DRIVERS-2452 and DRIVERS-1409. I've adjusted the description to make this ticket specifically about collection name in command events.

Generated at Thu Feb 08 08:25:54 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.