diff --git a/fixbackend/inventory/inventory_service.py b/fixbackend/inventory/inventory_service.py index 7658ceb6..a5cbd6d0 100644 --- a/fixbackend/inventory/inventory_service.py +++ b/fixbackend/inventory/inventory_service.py @@ -750,7 +750,11 @@ async def compute_inventory_info(duration: timedelta) -> InventorySummary: } async def progress( - metric: str, not_exist: int, group: Optional[Set[str]] = None, aggregation: Optional[str] = None + metric: str, + not_exist: int, + group: Optional[Set[str]] = None, + aggregation: Optional[str] = None, + filter_group: Optional[List[str]] = None, ) -> Tuple[int, int]: async with self.client.timeseries( dba, @@ -759,6 +763,7 @@ async def progress( end=now, granularity=duration, group=group, + filter_group=filter_group, aggregation=aggregation, ) as response: entries = [int(r["v"]) async for r in response] @@ -819,7 +824,7 @@ async def overall_score() -> Tuple[int, int]: resources_per_account_timeline(), overall_score(), nr_of_changes(), - progress("instances_total", 0, group=set(), aggregation="sum"), + progress("instances_total", 0, group=set(), aggregation="sum", filter_group=["status==running"]), progress("cores_total", 0, group=set(), aggregation="sum"), progress("memory_bytes", 0, group=set(), aggregation="sum"), progress("volumes_total", 0, group=set(), aggregation="sum"), diff --git a/fixbackend/notification/email/status_update_email_creator.py b/fixbackend/notification/email/status_update_email_creator.py index ae0b5bea..21b4726a 100644 --- a/fixbackend/notification/email/status_update_email_creator.py +++ b/fixbackend/notification/email/status_update_email_creator.py @@ -13,7 +13,7 @@ # along with this program. If not, see . import asyncio from datetime import timedelta, datetime -from typing import Optional, Tuple, Set, Dict, cast, Any, Callable +from typing import Optional, Tuple, Set, Dict, cast, Any, Callable, List import plotly.graph_objects as go from fixcloudutils.asyncio.process_pool import AsyncProcessPool @@ -124,10 +124,21 @@ async def _create_messages_dict( } async def progress( - metric: str, not_exist: int, group: Optional[Set[str]] = None, aggregation: Optional[str] = None + metric: str, + not_exist: int, + group: Optional[Set[str]] = None, + aggregation: Optional[str] = None, + filter_group: Optional[List[str]] = None, ) -> Tuple[int, int]: async with self.inventory_service.client.timeseries( - dba, metric, start=now - duration, end=now, granularity=duration, group=group, aggregation=aggregation + dba, + metric, + start=now - duration, + end=now, + granularity=duration, + group=group, + filter_group=filter_group, + aggregation=aggregation, ) as response: entries = [int(r["v"]) async for r in response] if len(entries) == 0: # timeseries haven't been created yet @@ -190,7 +201,7 @@ async def overall_score() -> Tuple[bytes, Tuple[int, int]]: resources_per_account_timeline(), overall_score(), nr_of_changes(), - progress("instances_total", 0, group=set(), aggregation="sum"), + progress("instances_total", 0, group=set(), aggregation="sum", filter_group=["status==running"]), progress("cores_total", 0, group=set(), aggregation="sum"), progress("memory_bytes", 0, group=set(), aggregation="sum"), progress("volumes_total", 0, group=set(), aggregation="sum"),