in probe_scraper/parsers/metrics.py [0:0]
def parse(self, filenames, config, repo_url=None, commit_hash=None):
config = config.copy()
config["do_not_disable_expired"] = True
paths = [Path(fname) for fname in filenames]
paths = [path for path in paths if path.is_file()]
results = parse_objects(paths, config)
errors = [err for err in results]
metrics = {
metric.identifier(): metric.serialize()
for category, probes in results.value.items()
for probe_name, metric in probes.items()
}
for v in metrics.values():
v["send_in_pings"] = [normalize_ping_name(p) for p in v["send_in_pings"]]
if repo_url and commit_hash:
v["source_url"] = get_source_url(v["defined_in"], repo_url, commit_hash)
# the 'defined_in' structure is no longer needed
del v["defined_in"]
return metrics, errors