Skip to content

Commit

Permalink
Correctly serialize Rates as documented into CommonMetricData
Browse files Browse the repository at this point in the history
  • Loading branch information
badboy committed Dec 1, 2022
1 parent 0960293 commit 4e2b161
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions glean_parser/rust.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,17 @@ def iterencode(self, value):
yield "None"
elif isinstance(value, str):
yield f'"{value}".into()'
elif isinstance(value, metrics.Rate):
yield "CommonMetricData("
first = True
for arg_name in util.common_metric_args:
if hasattr(value, arg_name):
if not first:
yield ", "
yield f"{util.camelize(arg_name)} = "
yield from self.iterencode(getattr(value, arg_name))
first = False
yield ")"
else:
yield from super().iterencode(value)

Expand Down

0 comments on commit 4e2b161

Please sign in to comment.