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

Function usageDimStatement

telemetry-worker/src/rollup.ts:117–124  ·  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

115 * the rows further — name_error keeps only counters that saw an error.
116 */
117function usageDimStatement(dim: string, column: string, total = 'count', where = ''): string {
118 return `INSERT INTO daily_dim_counts (day, event, dim, value, count, machines)
119 SELECT day, 'usage_rollup', '${dim}', ${column}, sum(${total}), count(DISTINCT machine_id)
120 FROM usage_daily
121 WHERE day = ? AND ${column} <> ''${where}
122 GROUP BY day, ${column}
123 ${DIM_CONFLICT}`;
124}
125
126/**
127 * 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