Return event counts recorded for `environment_key` in the warehouse.
(environment_key: str)
| 125 | |
| 126 | |
| 127 | def get_warehouse_event_stats(environment_key: str) -> WarehouseEventStats: |
| 128 | """Return event counts recorded for `environment_key` in the warehouse.""" |
| 129 | rows = _get_clickhouse_client().execute( |
| 130 | "SELECT count() AS total, uniqExact(event) AS unique " |
| 131 | "FROM events WHERE environment_key = %(environment_key)s", |
| 132 | {"environment_key": environment_key}, |
| 133 | ) |
| 134 | total, unique = rows[0] if rows else (0, 0) |
| 135 | return WarehouseEventStats( |
| 136 | total_events_received=int(total), |
| 137 | unique_events_count=int(unique), |
| 138 | ) |
| 139 | |
| 140 | |
| 141 | EXPOSURE_BUCKETS_QUERY = ( |
no test coverage detected
searching dependent graphs…