From 00253ae4b62b706833c3a180536958d86f468513 Mon Sep 17 00:00:00 2001 From: Nikita Melkozerov Date: Fri, 23 Feb 2024 17:26:43 +0000 Subject: [PATCH] linter fix --- plugins/aws/resoto_plugin_aws/resource/ec2.py | 12 ++++++------ plugins/aws/resoto_plugin_aws/resource/elb.py | 4 +++- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/plugins/aws/resoto_plugin_aws/resource/ec2.py b/plugins/aws/resoto_plugin_aws/resource/ec2.py index 8743bb9295..918d26db2b 100644 --- a/plugins/aws/resoto_plugin_aws/resource/ec2.py +++ b/plugins/aws/resoto_plugin_aws/resource/ec2.py @@ -1466,7 +1466,7 @@ def collect_usage_metrics(cls: Type[AwsResource], builder: GraphBuilder) -> None def bytes_to_mbps(bytes: float, period: int) -> float: return round(bytes * 8 / (1024**2) / period, 4) - + # we expect to have several datapoints for netowrk metrics, so we calculate min, max and avg def calculate_min_max_avg(values: List[float]) -> List[Tuple[float, Optional[StatName]]]: return [ @@ -1484,25 +1484,25 @@ def calculate_min_max_avg(values: List[float]) -> List[Tuple[float, Optional[Sta metric_name="network_in", compute_stats=calculate_min_max_avg, # normalize to Mbps - normalize_value=partial(bytes_to_mbps, period=network_period.seconds) + normalize_value=partial(bytes_to_mbps, period=network_period.seconds), ), "NetworkOut": MetricNormalization( metric_name="network_out", compute_stats=calculate_min_max_avg, # normalize to Mbps - normalize_value=partial(bytes_to_mbps, period=network_period.seconds) + normalize_value=partial(bytes_to_mbps, period=network_period.seconds), ), "NetworkPacketsIn": MetricNormalization( - metric_name="network_packets_in", + metric_name="network_packets_in", compute_stats=calculate_min_max_avg, # normalize to packets per second - normalize_value=lambda x: round(x / network_period.seconds, 4) + normalize_value=lambda x: round(x / network_period.seconds, 4), ), "NetworkPacketsOut": MetricNormalization( metric_name="network_packets_out", compute_stats=calculate_min_max_avg, # normalize to packets per second - normalize_value=lambda x: round(x / network_period.seconds, 4) + normalize_value=lambda x: round(x / network_period.seconds, 4), ), "DiskReadOps": MetricNormalization(metric_name="disk_read_ops"), "DiskWriteOps": MetricNormalization(metric_name="disk_write_ops"), diff --git a/plugins/aws/resoto_plugin_aws/resource/elb.py b/plugins/aws/resoto_plugin_aws/resource/elb.py index aa2c2f8b49..f9dde4011b 100644 --- a/plugins/aws/resoto_plugin_aws/resource/elb.py +++ b/plugins/aws/resoto_plugin_aws/resource/elb.py @@ -413,7 +413,9 @@ def collect_usage_metrics(cls: Type[AwsResource], builder: GraphBuilder) -> None "HTTPCode_Backend_5XX_Count": MetricNormalization(metric_name="status_code_5xx_count"), "HealthyHostCount": MetricNormalization(metric_name="healthy_host_count"), "UnHealthyHostCount": MetricNormalization(metric_name="unhealthy_host_count"), - "Latency": MetricNormalization(metric_name="latency_seconds", normalize_value=lambda x: round(x, ndigits=3)), + "Latency": MetricNormalization( + metric_name="latency_seconds", normalize_value=lambda x: round(x, ndigits=3) + ), "EstimatedProcessedBytes": MetricNormalization(metric_name="processed_bytes"), }