0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-11-25 17:31:41 +01:00
mongodb/buildscripts/util/cedar_report.py
Steve McClure b4b23946cd SERVER-90570: Enable formatting checks for buildscripts directory, excluding idl (#22254)
GitOrigin-RevId: 9d997a9f44cd43a8dec7c2a17fa2dbcd875e92f6
2024-05-16 22:07:36 +00:00

45 lines
1.0 KiB
Python

"""Cedar report."""
from dataclasses import dataclass
from typing import Union, List
@dataclass
class CedarMetric:
"""Structure that holds metrics for Cedar."""
name: str
type: str
value: Union[int, float]
user_submitted: bool = False
def as_dict(self) -> dict:
"""Return dictionary representation."""
return {
"name": self.name,
"type": self.type,
"value": self.value,
"user_submitted": self.user_submitted,
}
@dataclass
class CedarTestReport:
"""Structure that holds test report for Cedar."""
test_name: str
thread_level: int
metrics: List[CedarMetric]
def as_dict(self) -> dict:
"""Return dictionary representation."""
return {
"info": {
"test_name": self.test_name,
"args": {
"thread_level": self.thread_level,
},
},
"metrics": [metric.as_dict() for metric in self.metrics],
}