MCPcopy Create free account
hub / github.com/Flagsmith/flagsmith / get_warehouse_event_stats

Function get_warehouse_event_stats

api/experimentation/services.py:127–138  ·  view source on GitHub ↗

Return event counts recorded for `environment_key` in the warehouse.

(environment_key: str)

Source from the content-addressed store, hash-verified

125
126
127def 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
141EXPOSURE_BUCKETS_QUERY = (

Callers 1

Calls 3

WarehouseEventStatsClass · 0.90
_get_clickhouse_clientFunction · 0.85
executeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…