[SERVER-82928] Reconsider mongos approach to only incremental global counters for stages when aggregation is successful Created: 08/Nov/23  Updated: 02/Jan/24

Status: In Progress
Project: Core Server
Component/s: Aggregation Framework
Affects Version/s: None
Fix Version/s: None

Type: Task Priority: Major - P3
Reporter: Max Hirschhorn Assignee: Vamsy Annabattula
Resolution: Unresolved Votes: 0
Labels: neweng, quick-tech-debt
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to SERVER-44689 Add serverStatus counter for each use... Closed
Assigned Teams:
Query Integration
Participants:

 Description   

The call to LiteParsedPipeline::tickGlobalStageCounters() depends on the status from running the pipeline being Status::OK(). This means the aggStageCounters won't be incremented if the aggregation pipeline errors. Not incrementing the aggStageCounters in mongos has made it challenging to identify from which mongos an aggregation a problematic aggregation (SERVER-82410) is being run in hopes to identify the particular application client triggering it (although we suspect Compass). Additionally, it is odd for mongos and mongod to have different behaviors when it comes to system observability.

There may be downsides to having mongos increment its aggStageCounters even when the aggregation pipeline errors and so it is worth the Query team discussing internally to come to a decision again.

627
if (status.isOK()) {
628
    updateHostsTargetedMetrics(opCtx,
629
                                namespaces.executionNss,
630
                                cri ? boost::make_optional(cri->cm) : boost::none,
631
                                involvedNamespaces);
632
    // Report usage statistics for each stage in the pipeline.
633
    liteParsedPipeline.tickGlobalStageCounters();
634
    // Add 'command' object to explain output.
635
    if (expCtx->explain) {
636
        explain_common::appendIfRoom(
637
            aggregation_request_helper::serializeToCommandObj(request), "command", result);
638
    }
639
}

https://github.com/mongodb/mongo/blob/60a2f259be89aba194a2537037e464c96245b378/src/mongo/s/query/cluster_aggregate.cpp#L633


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