[SERVER-73408] Correlate telemetry metrics between mongos and shard servers Created: 27/Jan/23  Updated: 14/Sep/23  Resolved: 16/Mar/23

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Task Priority: Major - P3
Reporter: Joshua Lapacik (Inactive) Assignee: Backlog - Query Integration
Resolution: Won't Do Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
depends on SERVER-73557 Add ability for mongos to broadcast t... Closed
Assigned Teams:
Query Integration
Participants:

 Description   

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"}}}
]



 Comments   
Comment by Davis Haupt (Inactive) [ 16/Mar/23 ]

This capability is now out-of-scope for this project.

Comment by Davis Haupt (Inactive) [ 02/Feb/23 ]

Moving back to open since the first part of this ticket has been split out into SERVER-73557

Generated at Thu Feb 08 06:24:35 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.