Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-73408

Correlate telemetry metrics between mongos and shard servers

    • Type: Icon: Task Task
    • Resolution: Won't Do
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None
    • Query Integration

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

            Assignee:
            backlog-query-integration [DO NOT USE] Backlog - Query Integration
            Reporter:
            joshua.lapacik@mongodb.com Joshua Lapacik (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: