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

Refactor the assignment of responsibilities for query stats collection

    • Type: Icon: Improvement Improvement
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • Query Integration

      Create a common QueryStatsInfo struct similar to

      struct QueryStatsInfo {
          std::unique_ptr<query_stats::Key> key;
          boost::optional<std::size_t> keyHash;
          bool disableForSubqueryExecution = false;
          struct CursorInfo {
              bool willNeverExhaust = false;
          } cursorInfo;
          struct SingleOpInfo {
              bool metricsRequested = false;
          } singleOpInfo;
      };
      

      This will be used for both the OpDebug/CurOp QueryStatsInfo and also the ClientCursor and ClusterClientCursor.

      This will allow for

      • move checks/functions that use queryStatsInfo inside the struct and clean up query stats code overall
      • pass QueryStatsInfo to writeQueryStats() and collectQueryStatsMongod/s instead of passing the key itself/flags to divorce std::moving the key from these calls.
      • Use disableForSubQueryExecution/willNeverExhaust flags within writeQueryStats() to determine if the query should be collected.

      And in general, it would be nice to add comments explaining some of the logic surrounding querystats.

            Assignee:
            erin.zhu@mongodb.com Erin Zhu
            Reporter:
            mariano.shaar@mongodb.com Mariano Shaar
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: