Skip to content

Commit 1ac85f0

Browse files
grievejiafacebook-github-bot
authored andcommitted
Implement pyre statistics (8/9) -- log to remote
Reviewed By: dkgi Differential Revision: D30414553 fbshipit-source-id: 6c1e8f04a2926057a0787358d993369511c1e8b3
1 parent 4f194d0 commit 1ac85f0

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

client/commands/v2/statistics.py

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
command_arguments,
1717
configuration as configuration_module,
1818
statistics_collectors as collectors,
19+
statistics,
1920
)
2021
from . import remote_logging
2122

@@ -187,6 +188,41 @@ def aggregate_statistics(data: StatisticsData) -> AggregatedStatisticsData:
187188
)
188189

189190

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+
190226
def run_statistics(
191227
configuration: configuration_module.Configuration,
192228
statistics_arguments: command_arguments.StatisticsArguments,

0 commit comments

Comments
 (0)