-
Type:
Task
-
Resolution: Unresolved
-
Priority:
Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
DB Integration & Observability
-
None
-
None
-
None
-
None
-
None
-
None
-
None
Register query shapes and stats keys for bulkWrite ops on mongos, so that mongos records a query stats entry per bulkWrite op the same way it already does for update and delete commands.
Scope
- In WriteCmdQueryStatsRegistrar::parseAndRegisterRequest (src/mongo/s/write_ops/write_cmd_query_stats_registrar.cpp), add a bulkWrite branch. Today it returns early for anything that is not an insert/update/delete command.
- For each op, build the bulkWrite op shape (update/delete/insert) and the bulkWrite stats key, gated on the existing bulkWrite query shape checks (feature flag, FLE, unsupported update modifications), and register it at the op's index.
- Inserts: register each insert op at its own index (no grouping of consecutive inserts).
- Timeseries: no extra filtering. mongos does not know the collection type before targeting, so timeseries ops are registered, matching mongos behavior for update/delete commands.
- Keep the existing guards: skip retried writes, set the query shape hash on CurOp only for single-op requests.
- Metrics on these entries come from mongos only (latency, execution count). Shard-side metrics are out of scope (see SERVER-137437 and SERVER-137438).
Testing
- Unit tests in write_cmd_query_stats_registrar_test.cpp: per-op registration, feature flag off, FLE skip, unsupported update modification skip, single-op query shape hash on CurOp, retry no-op.
- Sharded jstest asserting bulkWrite entries on mongos, and that mongos and mongod compute the same query shape hash for the same op.
Open
- mongos explain of a bulkWrite op still computes the standalone update/delete query shape hash.
- Whether the legacy (non-unified) mongos bulkWrite path also needs registration.
- is related to
-
SERVER-137437 Collect query stats for bulkWrite ops in sharded
-
- Backlog
-
-
SERVER-137438 Attach metrics to bulkWrite responses on shards
-
- Backlog
-
- related to
-
SERVER-139525 Register bulkWrite query stats on the legacy mongos write path
-
- Backlog
-