MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / usageDimStatement

Function usageDimStatement

telemetry-worker/src/rollup.ts:166–173  ·  view source on GitHub ↗

* One usage dimension, from a `usage_daily` column. Absent values are stored as '' * (they are part of the primary key), so '' is what gets skipped. `where` narrows * the rows further — name_error keeps only counters that saw an error.

(dim: string, column: string, total = 'count', where = '')

Source from the content-addressed store, hash-verified

164 * the rows further — name_error keeps only counters that saw an error.
165 */
166function usageDimStatement(dim: string, column: string, total = 'count', where = ''): string {
167 return `INSERT INTO daily_dim_counts (day, event, dim, value, count, machines)
168 SELECT day, 'usage_rollup', '${dim}', ${column}, sum(${total}), count(DISTINCT machine_id)
169 FROM usage_daily
170 WHERE day = ? AND ${column} <> ''${where}
171 GROUP BY day, ${column}
172 ${DIM_CONFLICT}`;
173}
174
175/**
176 * One dimension unnested from a JSON array prop — one row per element, so an index

Callers 1

rollup.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected