Open Bug 1865626 Opened 1 year ago Updated 2 months ago

Glean probe example fails to build - expires field has wrong type

Categories

(Data Platform and Tools :: Glean: SDK, defect, P3)

defect

Tracking

(Not tracked)

People

(Reporter: valentin, Unassigned)

Details

(Whiteboard: [telemetry:glean-rs:m17][docdays])

When looking through the Glean docs to add a new metric I found the following example:
https://mozilla.github.io/glean/book/reference/metrics/counter.html#metric-parameters

controls:
  refresh_pressed:
    type: counter
    description: >
      Counts how often the refresh button is pressed.
    bugs:
      - https://bugzilla.mozilla.org/000000
    data_reviews:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=000000#c3
    notification_emails:
      - me@mozilla.com
    expires: 2020-10-01

But when trying to build a similar metric for Firefox, I got this build error:

 0:10.21   File "c:\users\valentin\.mozbuild\srcdirs\mozilla-unified-a0962ab787b4\_virtualenvs\mach\lib\site-packages\glean_parser\metrics.py", line 202, in is_disabled
 0:10.21     return self.disabled or self.is_expired()
 0:10.21   File "c:\users\valentin\.mozbuild\srcdirs\mozilla-unified-a0962ab787b4\_virtualenvs\mach\lib\site-packages\glean_parser\metrics.py", line 208, in is_expired
 0:10.21     return self._config.get("custom_is_expired", default_handler)(self.expires)
 0:10.21   File "c:\users\valentin\.mozbuild\srcdirs\mozilla-unified-a0962ab787b4\_virtualenvs\mach\lib\site-packages\glean_parser\metrics.py", line 206, in default_handler
 0:10.21     return util.is_expired(expires, self._config.get("expire_by_version"))
 0:10.22   File "c:\users\valentin\.mozbuild\srcdirs\mozilla-unified-a0962ab787b4\_virtualenvs\mach\lib\site-packages\glean_parser\util.py", line 401, in is_expired
 0:10.22     return parse_expiration_version(expires) <= major_version
 0:10.22   File "c:\users\valentin\.mozbuild\srcdirs\mozilla-unified-a0962ab787b4\_virtualenvs\mach\lib\site-packages\glean_parser\util.py", line 386, in parse_expiration_version
 0:10.22     raise ValueError(
 0:10.22 ValueError: Invalid expiration version '2024-09-01'. Must be a positive integer.

The message hinted that it should be a Firefox version, which I confirmed by looking at some other metrics.yaml instances in the code.

This isn't a big deal, but it was odd that the documentation provided an invalid example.

Priority: -- → P3
Whiteboard: [telemetry:glean-rs:m17][docdays]
You need to log in before you can comment on or make changes to this bug.