Skip to content

Commit

Permalink
bug 1657947 - New metric types labeled_{custom|memory|timing}_distrib…
Browse files Browse the repository at this point in the history
…ution
  • Loading branch information
chutten committed Jul 12, 2024
1 parent 4331690 commit 2bd34de
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## Unreleased

- New Metric Types: `labeled_{custom|memory|timing}_distribution` ([bug 1657947](https://bugzilla.mozilla.org/show_bug.cgi?id=1657947))

## 14.1.3

- Fix Kotlin/Swift code generation for object metrics, now generating top-level typealiases where needed ([#722](https://github.com/mozilla/glean_parser/pull/722))
Expand Down
9 changes: 9 additions & 0 deletions glean_parser/metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,15 @@ class LabeledString(Labeled, String):
class LabeledCounter(Labeled, Counter):
typename = "labeled_counter"

class LabeledCustomDistribution(Labeled, CustomDistribution):
typename = "labeled_custom_distribution"

class LabeledMemoryDistribution(Labeled, MemoryDistribution):
typename = "labeled_memory_distribution"

class LabeledTimingDistribution(Labeled, TimingDistribution):
typename = "labeled_timing_distribution"


class Rate(Metric):
typename = "rate"
Expand Down
7 changes: 6 additions & 1 deletion glean_parser/schemas/metrics.2-0-0.schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,9 @@ definitions:
of the metric to be stored at a given set of labels. The labeled
metric types include:
`labeled_boolean`, `labeled_string`, `labeled_counter`.
`labeled_boolean`, `labeled_string`, `labeled_counter`,
`labeled_custom_distribution`, `labeled_memory_distribution`,
`labeled_timing_distribution`.
- `text`: Record long text data.
Expand All @@ -141,6 +143,9 @@ definitions:
- labeled_boolean
- labeled_string
- labeled_counter
- labeled_custom_distribution
- labeled_memory_distribution
- labeled_timing_distribution
- rate
- text
- object
Expand Down
27 changes: 27 additions & 0 deletions tests/data/all_metrics.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -118,3 +118,30 @@ all_metrics:
text:
<<: *defaults
type: text

labeled_custom_distribution:
<<: *defaults
type: labeled_custom_distribution
range_min: 0
range_max: 100
bucket_count: 10
histogram_type: linear
labels:
- aLabel
- 2label

labeled_memory_distribution:
<<: *defaults
type: labeled_memory_distribution
memory_unit: kilobyte
labels:
- aLabel
- 2label

labeled_timing_distribution:
<<: *defaults
type: labeled_timing_distribution
time_unit: millisecond
labels:
- aLabel
- 2label

0 comments on commit 2bd34de

Please sign in to comment.