Skip to content

Commit

Permalink
Do not drop service request num to 0 on the chart for the periods whe…
Browse files Browse the repository at this point in the history
…n serving model was not reporting
  • Loading branch information
clearml committed Dec 31, 2024
1 parent 8c29eba commit b7795b3
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
13 changes: 9 additions & 4 deletions apiserver/bll/serving/stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,15 +270,20 @@ def get_endpoint_metrics(
}
},
}
hist_params = {}
if metric_type == MetricType.requests:
hist_params["min_doc_count"] = 1
else:
hist_params["extended_bounds"] = {
"min": int(from_date) * 1000,
"max": int(to_date) * 1000,
}
aggs = {
"dates": {
"date_histogram": {
"field": "timestamp",
"fixed_interval": f"{interval}s",
"extended_bounds": {
"min": int(from_date) * 1000,
"max": int(to_date) * 1000,
},
**hist_params,
},
"aggs": aggs,
}
Expand Down
9 changes: 7 additions & 2 deletions apiserver/utilities/dicts.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Sequence, Tuple, Any, Union, Callable, Optional, Mapping
from typing import Sequence, Tuple, Any, Union, Callable, Optional, Protocol


def flatten_nested_items(
Expand Down Expand Up @@ -35,8 +35,13 @@ def deep_merge(source: dict, override: dict) -> dict:
return source


class GetItem(Protocol):
def __getitem__(self, key: Any) -> Any:
pass


def nested_get(
dictionary: Mapping,
dictionary: GetItem,
path: Sequence[str],
default: Optional[Union[Any, Callable]] = None,
) -> Any:
Expand Down

0 comments on commit b7795b3

Please sign in to comment.