Run the warehouse query, returning per-variant identity counts and, per metric, per-variant sufficient statistics.
(
*,
environment_key: str,
feature_name: str,
window_start: datetime,
window_end: datetime,
specs: Sequence[MetricSpec],
)
| 250 | |
| 251 | |
| 252 | def get_metric_variant_stats( |
| 253 | *, |
| 254 | environment_key: str, |
| 255 | feature_name: str, |
| 256 | window_start: datetime, |
| 257 | window_end: datetime, |
| 258 | specs: Sequence[MetricSpec], |
| 259 | ) -> ResultsAggregates: |
| 260 | """Run the warehouse query, returning per-variant identity counts and, per |
| 261 | metric, per-variant sufficient statistics.""" |
| 262 | builder = ResultsQueryBuilder(specs) |
| 263 | params: dict[str, object] = { |
| 264 | "environment_key": environment_key, |
| 265 | "exposure_event": EXPOSURE_EVENT_NAME, |
| 266 | "feature_name": feature_name, |
| 267 | "window_start": window_start, |
| 268 | "window_end": window_end, |
| 269 | } |
| 270 | builder.add_metric_params(params) |
| 271 | |
| 272 | rows, columns = _get_clickhouse_client().execute( |
| 273 | builder.build_query(), params, with_column_types=True |
| 274 | ) |
| 275 | exposure_counts, metric_stats = builder.decode_rows( |
| 276 | rows, [name for name, _type in columns] |
| 277 | ) |
| 278 | |
| 279 | return ResultsAggregates( |
| 280 | specs=list(specs), |
| 281 | exposure_counts=exposure_counts, |
| 282 | metric_stats=metric_stats, |
| 283 | ) |
| 284 | |
| 285 | |
| 286 | def build_results_summary( |
no test coverage detected
searching dependent graphs…