Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug 1855046 - Allow unit only for the quantity metric #630

Merged
merged 2 commits into from Oct 3, 2023

Conversation

badboy
Copy link
Member

@badboy badboy commented Sep 26, 2023

This is implemented the same way time_unit is implemented for others: The specific metric class takes the argument, not the generic one.

Because the schema enforces unit to be required for quantity we can just pop it with the guarantee it's there.

The error message for other metrics if they do set unit is less nice:

Metric.__init__() got an unexpected keyword argument 'unit'

But that's in line with what time_unit also does.


10 minute explore of what it takes.
Needs a changelog entry and probably an additional test to cover it. I'd appreciate if someone is taking this off my hands.

@badboy badboy requested a review from chutten September 27, 2023 14:47
@badboy badboy force-pushed the disallow-unit-everywhere-but-quantity branch from be4ff53 to 5b32377 Compare September 27, 2023 14:52
@badboy badboy force-pushed the disallow-unit-everywhere-but-quantity branch from 5b32377 to 8f3b25a Compare September 27, 2023 14:55
This is implemented the same way time_unit is implemented for others:
The specific metric class takes the argument, not the generic one.

Because the schema enforces `unit` to be required for `quantity` we can
just `pop` it with the guarantee it's there.

The error message for other metrics if they do set `unit` is less nice:

    Metric.__init__() got an unexpected keyword argument 'unit'

But that's in line with what `time_unit` also does.
@badboy badboy force-pushed the disallow-unit-everywhere-but-quantity branch from 8f3b25a to 813dcfd Compare September 27, 2023 14:56
@chutten chutten merged commit 5079870 into main Oct 3, 2023
7 checks passed
@chutten chutten deleted the disallow-unit-everywhere-but-quantity branch October 3, 2023 14:31
badboy added a commit that referenced this pull request Nov 3, 2023
This partially reverts #630 (and subsequent fixes) and should unblock
all failures in probe-scraper and co.
badboy added a commit that referenced this pull request Nov 3, 2023
This partially reverts #630 (and subsequent fixes) and should unblock
all failures in probe-scraper and co.
badboy added a commit that referenced this pull request Nov 3, 2023
This partially reverts #630 (and subsequent fixes) and should unblock
all failures in probe-scraper and co.
badboy added a commit that referenced this pull request Nov 3, 2023
This partially reverts #630 (and subsequent fixes) and should unblock
all failures in probe-scraper and co.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants