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

Function get_exposure_buckets

api/experimentation/services.py:221–249  ·  view source on GitHub ↗
(
    *,
    environment_key: str,
    feature_name: str,
    window_start: datetime,
    window_end: datetime,
    granularity: ExposureGranularity,
)

Source from the content-addressed store, hash-verified

219
220
221def get_exposure_buckets(
222 *,
223 environment_key: str,
224 feature_name: str,
225 window_start: datetime,
226 window_end: datetime,
227 granularity: ExposureGranularity,
228) -> list[ExposureBucket]:
229 rows = _get_clickhouse_client().execute(
230 EXPOSURE_BUCKETS_QUERY.format(
231 bucket_function=_EXPOSURE_BUCKET_FUNCTIONS[granularity]
232 ),
233 {
234 "environment_key": environment_key,
235 "exposure_event": EXPOSURE_EVENT_NAME,
236 "feature_name": feature_name,
237 "window_start": window_start,
238 "window_end": window_end,
239 },
240 )
241 return [
242 ExposureBucket(
243 variant=variant,
244 bucket=bucket,
245 first_exposed_identities=int(first_exposed_identities),
246 quarantined=bool(quarantined),
247 )
248 for quarantined, variant, bucket, first_exposed_identities in rows
249 ]
250
251
252def get_metric_variant_stats(

Callers 1

Calls 3

ExposureBucketClass · 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…