|
16 | 16 | command_arguments, |
17 | 17 | configuration as configuration_module, |
18 | 18 | statistics_collectors as collectors, |
| 19 | + statistics, |
19 | 20 | ) |
20 | 21 | from . import remote_logging |
21 | 22 |
|
@@ -187,6 +188,41 @@ def aggregate_statistics(data: StatisticsData) -> AggregatedStatisticsData: |
187 | 188 | ) |
188 | 189 |
|
189 | 190 |
|
| 191 | +def log_to_remote(logger: str, run_id: str, data: Dict[str, Any]) -> None: |
| 192 | + def _log_fixmes(fixme_type: str, data: Dict[str, int], path: str) -> None: |
| 193 | + for error_code, count in data.items(): |
| 194 | + statistics.log( |
| 195 | + statistics.LoggerCategory.FIXME_COUNTS, |
| 196 | + logger, |
| 197 | + integers={"count": count}, |
| 198 | + normals={ |
| 199 | + "run_id": run_id, |
| 200 | + "code": error_code, |
| 201 | + "type": fixme_type, |
| 202 | + "path": path, |
| 203 | + }, |
| 204 | + ) |
| 205 | + |
| 206 | + for path, counts in data["annotations"].items(): |
| 207 | + statistics.log( |
| 208 | + statistics.LoggerCategory.ANNOTATION_COUNTS, |
| 209 | + logger, |
| 210 | + integers=counts, |
| 211 | + normals={"run_id": run_id, "path": path}, |
| 212 | + ) |
| 213 | + for path, counts in data["fixmes"].items(): |
| 214 | + _log_fixmes("fixme", counts, path) |
| 215 | + for path, counts in data["ignores"].items(): |
| 216 | + _log_fixmes("ignore", counts, path) |
| 217 | + for path, counts in data["strict"].items(): |
| 218 | + statistics.log( |
| 219 | + statistics.LoggerCategory.STRICT_ADOPTION, |
| 220 | + logger, |
| 221 | + integers=counts, |
| 222 | + normals={"run_id": run_id, "path": path}, |
| 223 | + ) |
| 224 | + |
| 225 | + |
190 | 226 | def run_statistics( |
191 | 227 | configuration: configuration_module.Configuration, |
192 | 228 | statistics_arguments: command_arguments.StatisticsArguments, |
|
0 commit comments