Skip to content

Code monitors: expose query and result count on trigger resolver

Warren Gifford requested to merge cc/expose-trigger-fields into main

Created by: camdencheek

This exposes the query that approximates the result set for the trigger job and the number of results for that trigger job.

Example query:

query List {
  currentUser {
    monitors{
      nodes {
        trigger{
          ...on MonitorQuery{
            events{
              nodes {
                query
                resultCount
              }
            }
          }
        }
      }
    }
  }
}

Example response:

{
  "data": {
    "currentUser": {
      "monitors": {
        "nodes": [
          {
            "trigger": {
              "events": {
                "nodes": [
                  {
                    "query": "repo:sourcegraph type:commit patternType:literal after:\"2022-02-22T22:49:18Z\"",
                    "resultCount": 30
                  },
                  {
                    "query": "repo:sourcegraph type:commit patternType:literal after:\"2022-02-22T22:20:38Z\"",
                    "resultCount": 1
                  }
                ]
              }
            }
          }
        ]
      }
    }
  }
}

I'll expose the actual result contents in a followup PR.

Test plan

Tested manually. Will later be covered by unit tests and goldenfile tests.

Merge request reports

Loading