Esempio n. 1
0
 def get_query_processors(self) -> Sequence[QueryProcessor]:
     return [
         BasicFunctionsProcessor(),
         TimeSeriesProcessor({"time": "timestamp"}, ("timestamp", )),
         ReferrerRateLimiterProcessor(),
         OrganizationRateLimiterProcessor(org_column="org_id"),
     ]
Esempio n. 2
0
 def get_query_processors(self) -> Sequence[QueryProcessor]:
     return [
         BasicFunctionsProcessor(),
         TimeSeriesProcessor({"bucketed_started": "started"},
                             ("started", "received")),
         OrganizationRateLimiterProcessor(org_column="org_id"),
         ProjectRateLimiterProcessor(project_column="project_id"),
     ]
Esempio n. 3
0
 def get_query_processors(self) -> Sequence[QueryProcessor]:
     return [
         OrganizationRateLimiterProcessor(org_column="organization_id"),
         ReferrerRateLimiterProcessor(),
         ProjectReferrerRateLimiter("project_id"),
         ProjectRateLimiterProcessor(project_column="project_id"),
         ResourceQuotaProcessor("project_id"),
     ]
Esempio n. 4
0
 def get_query_processors(self) -> Sequence[QueryProcessor]:
     return [
         GranularityProcessor(),
         TimeSeriesProcessor({"bucketed_time": "timestamp"},
                             ("timestamp", )),
         ReferrerRateLimiterProcessor(),
         OrganizationRateLimiterProcessor(org_column="org_id"),
         ProjectReferrerRateLimiter("project_id"),
         ProjectRateLimiterProcessor(project_column="project_id"),
         ResourceQuotaProcessor("project_id"),
         TagsTypeTransformer(),
     ]
Esempio n. 5
0
def test_org_rate_limit_processor(unprocessed: Expression,
                                  org_id: int) -> None:
    query = Query(
        QueryEntity(EntityKey.EVENTS, EntityColumnSet([])),
        selected_columns=[
            SelectedExpression("column2", Column(None, None, "column2"))
        ],
        condition=unprocessed,
    )
    settings = HTTPQuerySettings()

    num_before = len(settings.get_rate_limit_params())
    OrganizationRateLimiterProcessor("org_id").process_query(query, settings)
    assert len(settings.get_rate_limit_params()) == num_before + 1
    rate_limiter = settings.get_rate_limit_params()[-1]
    assert rate_limiter.rate_limit_name == ORGANIZATION_RATE_LIMIT_NAME
    assert rate_limiter.bucket == str(org_id)
    assert rate_limiter.per_second_limit == 1000
    assert rate_limiter.concurrent_limit == 1000