Skip to content

Insights/compute endpoint search

Administrator requested to merge insights/compute-endpoint-search into main

Created by: coury-clark

This is work on a prototype of capture group insights. This PR implements a new live preview resolver for search insight series that only works on capture group generated series for now.

Example query:

query livepreview($input:SearchInsightLivePreviewInput!) {
  searchInsightLivePreview(input:$input) {
    label
    points {
      dateTime
      value
    }
  }
}

Input:

{
  "input": {
    "query": "file:go\\.mod$ go\\s*(\\d\\.\\d+)",
    "repositoryScope": {
      "repositories": [
        "github.com/sourcegraph/sourcegraph"
      ]
    },
    "timeScope": {
      "stepInterval": {
        "unit": "MONTH",
        "value": 8
      }
    },
    "label": "should not show up",
    "generatedFromCaptureGroups": true
  }
}

Response:

{
  "data": {
    "searchInsightLivePreview": [
      {
        "label": "1.14",
        "points": [
          {
            "dateTime": "2018-07-11T00:01:00Z",
            "value": 0
          },
          {
            "dateTime": "2019-03-11T00:01:00Z",
            "value": 0
          },
          {
            "dateTime": "2019-11-11T00:01:00Z",
            "value": 0
          },
          {
            "dateTime": "2020-07-11T00:01:00Z",
            "value": 2
          },
          {
            "dateTime": "2021-03-11T00:01:00Z",
            "value": 2
          },
          {
            "dateTime": "2021-11-11T00:01:00Z",
            "value": 1
          }
        ]
      },
      {
        "label": "1.16",
        "points": [
          {
            "dateTime": "2018-07-11T00:01:00Z",
            "value": 0
          },
          {
            "dateTime": "2019-03-11T00:01:00Z",
            "value": 0
          },
          {
            "dateTime": "2019-11-11T00:01:00Z",
            "value": 0
          },
          {
            "dateTime": "2020-07-11T00:01:00Z",
            "value": 0
          },
          {
            "dateTime": "2021-03-11T00:01:00Z",
            "value": 2
          },
          {
            "dateTime": "2021-11-11T00:01:00Z",
            "value": 5
          }
        ]
      },
      {
        "label": "1.17",
        "points": [
          {
            "dateTime": "2018-07-11T00:01:00Z",
            "value": 0
          },
          {
            "dateTime": "2019-03-11T00:01:00Z",
            "value": 0
          },
          {
            "dateTime": "2019-11-11T00:01:00Z",
            "value": 0
          },
          {
            "dateTime": "2020-07-11T00:01:00Z",
            "value": 0
          },
          {
            "dateTime": "2021-03-11T00:01:00Z",
            "value": 0
          },
          {
            "dateTime": "2021-11-11T00:01:00Z",
            "value": 3
          }
        ]
      },
      {
        "label": "1.15",
        "points": [
          {
            "dateTime": "2018-07-11T00:01:00Z",
            "value": 0
          },
          {
            "dateTime": "2019-03-11T00:01:00Z",
            "value": 0
          },
          {
            "dateTime": "2019-11-11T00:01:00Z",
            "value": 0
          },
          {
            "dateTime": "2020-07-11T00:01:00Z",
            "value": 0
          },
          {
            "dateTime": "2021-03-11T00:01:00Z",
            "value": 1
          },
          {
            "dateTime": "2021-11-11T00:01:00Z",
            "value": 0
          }
        ]
      },
      {
        "label": "1.13",
        "points": [
          {
            "dateTime": "2018-07-11T00:01:00Z",
            "value": 0
          },
          {
            "dateTime": "2019-03-11T00:01:00Z",
            "value": 0
          },
          {
            "dateTime": "2019-11-11T00:01:00Z",
            "value": 1
          },
          {
            "dateTime": "2020-07-11T00:01:00Z",
            "value": 0
          },
          {
            "dateTime": "2021-03-11T00:01:00Z",
            "value": 0
          },
          {
            "dateTime": "2021-11-11T00:01:00Z",
            "value": 0
          }
        ]
      }
    ]
  }
}

Merge request reports

Loading