Uploaded image for project: 'PuppetDB'
  1. PuppetDB
  2. PDB-2494

PQL: support for date_trunc() function

    Details

    • Type: New Feature
    • Status: Closed
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: PDB 4.1.0
    • Component/s: None
    • Labels:
      None
    • Template:
    • Epic Link:
    • Story Points:
      1

      Description

      For CM Dashboard, we need to get aggregated counts of report statuses for individual days, hours and minutes. Currently, we are not able to do that using a PQL query. However, it seems that adding support for one DB function (similar to "date_trunc" in PGS) and interval comparisons for dates to would satisfy our needs.

      aggregation by days:

      reports [date_trunc("day", end_time), status, count()]{ end_time >= "2016-03-01T00:00:00.000Z" and end_time < "2016-03-15T00:00:00.000Z" and nodes{ facts { name = "osfamily" and value = "RedHat"} } group by date_trunc("day", end_time), status}
      

      aggregation by hours:

      reports [date_trunc("hour", end_time), status, count()]{ end_time >= "2016-03-01T00:00:00.000Z" and end_time < "2016-03-02T00:00:00.000Z" and nodes{ facts { name = "osfamily" and value = "RedHat"} } group by date_trunc("hour", end_time), status}
      

      aggregation by minutes:

      reports [date_trunc("minute", end_time), status, count()]{ end_time >= "2016-03-01T10:00:00.000Z" and end_time < "2016-03-01T11:00:00.000Z" and nodes{ facts { name = "osfamily" and value = "RedHat"} } group by date_trunc("minute", end_time), status}
      

        Attachments

          Issue Links

            Activity

              jsd-sla-details-panel

                People

                • Assignee:
                  Unassigned
                  Reporter:
                  karel.brezina Karel Brezina
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  2 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: