def get_project_releases_count( self, organization_id: OrganizationId, project_ids: Sequence[ProjectId], scope: str, stats_period: Optional[str] = None, environments: Optional[Sequence[EnvironmentName]] = None, ) -> int: schema = ComparatorType.Counter if stats_period is None: stats_period = "24h" if scope.endswith("_24h"): stats_period = "24h" rollup, stats_start, _ = get_rollup_starts_and_buckets(stats_period) should_compare = lambda _: _coerce_utc(stats_start) > self.metrics_start organization = self._org_from_id(organization_id) return self._dispatch_call( # type: ignore "get_project_releases_count", should_compare, rollup, organization, schema, organization_id, project_ids, scope, stats_period, environments, )
def get_project_releases_by_stability( self, project_ids: Sequence[ProjectId], offset: Optional[int], limit: Optional[int], scope: str, stats_period: Optional[str] = None, environments: Optional[Sequence[str]] = None, ) -> Sequence[ProjectRelease]: schema = [ComparatorType.Exact] if stats_period is None: stats_period = "24h" if scope.endswith("_24h"): stats_period = "24h" rollup, stats_start, _ = get_rollup_starts_and_buckets(stats_period) should_compare = lambda _: _coerce_utc(stats_start) > self.metrics_start organization = self._org_from_projects(project_ids) return self._dispatch_call( # type: ignore "get_project_releases_by_stability", should_compare, rollup, organization, schema, project_ids, offset, limit, scope, stats_period, environments, )
def get_project_releases_by_stability( self, project_ids: Sequence[ProjectId], offset: Optional[int], limit: Optional[int], scope: str, stats_period: Optional[str] = None, environments: Optional[Sequence[str]] = None, now: Optional[datetime] = None, ) -> Sequence[ProjectRelease]: schema = ListSet(schema=ComparatorType.Exact, index_by=lambda x: x) set_tag("gprbs.limit", str(limit)) set_tag("gprbs.offset", str(offset)) set_tag("gprbs.scope", str(scope)) if stats_period is None: stats_period = "24h" if scope.endswith("_24h"): stats_period = "24h" if now is None: now = datetime.now(pytz.utc) rollup, stats_start, _ = get_rollup_starts_and_buckets(stats_period, now=now) should_compare = lambda _: now > self.metrics_start organization = self._org_from_projects(project_ids) return self._dispatch_call( # type: ignore "get_project_releases_by_stability", should_compare, rollup, organization, schema, project_ids, offset, limit, scope, stats_period, environments, )