Skip to content

Commit

Permalink
ci: decorate metrics with the host OS
Browse files Browse the repository at this point in the history
Until now, kernel version has been enough to disambiguate the OS, but by
being explicit we can disambiguate in the case we have distinct OSes
with the same kernel.

Signed-off-by: Pablo Barbáchano <[email protected]>
  • Loading branch information
pb8o committed Oct 4, 2023
1 parent 5326773 commit b3b3cab
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
19 changes: 19 additions & 0 deletions tests/framework/properties.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,24 @@ def get_os_version():
return match.group(1)


def get_host_os(kv: str = None):
"""
Extract OS information from the kernel if it's there.
This only works for AL2 and AL2023
>>> get_host_os("6.1.41-63.118.amzn2023.x86_64")
amzn2023
"""
if kv is None:
kv = platform.release()
parts = kv.split("-")
misc = parts[1].split(".")
if len(misc) > 2 and misc[2] in {"amzn2", "amzn2023"}:
return misc[2]
return None


class GlobalProps:
"""Class to hold metadata about the testrun environment"""

Expand All @@ -52,6 +70,7 @@ def __init__(self):
# major.minor.patch
self.host_linux_patch = get_kernel_version(2)
self.os = get_os_version()
self.host_os = get_host_os()
self.libc_ver = "-".join(platform.libc_ver())
self.git_commit_id = run_cmd("git rev-parse HEAD")
self.git_branch = run_cmd("git show -s --pretty=%D HEAD")
Expand Down
1 change: 1 addition & 0 deletions tests/integration_tests/performance/test_boottime.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
DIMENSIONS = {
"instance": global_props.instance,
"cpu_model": global_props.cpu_model,
"host_os": global_props.host_os,
"host_kernel": "linux-" + global_props.host_linux_version,
}

Expand Down

0 comments on commit b3b3cab

Please sign in to comment.