118
118
"p75" : "p75" ,
119
119
"p95" : "p95" ,
120
120
"p99" : "p99" ,
121
- "p100" : "p100"
121
+ # p100 is not supported in the metrics layer, so we convert to max which is equivalent.
122
+ "p100" : "max"
122
123
# generic percentile is not supported by metrics layer.
123
124
}
124
125
@@ -311,7 +312,6 @@ def _get_aggregate_supported_by(aggregate: str) -> SupportedBy:
311
312
return SupportedBy .neither ()
312
313
313
314
match = fields .is_function (aggregate )
314
-
315
315
if not match :
316
316
raise InvalidSearchQuery (f"Invalid characters in field { aggregate } " )
317
317
@@ -320,7 +320,6 @@ def _get_aggregate_supported_by(aggregate: str) -> SupportedBy:
320
320
args_support = _get_args_support (function , args )
321
321
322
322
return SupportedBy .combine (function_support , args_support )
323
-
324
323
except InvalidSearchQuery :
325
324
logger .error (f"Failed to parse aggregate: { aggregate } " , exc_info = True )
326
325
@@ -348,7 +347,7 @@ def _get_percentile_support(args: Sequence[str]) -> SupportedBy:
348
347
if not _get_percentile_op (args ):
349
348
return SupportedBy .neither ()
350
349
351
- return SupportedBy ( standard_metrics = False , on_demand_metrics = True )
350
+ return SupportedBy . both ( )
352
351
353
352
354
353
def _get_percentile_op (args : Sequence [str ]) -> Optional [MetricOperationType ]:
@@ -924,6 +923,7 @@ def _process_query(self) -> Optional[RuleCondition]:
924
923
# derived metrics have their conditions injected in the tags
925
924
if self ._get_op (parsed_field .function , parsed_field .arguments ) in _DERIVED_METRICS :
926
925
return None
926
+
927
927
raise Exception ("This query should not use on demand metrics" )
928
928
929
929
return aggregate_conditions
@@ -963,10 +963,7 @@ def _parse_arguments(
963
963
raise Exception (f"The operation { op } supports one or more parameters" )
964
964
965
965
arguments = parsed_field .arguments
966
- map_argument = op not in _MULTIPLE_ARGS_METRICS
967
-
968
- first_argument = arguments [0 ]
969
- return [_map_field_name (first_argument )] if map_argument else arguments
966
+ return [_map_field_name (arguments [0 ])] if op not in _MULTIPLE_ARGS_METRICS else arguments
970
967
971
968
@staticmethod
972
969
def _get_op (function : str , args : Sequence [str ]) -> MetricOperationType :
@@ -995,7 +992,6 @@ def _get_metric_type(function: str) -> str:
995
992
def _parse_field (value : str ) -> Optional [FieldParsingResult ]:
996
993
try :
997
994
match = fields .is_function (value )
998
-
999
995
if not match :
1000
996
raise InvalidSearchQuery (f"Invalid characters in field { value } " )
1001
997
0 commit comments