mirror of
https://github.com/mongodb/mongo.git
synced 2024-11-25 17:31:41 +01:00
b4b23946cd
GitOrigin-RevId: 9d997a9f44cd43a8dec7c2a17fa2dbcd875e92f6
45 lines
1.0 KiB
Python
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],
|
|
}
|