-
Notifications
You must be signed in to change notification settings - Fork 127
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
Python: Implement timing distribution #762
Conversation
e303320
to
0bf975d
Compare
0bf975d
to
635417b
Compare
|
||
There are test APIs available too. For convenience, properties `sum` and `count` are exposed to facilitate validating that data was recorded correctly. | ||
|
||
Continuing the `page_load` example above, at this point the metric should have a `sum == 11` and a `count == 2`: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Re-reading this now I somehow find it confusing that "it should have" values.
This is a general problem with the example though and repeated across all languages.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense. We can handle updating all of the language examples at once as part of that bug.
assert 2 == snapshot.count | ||
|
||
# Was an error recorded? | ||
assert 1 == metrics.pages.page_load.test_get_num_recorded_errors( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See, it's nowhere clear that above example causes an error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let me file a bug
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -76,7 +76,7 @@ class TimingDistributionMetricType internal constructor( | |||
return null | |||
} | |||
|
|||
// The Rust code for [stopAndAccumulate] runs async and we need to use the same clock for start and stop. | |||
// The Rust code for [start] runs async and we need to use the same clock for start and stop. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Woops, good catch
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ooooh wait, the comment was correct, just not super clear.
start
does run sync (there's no dispatcher in use).
But stop
runs async (we don't care about its return value) and THAT's why we need to use getElapsedTimeNanos
in both because we need to use the same clock source.
I'm all for extending the comment, but the original was already more correct than after your change now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok -- I'll update this to be both correct and clear.
...n-core/android/src/main/java/mozilla/telemetry/glean/private/TimingDistributionMetricType.kt
Outdated
Show resolved
Hide resolved
7543f89
to
cd8d8fd
Compare
Co-Authored-By: Jan-Erik Rediger <badboy@archlinux.us>
No description provided.