def build_sessions_query(self, request: Request, organization):
        try:
            params = self.get_filter_params(request,
                                            organization,
                                            date_filter_optional=True)
        except NoProjects:
            raise NoProjects("No projects available")  # give it a description

        # HACK to prevent front-end crash when release health is sessions-based:
        query_params = MultiValueDict(request.GET)
        if not release_health.is_metrics_based() and request.GET.get(
                "interval") == "10s":
            query_params["interval"] = "1m"

        if release_health.is_metrics_based():
            allowed_resolution = AllowedResolution.ten_seconds
        elif features.has("organizations:minute-resolution-sessions",
                          organization,
                          actor=request.user):
            allowed_resolution = AllowedResolution.one_minute
        else:
            allowed_resolution = AllowedResolution.one_hour

        return QueryDefinition(query_params,
                               params,
                               allowed_resolution=allowed_resolution)
Example #2
0
    def build_sessions_query(self, request, organization):
        # validate and default all `project` params.
        projects = self.get_projects(request, organization)
        if projects is None or len(projects) == 0:
            raise NoProjects("No projects available")
        project_ids = [p.id for p in projects]

        return QueryDefinition(request.GET, project_ids)
Example #3
0
    def build_sessions_query(self, request, organization):
        try:
            params = self.get_filter_params(request,
                                            organization,
                                            date_filter_optional=True)
        except NoProjects:
            raise NoProjects("No projects available")  # give it a description

        return QueryDefinition(request.GET, params)
Example #4
0
    def build_outcomes_query(self, request, organization):
        try:
            params = self.get_filter_params(request,
                                            organization,
                                            date_filter_optional=True)
        except NoProjects:
            raise NoProjects("No projects available")

        return QueryDefinition(
            request.GET,
            params,
        )
 def _get_projects_for_orgstats_query(self, request: Request, organization):
     # look at the raw project_id filter passed in, if its empty
     # and project_id is not in groupBy filter, treat it as an
     # org wide query and don't pass project_id in to QueryDefinition
     req_proj_ids = self.get_requested_project_ids_unchecked(request)
     if self._is_org_total_query(request, req_proj_ids):
         return None
     else:
         projects = self.get_projects(request, organization, project_ids=req_proj_ids)
         if not projects:
             raise NoProjects("No projects available")
         return [p.id for p in projects]
    def build_sessions_query(self, request, organization):
        try:
            params = self.get_filter_params(request,
                                            organization,
                                            date_filter_optional=True)
        except NoProjects:
            raise NoProjects("No projects available")  # give it a description

        allow_minute_resolution = features.has(
            "organizations:minute-resolution-sessions",
            organization,
            actor=request.user)
        return QueryDefinition(request.GET,
                               params,
                               allow_minute_resolution=allow_minute_resolution)