Skip to content

Commit

Permalink
linter fix
Browse files Browse the repository at this point in the history
  • Loading branch information
meln1k committed Feb 23, 2024
1 parent c9e5edb commit 00253ae
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
12 changes: 6 additions & 6 deletions plugins/aws/resoto_plugin_aws/resource/ec2.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 [
Expand All @@ -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"),
Expand Down
4 changes: 3 additions & 1 deletion plugins/aws/resoto_plugin_aws/resource/elb.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
}

Expand Down

0 comments on commit 00253ae

Please sign in to comment.