Add change-stream process-level cursor-option histograms (mongoD + mongoS)

XMLWordPrintableJSON

    • Type: Task
    • Resolution: Duplicate
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • Query Execution
    • QE 2026-07-20
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Summary

      Add process-level histograms for change-stream cursor options batchSize and maxTimeMS.

      Background

      Design doc: "Design: Extend ChangeStream Metrics", section "Decision: Process-Level Feature Usage
      Counters" (cursor option histograms subsection).

      Scope of Work

      * Implement and wire up (names already registered in
      src/mongo/otel/metrics/metric_names.h):
      ** serverStatus.metrics.changeStreams.option.cursor.batchSize (histogram; buckets: 0, 1, 10,
      100, 1000, 10000) — kChangeStreamOptionCursorBatchSize
      ** serverStatus.metrics.changeStreams.option.cursor.maxTimeMS (histogram; 1-2-5 series
      buckets) — kChangeStreamOptionCursorMaxTimeMS
      * Update once per batch (getMore or aggregate excluding batchSize=0); only count when
      the option was explicitly specified (except maxTimeMS equal to the current default, which
      should still be counted).
      * Implement on both mongoD and mongoS.

      Acceptance Criteria

      * Both histograms populate correctly for aggregate and getMore commands specifying the
      respective option, on both mongoD and mongoS.
      * Unspecified options are not counted (except the maxTimeMS default case).
      * Unit test coverage for bucket boundaries.

      Related Files

      * src/mongo/db/commands/query_cmd/run_aggregate.cpp
      * src/mongo/db/commands/query_cmd/getmore_cmd.cpp
      * src/mongo/s/query/exec/cluster_client_cursor_impl.cpp

            Assignee:
            Cian Nugent McGealy
            Reporter:
            Cian Nugent McGealy
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: