Skip to content

Commit 6f16d70

Browse files
Sudan Landgewearyzen
authored andcommitted
chore: Upload FCMetrics with reduced dimensions
FC metrics were uploaded to CW with the same dimensions as the test to make it easy to map the metrics with the test in CW. However, each test has a huge number of dimensions which when multiplied with the number of FC metrics we upload add upto too many datapoints stored in CW. This makes CW slow hard to monitor the dashboard and also has a significant increase in billing. So limit the dimensions to (cpu-host_version-guest_version) so that we can monitor the dashboard properly and reduce the billing. To map the datapoints with the test that emitted them we'll have to use the datapoint timestamp with some CW query. Signed-off-by: Sudan Landge <sudanl@amazon.com>
1 parent c910e44 commit 6f16d70

File tree

6 files changed

+21
-12
lines changed

6 files changed

+21
-12
lines changed

tests/host_tools/fcmetrics.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616
import jsonschema
1717
import pytest
1818

19+
from framework.properties import global_props
20+
from host_tools.metrics import get_metrics_logger
21+
1922

2023
def validate_fc_metrics(metrics):
2124
"""
@@ -434,15 +437,22 @@ class FCMetricsMonitor(Thread):
434437
of the metrics.
435438
"""
436439

437-
def __init__(self, vm, metrics_logger, timer=60):
440+
def __init__(self, vm, timer=60):
438441
Thread.__init__(self, daemon=True)
439442
self.vm = vm
440443
self.timer = timer
441444

442445
self.metrics_index = 0
443446
self.running = False
444447

445-
self.metrics_logger = metrics_logger
448+
self.metrics_logger = get_metrics_logger()
449+
self.metrics_logger.set_dimensions(
450+
{
451+
"instance": global_props.instance,
452+
"host_kernel": "linux-" + global_props.host_linux_version,
453+
"guest_kernel": vm.kernel_file.stem[2:],
454+
}
455+
)
446456

447457
def _flush_metrics(self):
448458
"""

tests/integration_tests/performance/test_block_ab.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ def test_block_performance(
176176
**vm.dimensions,
177177
}
178178
)
179-
fcmetrics = FCMetricsMonitor(vm, metrics)
179+
fcmetrics = FCMetricsMonitor(vm)
180180
fcmetrics.start()
181181

182182
vm.pin_threads(0)
@@ -227,7 +227,7 @@ def test_block_vhost_user_performance(
227227
**vm.dimensions,
228228
}
229229
)
230-
fcmetrics = FCMetricsMonitor(vm, metrics)
230+
fcmetrics = FCMetricsMonitor(vm)
231231
fcmetrics.start()
232232

233233
next_cpu = vm.pin_threads(0)

tests/integration_tests/performance/test_memory_overhead.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def test_memory_overhead(
4747
metrics.set_dimensions(
4848
{"performance_test": "test_memory_overhead", **microvm.dimensions}
4949
)
50-
fcmetrics = FCMetricsMonitor(microvm, metrics)
50+
fcmetrics = FCMetricsMonitor(microvm)
5151
fcmetrics.start()
5252

5353
# check that the vm is running

tests/integration_tests/performance/test_network_ab.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ def test_network_latency(network_microvm, metrics, iteration):
8383
"iteration": str(iteration),
8484
}
8585
)
86-
fcmetrics = FCMetricsMonitor(network_microvm, metrics)
86+
fcmetrics = FCMetricsMonitor(network_microvm)
8787
fcmetrics.start()
8888

8989
samples = []
@@ -160,7 +160,7 @@ def test_network_tcp_throughput(
160160
**network_microvm.dimensions,
161161
}
162162
)
163-
fcmetrics = FCMetricsMonitor(network_microvm, metrics)
163+
fcmetrics = FCMetricsMonitor(network_microvm)
164164
fcmetrics.start()
165165

166166
test = TcpIPerf3Test(

tests/integration_tests/performance/test_snapshot_ab.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ def configure_vm(
7777

7878
return vm
7979

80-
def sample_latency(self, microvm_factory, snapshot, metrics_logger) -> List[float]:
80+
def sample_latency(self, microvm_factory, snapshot) -> List[float]:
8181
"""Collects latency samples for the microvm configuration specified by this instance"""
8282
values = []
8383

@@ -88,7 +88,7 @@ def sample_latency(self, microvm_factory, snapshot, metrics_logger) -> List[floa
8888
microvm.spawn()
8989
microvm.restore_from_snapshot(snapshot, resume=True)
9090

91-
fcmetrics = FCMetricsMonitor(microvm, metrics_logger)
91+
fcmetrics = FCMetricsMonitor(microvm)
9292
fcmetrics.start()
9393

9494
# Check if guest still runs commands.
@@ -152,7 +152,7 @@ def test_restore_latency(
152152
**vm.dimensions,
153153
}
154154
)
155-
fcmetrics = FCMetricsMonitor(vm, metrics)
155+
fcmetrics = FCMetricsMonitor(vm)
156156
fcmetrics.start()
157157

158158
snapshot = vm.snapshot_full()
@@ -162,7 +162,6 @@ def test_restore_latency(
162162
samples = test_setup.sample_latency(
163163
microvm_factory,
164164
snapshot,
165-
metrics,
166165
)
167166

168167
for sample in samples:

tests/integration_tests/performance/test_vsock_ab.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ def test_vsock_throughput(
102102
**vm.dimensions,
103103
}
104104
)
105-
fcmetrics = FCMetricsMonitor(vm, metrics)
105+
fcmetrics = FCMetricsMonitor(vm)
106106
fcmetrics.start()
107107

108108
vm.pin_threads(0)

0 commit comments

Comments
 (0)