TelemetryDeck / Issues

When something is wrong in TelemetryDeck-Land, or if you have a cool idea how to make things better, this is the place to create an Issue.
https://telemetrydeck.com
36 stars 0 forks source link

TQL Abstraction: counting users vs counting signals #344

Open winsmith opened 7 months ago

winsmith commented 7 months ago

When writing TQL, customers almost always want to aggregate either over the number of signals or the number of users in the query. Yet, both of these things require multiple lines of aggregation that are unintuitive:

For counting signals, customers have to sum up the count field:

  "aggregations": [
    {
      "fieldName": "count",
      "name": "count",
      "type": "longSum"
    }
  ],

For counting users, customers have to create a thetaSketch object over the userID field:

  "aggregations": [
    {
      "fieldName": "clientUser",
      "name": "users",
      "type": "thetaSketch"
    },
  ],

Both of these are very unintuitive if you don't know how our Apache Druid backend works, and cumbersome even if you do. I'm proposing a new aggregation type that abstracts these away:

  "aggregations": [
    {
      "name": <optional, defaults to "Signals">,
      "type": "countSignals"
    }
  ],

and

  "aggregations": [
    {
      "name": <optional, defaults to "Users">,
      "type": "countUsers"
    }
  ],

These would then get compiled into the longSum and thetaSketch aggregators respectively.