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

Function get_usage_trends

api/platform_hub/services.py:415–429  ·  view source on GitHub ↗
(
    organisations: QuerySet[Organisation],
    days: int = 30,
)

Source from the content-addressed store, hash-verified

413
414
415def get_usage_trends(
416 organisations: QuerySet[Organisation],
417 days: int = 30,
418) -> list[UsageTrendData]:
419 org_ids = set(organisations.values_list("id", flat=True))
420 date_start = timezone.now() - timedelta(days=days)
421
422 if settings.USE_POSTGRES_FOR_ANALYTICS:
423 return _get_usage_trends_postgres(organisations, date_start)
424
425 if settings.INFLUXDB_TOKEN:
426 return _get_usage_trends_influx(org_ids, date_start)
427
428 logger.warning("no-analytics-database-configured")
429 return []
430
431
432def _get_usage_trends_postgres(

Callers

nothing calls this directly

Calls 3

_get_usage_trends_influxFunction · 0.85
setFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…