Support recording query stats for pipeline updates containing $_internalApplyOplogUpdate

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

      We want to record query stats for pipeline updates containing $_internalApplyOplogUpdate because it is used to expose change stream events (SPM-1950) and it would be useful to see how many customers actually use this.

      The way we support search/vectorSearch is to skip shapifying the pipeline (i.e., they have empty objects). We may do similarly to oplog updates. I can imagine it would look something like this:

       

      Value DocumentSourceInternalApplyOplogUpdate::serialize(const SerializationOptions& opts) const {
      if (opts.isSerializingForQueryStats()) {
      // For query stats, return an empty object to avoid serialization issues
      // while still preserving the stage name for shape purposes
      returnValue(Document{{kStageName, Document{}}});
      }
       
      // Original implementation for non-query-stats cases
      returnValue(Document{
      {kStageName, Document{{kOplogUpdateFieldName, opts.serializeLiteral(_oplogUpdate)}}}});
      }

       

      To test this, this test should pass when run in the query_stats_passthrough:

       

       
      buildscripts/resmoke.py run --suites=query_stats_passthrough --runAllFeatureFlagTests jstests/core/query/internal_apply_oplog_update.js | tee output.txt
      

       

       

            Assignee:
            Unassigned
            Reporter:
            Erin Liang
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: