Skip to content

insights: make insight "start" times consistent between generation methods

Warren Gifford requested to merge cw/jit-capture-group-dates into main

Created by: chwarwick

Updates the time truncation for the most recent data point for just in time insights and the backfill process as follows:

  • If the insight is calculated Hourly, start calculating from the start of the current hour
  • If the insight is Not Hourly, start calculating from the start of the day (UTC)

resolves #34301 (closed)

Test plan

Just In Time Insights

Response for not hourly - datetime on each point is start of day, most recent is start of current day "2022-04-25T00:00:00Z"

{
  "data": {
    "insightViews": {
      "nodes": [
        {
          "id": "aW5zaWdodF92aWV3OiIyODRpVkFqQ29LNFFpN1luYXdtdllEbUlpQ0Yi",
          "dataSeriesDefinitions": [
            {
              "generatedFromCaptureGroups": false,
              "timeScope": {
                "unit": "DAY",
                "value": 1
              }
            }
          ],
          "dataSeries": [
            {
              "seriesId": "284iVCCaPPd11kY5iIZQP0B4Xya",
              "label": "TODOs",
              "points": [
                {
                  "dateTime": "2022-04-19T00:00:00Z",
                  "value": 849,
                  "__typename": "InsightDataPoint"
                },
                {
                  "dateTime": "2022-04-20T00:00:00Z",
                  "value": 845,
                  "__typename": "InsightDataPoint"
                },
                {
                  "dateTime": "2022-04-21T00:00:00Z",
                  "value": 842,
                  "__typename": "InsightDataPoint"
                },
                {
                  "dateTime": "2022-04-22T00:00:00Z",
                  "value": 849,
                  "__typename": "InsightDataPoint"
                },
                {
                  "dateTime": "2022-04-23T00:00:00Z",
                  "value": 857,
                  "__typename": "InsightDataPoint"
                },
                {
                  "dateTime": "2022-04-24T00:00:00Z",
                  "value": 857,
                  "__typename": "InsightDataPoint"
                },
                {
                  "dateTime": "2022-04-25T00:00:00Z",
                  "value": 857,
                  "__typename": "InsightDataPoint"
                }
              ],
              "__typename": "InsightsSeries"
            }
          ],
          "__typename": "InsightView"
        }
      ],
      "__typename": "InsightViewConnection"
    }
  }
}

Response for hourly - datetime on each point is start of hour, most recent is start of current hour "2022-04-25T13:00:00Z"

{
  "data": {
    "insightViews": {
      "nodes": [
        {
          "id": "aW5zaWdodF92aWV3OiIyODRpVkFqQ29LNFFpN1luYXdtdllEbUlpQ0Yi",
          "dataSeriesDefinitions": [
            {
              "generatedFromCaptureGroups": false,
              "timeScope": {
                "unit": "HOUR",
                "value": 1
              }
            }
          ],
          "dataSeries": [
            {
              "seriesId": "284iVCCaPPd11kY5iIZQP0B4Xya",
              "label": "TODOs",
              "points": [
                {
                  "dateTime": "2022-04-25T07:00:00Z",
                  "value": 857,
                  "__typename": "InsightDataPoint"
                },
                {
                  "dateTime": "2022-04-25T08:00:00Z",
                  "value": 857,
                  "__typename": "InsightDataPoint"
                },
                {
                  "dateTime": "2022-04-25T09:00:00Z",
                  "value": 857,
                  "__typename": "InsightDataPoint"
                },
                {
                  "dateTime": "2022-04-25T10:00:00Z",
                  "value": 857,
                  "__typename": "InsightDataPoint"
                },
                {
                  "dateTime": "2022-04-25T11:00:00Z",
                  "value": 857,
                  "__typename": "InsightDataPoint"
                },
                {
                  "dateTime": "2022-04-25T12:00:00Z",
                  "value": 857,
                  "__typename": "InsightDataPoint"
                },
                {
                  "dateTime": "2022-04-25T13:00:00Z",
                  "value": 857,
                  "__typename": "InsightDataPoint"
                }
              ],
              "__typename": "InsightsSeries"
            }
          ],
          "__typename": "InsightView"
        }
      ],
      "__typename": "InsightViewConnection"
    }
  }
}
Just In Time Capture Group

Response for Hourly - most recent is start of current hour "2022-04-25T13:00:00Z"

{
  "data": {
    "insightViews": {
      "nodes": [
        {
          "id": "aW5zaWdodF92aWV3OiIyODdSWlZScVlxWFp5QjhSZGRmaWNveHNxSUUi",
          "dataSeriesDefinitions": [
            {
              "generatedFromCaptureGroups": true,
              "timeScope": {
                "unit": "HOUR",
                "value": 2
              }
            }
          ],
          "dataSeries": [
            {
              "seriesId": "dynamic-series-1",
              "label": "ISC",
              "points": [
                {
                  "dateTime": "2022-04-25T01:00:00Z",
                  "value": 1,
                  "__typename": "InsightDataPoint"
                },
                {
                  "dateTime": "2022-04-25T03:00:00Z",
                  "value": 1,
                  "__typename": "InsightDataPoint"
                },
                {
                  "dateTime": "2022-04-25T05:00:00Z",
                  "value": 1,
                  "__typename": "InsightDataPoint"
                },
                {
                  "dateTime": "2022-04-25T07:00:00Z",
                  "value": 1,
                  "__typename": "InsightDataPoint"
                },
                {
                  "dateTime": "2022-04-25T09:00:00Z",
                  "value": 1,
                  "__typename": "InsightDataPoint"
                },
                {
                  "dateTime": "2022-04-25T11:00:00Z",
                  "value": 1,
                  "__typename": "InsightDataPoint"
                },
                {
                  "dateTime": "2022-04-25T13:00:00Z",
                  "value": 1,
                  "__typename": "InsightDataPoint"
                }
              ],
              "__typename": "InsightsSeries"
            },
            {
              "seriesId": "dynamic-series-2",
              "label": "Apache-2.0",
              "points": [
                {
                  "dateTime": "2022-04-25T01:00:00Z",
                  "value": 22,
                  "__typename": "InsightDataPoint"
                },
                {
                  "dateTime": "2022-04-25T03:00:00Z",
                  "value": 22,
                  "__typename": "InsightDataPoint"
                },
                {
                  "dateTime": "2022-04-25T05:00:00Z",
                  "value": 22,
                  "__typename": "InsightDataPoint"
                },
                {
                  "dateTime": "2022-04-25T07:00:00Z",
                  "value": 22,
                  "__typename": "InsightDataPoint"
                },
                {
                  "dateTime": "2022-04-25T09:00:00Z",
                  "value": 22,
                  "__typename": "InsightDataPoint"
                },
                {
                  "dateTime": "2022-04-25T11:00:00Z",
                  "value": 22,
                  "__typename": "InsightDataPoint"
                },
                {
                  "dateTime": "2022-04-25T13:00:00Z",
                  "value": 22,
                  "__typename": "InsightDataPoint"
                }
              ],
              "__typename": "InsightsSeries"
            }
          ],
          "__typename": "InsightView"
        }
      ],
      "__typename": "InsightViewConnection"
    }
  }
}

Response for Not Hourly - most recent is start of current day "2022-04-25T00:00:00Z"

{
  "data": {
    "insightViews": {
      "nodes": [
        {
          "id": "aW5zaWdodF92aWV3OiIyODdSWlZScVlxWFp5QjhSZGRmaWNveHNxSUUi",
          "dataSeriesDefinitions": [
            {
              "generatedFromCaptureGroups": true,
              "timeScope": {
                "unit": "MONTH",
                "value": 1
              }
            }
          ],
          "dataSeries": [
            {
              "seriesId": "dynamic-series-1",
              "label": "Apache-2.0",
              "points": [
                {
                  "dateTime": "2021-10-25T00:00:00Z",
                  "value": 11,
                  "__typename": "InsightDataPoint"
                },
                {
                  "dateTime": "2021-11-25T00:00:00Z",
                  "value": 12,
                  "__typename": "InsightDataPoint"
                },
                {
                  "dateTime": "2021-12-25T00:00:00Z",
                  "value": 13,
                  "__typename": "InsightDataPoint"
                },
                {
                  "dateTime": "2022-01-25T00:00:00Z",
                  "value": 20,
                  "__typename": "InsightDataPoint"
                },
                {
                  "dateTime": "2022-02-25T00:00:00Z",
                  "value": 21,
                  "__typename": "InsightDataPoint"
                },
                {
                  "dateTime": "2022-03-25T00:00:00Z",
                  "value": 22,
                  "__typename": "InsightDataPoint"
                },
                {
                  "dateTime": "2022-04-25T00:00:00Z",
                  "value": 22,
                  "__typename": "InsightDataPoint"
                }
              ],
              "__typename": "InsightsSeries"
            },
            {
              "seriesId": "dynamic-series-2",
              "label": "ISC",
              "points": [
                {
                  "dateTime": "2021-10-25T00:00:00Z",
                  "value": 0,
                  "__typename": "InsightDataPoint"
                },
                {
                  "dateTime": "2021-11-25T00:00:00Z",
                  "value": 0,
                  "__typename": "InsightDataPoint"
                },
                {
                  "dateTime": "2021-12-25T00:00:00Z",
                  "value": 0,
                  "__typename": "InsightDataPoint"
                },
                {
                  "dateTime": "2022-01-25T00:00:00Z",
                  "value": 0,
                  "__typename": "InsightDataPoint"
                },
                {
                  "dateTime": "2022-02-25T00:00:00Z",
                  "value": 1,
                  "__typename": "InsightDataPoint"
                },
                {
                  "dateTime": "2022-03-25T00:00:00Z",
                  "value": 1,
                  "__typename": "InsightDataPoint"
                },
                {
                  "dateTime": "2022-04-25T00:00:00Z",
                  "value": 1,
                  "__typename": "InsightDataPoint"
                }
              ],
              "__typename": "InsightsSeries"
            }
          ],
          "__typename": "InsightView"
        }
      ],
      "__typename": "InsightViewConnection"
    }
  }
}
Backfilled Insights

Response for not hourly - datetime on each point is start of day, most recent is start of current day "2022-04-25T00:00:00Z"

{
  "data": {
    "insightViews": {
      "nodes": [
        {
          "id": "aW5zaWdodF92aWV3OiIyOElHM1hTNjdoczJ5Zkt6Mml2cjNsR1ltZjQi",
          "dataSeriesDefinitions": [
            {
              "generatedFromCaptureGroups": false,
              "timeScope": {
                "unit": "WEEK",
                "value": 1
              }
            }
          ],
          "dataSeries": [
            {
              "seriesId": "28IG3XU13xokDPt1ibJkPoSqfuj",
              "label": "FIXME",
              "points": [
                {
                  "dateTime": "2022-04-25T00:00:00Z",
                  "value": 8019,
                  "__typename": "InsightDataPoint"
                },
                {
                  "dateTime": "2022-04-18T00:00:00Z",
                  "value": 8019,
                  "__typename": "InsightDataPoint"
                },
                {
                  "dateTime": "2022-04-11T00:00:00Z",
                  "value": 8019,
                  "__typename": "InsightDataPoint"
                },
                {
                  "dateTime": "2022-04-04T00:00:00Z",
                  "value": 8019,
                  "__typename": "InsightDataPoint"
                },
                {
                  "dateTime": "2022-03-28T00:00:00Z",
                  "value": 8019,
                  "__typename": "InsightDataPoint"
                },
                {
                  "dateTime": "2022-03-21T00:00:00Z",
                  "value": 8019,
                  "__typename": "InsightDataPoint"
                },
                {
                  "dateTime": "2022-03-14T00:00:00Z",
                  "value": 8018,
                  "__typename": "InsightDataPoint"
                },
                {
                  "dateTime": "2022-03-07T00:00:00Z",
                  "value": 8018,
                  "__typename": "InsightDataPoint"
                },
                {
                  "dateTime": "2022-02-28T00:00:00Z",
                  "value": 8017,
                  "__typename": "InsightDataPoint"
                },
                {
                  "dateTime": "2022-02-21T00:00:00Z",
                  "value": 8017,
                  "__typename": "InsightDataPoint"
                },
                {
                  "dateTime": "2022-02-14T00:00:00Z",
                  "value": 8017,
                  "__typename": "InsightDataPoint"
                },
                {
                  "dateTime": "2022-02-07T00:00:00Z",
                  "value": 8017,
                  "__typename": "InsightDataPoint"
                }
              ],
              "__typename": "InsightsSeries"
            }
          ],
          "__typename": "InsightView"
        }
      ],
      "__typename": "InsightViewConnection"
    }
  }
}

Response for hourly - datetime on each point is start of hour, most recent is start of current hour "2022-04-25T14:00:00Z"

{
  "data": {
    "insightViews": {
      "nodes": [
        {
          "id": "aW5zaWdodF92aWV3OiIyOElEd211ZTNlaHNZQ3Y0ZzNncjVtTXlWUFMi",
          "dataSeriesDefinitions": [
            {
              "generatedFromCaptureGroups": true,
              "timeScope": {
                "unit": "HOUR",
                "value": 1
              }
            }
          ],
          "dataSeries": [            
            {
              "seriesId": "28IDwnmv7hATUWdg3I57YkBLZmu-3.12",
              "label": "3.12",
              "points": [
                {
                  "dateTime": "2022-04-25T03:00:00Z",
                  "value": 6,
                  "__typename": "InsightDataPoint"
                },
                {
                  "dateTime": "2022-04-25T04:00:00Z",
                  "value": 6,
                  "__typename": "InsightDataPoint"
                },
                {
                  "dateTime": "2022-04-25T05:00:00Z",
                  "value": 6,
                  "__typename": "InsightDataPoint"
                },
                {
                  "dateTime": "2022-04-25T06:00:00Z",
                  "value": 6,
                  "__typename": "InsightDataPoint"
                },
                {
                  "dateTime": "2022-04-25T07:00:00Z",
                  "value": 6,
                  "__typename": "InsightDataPoint"
                },
                {
                  "dateTime": "2022-04-25T08:00:00Z",
                  "value": 6,
                  "__typename": "InsightDataPoint"
                },
                {
                  "dateTime": "2022-04-25T09:00:00Z",
                  "value": 6,
                  "__typename": "InsightDataPoint"
                },
                {
                  "dateTime": "2022-04-25T10:00:00Z",
                  "value": 6,
                  "__typename": "InsightDataPoint"
                },
                {
                  "dateTime": "2022-04-25T11:00:00Z",
                  "value": 6,
                  "__typename": "InsightDataPoint"
                },
                {
                  "dateTime": "2022-04-25T12:00:00Z",
                  "value": 6,
                  "__typename": "InsightDataPoint"
                },
                {
                  "dateTime": "2022-04-25T13:00:00Z",
                  "value": 6,
                  "__typename": "InsightDataPoint"
                },
                {
                  "dateTime": "2022-04-25T14:00:00Z",
                  "value": 6,
                  "__typename": "InsightDataPoint"
                }
              ],
              "__typename": "InsightsSeries"
            },            
            {
              "seriesId": "28IDwnmv7hATUWdg3I57YkBLZmu-3.15",
              "label": "3.15",
              "points": [
                {
                  "dateTime": "2022-04-25T03:00:00Z",
                  "value": 3,
                  "__typename": "InsightDataPoint"
                },
                {
                  "dateTime": "2022-04-25T04:00:00Z",
                  "value": 3,
                  "__typename": "InsightDataPoint"
                },
                {
                  "dateTime": "2022-04-25T05:00:00Z",
                  "value": 3,
                  "__typename": "InsightDataPoint"
                },
                {
                  "dateTime": "2022-04-25T06:00:00Z",
                  "value": 3,
                  "__typename": "InsightDataPoint"
                },
                {
                  "dateTime": "2022-04-25T07:00:00Z",
                  "value": 3,
                  "__typename": "InsightDataPoint"
                },
                {
                  "dateTime": "2022-04-25T08:00:00Z",
                  "value": 3,
                  "__typename": "InsightDataPoint"
                },
                {
                  "dateTime": "2022-04-25T09:00:00Z",
                  "value": 3,
                  "__typename": "InsightDataPoint"
                },
                {
                  "dateTime": "2022-04-25T10:00:00Z",
                  "value": 3,
                  "__typename": "InsightDataPoint"
                },
                {
                  "dateTime": "2022-04-25T11:00:00Z",
                  "value": 3,
                  "__typename": "InsightDataPoint"
                },
                {
                  "dateTime": "2022-04-25T12:00:00Z",
                  "value": 3,
                  "__typename": "InsightDataPoint"
                },
                {
                  "dateTime": "2022-04-25T13:00:00Z",
                  "value": 3,
                  "__typename": "InsightDataPoint"
                },
                {
                  "dateTime": "2022-04-25T14:00:00Z",
                  "value": 3,
                  "__typename": "InsightDataPoint"
                }
              ],
              "__typename": "InsightsSeries"
            },
            {
              "seriesId": "28IDwnmv7hATUWdg3I57YkBLZmu-3.15.0",
              "label": "3.15.0",
              "points": [
                {
                  "dateTime": "2022-04-25T03:00:00Z",
                  "value": 1,
                  "__typename": "InsightDataPoint"
                },
                {
                  "dateTime": "2022-04-25T04:00:00Z",
                  "value": 1,
                  "__typename": "InsightDataPoint"
                },
                {
                  "dateTime": "2022-04-25T05:00:00Z",
                  "value": 1,
                  "__typename": "InsightDataPoint"
                },
                {
                  "dateTime": "2022-04-25T06:00:00Z",
                  "value": 1,
                  "__typename": "InsightDataPoint"
                },
                {
                  "dateTime": "2022-04-25T07:00:00Z",
                  "value": 1,
                  "__typename": "InsightDataPoint"
                },
                {
                  "dateTime": "2022-04-25T08:00:00Z",
                  "value": 1,
                  "__typename": "InsightDataPoint"
                },
                {
                  "dateTime": "2022-04-25T09:00:00Z",
                  "value": 1,
                  "__typename": "InsightDataPoint"
                },
                {
                  "dateTime": "2022-04-25T10:00:00Z",
                  "value": 1,
                  "__typename": "InsightDataPoint"
                },
                {
                  "dateTime": "2022-04-25T11:00:00Z",
                  "value": 1,
                  "__typename": "InsightDataPoint"
                },
                {
                  "dateTime": "2022-04-25T12:00:00Z",
                  "value": 1,
                  "__typename": "InsightDataPoint"
                },
                {
                  "dateTime": "2022-04-25T13:00:00Z",
                  "value": 1,
                  "__typename": "InsightDataPoint"
                },
                {
                  "dateTime": "2022-04-25T14:00:00Z",
                  "value": 1,
                  "__typename": "InsightDataPoint"
                }
              ],
              "__typename": "InsightsSeries"
            }
          ],
          "__typename": "InsightView"
        }
      ],
      "__typename": "InsightViewConnection"
    }
  }
}

Merge request reports

Loading