Skip to content

Commit

Permalink
fix(tests, scale): do not get container stats in CI
Browse files Browse the repository at this point in the history
Signed-off-by: Fatih Acar <[email protected]>
  • Loading branch information
fatih-acar committed Feb 22, 2024
1 parent acf97c1 commit 862b2b5
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions backend/tests/scale/common/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,24 +62,26 @@ def wrapped(self, task):
def request_event_handler(
request_type, name, response_time, response_length, response, context, exception, start_time, **kwargs
):
server_container_stats = get_container_resource_usage(config.server_container)
db_container_stats = get_container_resource_usage(config.db_container)
graphdb_stats = get_graphdb_stats()

result = {
"name": name,
"start_time": f"{start_time:.2f}",
"response_time": f"{response_time:.2f}ms",
"server_cpu": f"{server_container_stats.cpu_usage:.2f}%",
"server_memory": f"{server_container_stats.memory_usage}B",
"db_cpu": f"{db_container_stats.cpu_usage:.2f}%",
"db_memory": f"{db_container_stats.memory_usage}B",
"db_size": f"{graphdb_stats.db_size}B",
"db_node_count": graphdb_stats.node_count,
"db_rel_count": graphdb_stats.rel_count,
"failed": True if exception else False,
}

if os.getenv("CI") is None:
server_container_stats = get_container_resource_usage(config.server_container)
db_container_stats = get_container_resource_usage(config.db_container)

result["server_cpu"] = f"{server_container_stats.cpu_usage:.2f}%"
result["server_memory"] = f"{server_container_stats.memory_usage}B"
result["db_cpu"] = f"{db_container_stats.cpu_usage:.2f}%"
result["db_memory"] = f"{db_container_stats.memory_usage}B"

output = []
output = [f"{k}={v}" for k, v in result.items()]
print(", ".join(output))
Expand Down

0 comments on commit 862b2b5

Please sign in to comment.