-
Type:
Task
-
Resolution: Won't Do
-
Priority:
Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
-
Query Integration
-
None
-
None
-
None
-
None
-
None
-
None
-
None
Modify $telemetry so that `runOn: "allNodes"` will return distributed plan logic that will cause the shards part to run on all nodes (see SERVER-73557).
De-sugar $telemetry on mongos into a pipeline that aggregates telemetry from all nodes with the results from the local telemetry cache. `runOn: "mongos"` will ensure that we don't keep recursively de-sugaring in a loop.
[
{$telemetry: {runOn: "allNodes"}},
{$addFields: {shapeId: "$key"}},
{$project: {
key: 0,
metrics: {
firstSeenTimestamp: 0,
lastExecutionMicros: 0,
execCount: 0,
queryExecMicros: 0,
docsReturned: 0,
}
}},
{$unionWith: {coll: 1, pipeline: [
{$telemetry: {runOn: "mongos"}}, // Runs on mongos
{$project: {
key: 1,
shapeId: 1,
metrics: { // only keep relevant metrics
firstSeenTimestamp: 1,
lastExecutionMicros: 1,
execCount: 1,
queryExecMicros: 1,
docsReturned: 1,
},
}},
]}},
{$group: {
_id: "$shapeId",
key: {$first: "$key"},
metrics: {"..."}
}},
{$match: {key: {$type: "object"}}}
]
- depends on
-
SERVER-73557 Add ability for mongos to broadcast the shards part of a pipeline to all primaries and secondaries in a cluster
-
- Closed
-