Rounding with ThetaSketches

I have a quick question about rounding. I use the ThetaSketches extension to count unique users like so:

  query = {
    dataSource: 'telemetry-signals',
    granularity: 'all',
    aggregations: [
      {
        type: 'thetaSketch',
        name: 'Total users',
        fieldName: 'clientUser',
      },
    ],
    queryType: 'timeseries',
  };

However, for large numbers, this returns a float value (which is to be expected, given the nature of the algorithms). Is there a post aggregator or something I can use to round that value before displaying it to my users?

Not the cleanest solution I found, but I ended up replacing the theta sketch with the deprecated cardinality aggregator, which does support rounding:

{
    dataSource: 'telemetry-signals',
    granularity: 'all',

    aggregations: [
      {
        type: 'cardinality',
        name: 'Total users',
        fields: ['clientUser'],
        byRow: false,
        round: true,
      },
    ],
    queryType: 'timeseries',
  }

Nothing to add, this is just for posterity. Hi future googler, you’re welcome :kissing_heart:

1 Like