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

Expose diagnostics to client queries

    • Type: Icon: New Feature New Feature
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Diagnostics
    • None
    • Query

      Currently, the only way for clients to access query diagnostics is through the explain command; there's no way to access that information when issuing normal queries. We'd like to introduce a flag to find (and potentially other query commands) that includes some basic diagnostic information (keysExamined, docsExamined, hasSortStage, and ideally planSummary) as part of the query response. This enables building smarter clients that have a better understanding of their performance impact.

      As an example use case, we'd like background batch job clients to throttle themselves based on the load they generate on the database. In theory we could use number of queries issued or documents returned, but keysExamined, docsExamined, and hasSortStage are a much more precise indicator of the performance impact of queries.

      I put together a quick sketch implementation to demonstrate what the interface might look like.

            Assignee:
            backlog-server-query Backlog - Query Team (Inactive)
            Reporter:
            evan@stripe.com Evan Broder
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: