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

1557048: Add reason codes to the metrics ping #649

Merged
merged 6 commits into from
Feb 11, 2020

Conversation

mdboom
Copy link
Contributor

@mdboom mdboom commented Jan 14, 2020

Requires mozilla/glean_parser#157 and mozilla-services/mozilla-pipeline-schemas#484 to be merged first.

This was a real iceberg.

Also, no Swift or Python support yet, but thought it worth getting feedback on this much first.

@mdboom mdboom requested a review from Dexterp37 January 14, 2020 21:23
@mdboom mdboom force-pushed the metrics-ping-scheduler-reason branch 3 times, most recently from d3fd05f to bc6429e Compare January 14, 2020 21:27
Copy link
Contributor

@Dexterp37 Dexterp37 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow, that was unexpectedly big :o Thanks for tackling it. Leaving a few comments, as I'd like to take another pass after the glean parser changes land.

glean-core/pings.yaml Outdated Show resolved Hide resolved
glean-core/pings.yaml Outdated Show resolved Hide resolved
glean-core/pings.yaml Outdated Show resolved Hide resolved
glean-core/pings.yaml Outdated Show resolved Hide resolved
glean-core/metrics.yaml Outdated Show resolved Hide resolved
glean-core/metrics.yaml Outdated Show resolved Hide resolved
Copy link
Contributor

@chutten chutten left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do the changes to metrics.yaml and pings.yaml result in any changes to the docs? I was expecting more markdown files in this PR.

@mdboom
Copy link
Contributor Author

mdboom commented Feb 3, 2020

@travis79 : Any thoughts on the failure in the iOS integration test? I can't reproduce locally, i.e.:

cd samples/ios/app
carthage bootstrap --platform iOS --cache-builds --configuration Debug --verbose

works for me. I suspect this has something to do with how the integration test build is "special"?

Copy link
Member

@travis79 travis79 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left a couple of comments, but I want to take a deeper look tomorrow to build locally and see if I can make some concrete suggestions.

glean-core/ios/Glean/Glean.swift Outdated Show resolved Hide resolved
glean-core/ios/Glean/Metrics/Ping.swift Show resolved Hide resolved
@mdboom mdboom force-pushed the metrics-ping-scheduler-reason branch 2 times, most recently from 0c0158b to 0997bad Compare February 4, 2020 21:44
@mdboom mdboom marked this pull request as ready for review February 4, 2020 21:44
@auto-assign auto-assign bot requested a review from badboy February 4, 2020 21:44
Copy link
Contributor

@Dexterp37 Dexterp37 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First high level view pass, nitpicking on sent vs submitted

CHANGELOG.md Outdated Show resolved Hide resolved
docs/user/pings/index.md Outdated Show resolved Hide resolved
docs/user/pings/metrics.md Outdated Show resolved Hide resolved
docs/user/pings/metrics.md Outdated Show resolved Hide resolved
docs/user/pings/metrics.md Outdated Show resolved Hide resolved
glean-core/pings.yaml Outdated Show resolved Hide resolved
glean-core/pings.yaml Outdated Show resolved Hide resolved
glean-core/pings.yaml Outdated Show resolved Hide resolved
glean-core/python/glean/glean.py Outdated Show resolved Hide resolved
glean-core/python/glean/metrics/ping.py Outdated Show resolved Hide resolved
Copy link
Contributor

@Dexterp37 Dexterp37 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First high level view pass, nitpicking on sent vs submitted

*/
internal fun submitPingsByNameSync(pingNames: List<String>) {
internal fun submitPingsByNameSync(pingNames: List<String>, reason: String? = null) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please note that pingNames can potentially contain names of different pings (e.g. baseline, events) and we're only passing a single reason: we should probably have a list of pairs or a map, or two lists in order to match specific optional reasons to specific ping names.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a good point, and I agree this is a problem. Passing in "parallel lists", one of which is optional, seems kind of a strange API though (at least it's internal API).

I actually feel like it might be better to remove all of the plural submit "pings" in favor of a single submit "ping" on all of these functions. We only use this to submit multiple pings in one place, and we don't even get any parallelism out of thing by batching them up like this. I think that would be a useful simplification.

Thoughts? @Dexterp37, @badboy, @travis79, @brizental ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess, specifically, what I'd propose is to merge this PR as-is with respect to this, and as follow-on work, replace submitPings* with submitPing, which would fix the ambiguity around reason codes.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One other reason we went with submitPings (multiple) was to only call into Rust once.
So far no one has ever complained about FFI calls and given how infrequent and with how small of a list we call it I'm fine with dropping that API

(Users can only submit one ping at a time anyway, through the CustomPing.submit() function, right?)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm all for the one at a time, one ping with one reason passed into the function. I also like the idea of this simplifying the underlying FFI function.

Copy link
Contributor Author

@mdboom mdboom Feb 5, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@badboy: Yes, through the public API, users can only submit one ping at once. The only place where we submit multiple is on going to background (to send baseline and events).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm fine with dropping the plural, but I think it needs to be part of this PR, since this makes #687 buggy (unless we opt for sending the ping on background without a "reason" code.) :-)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, good point about #687. I was mainly just trying to not make this PR any bigger than it already is. But it should be straightforward. I'll take it on.

Copy link
Member

@badboy badboy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I gave this a very rough first pass.
What I would like to see is describing the "why" in the commit message.
Things like highlighting that the reasons are statically defined and become enums as part of the Ping type on the platform side.

CHANGELOG.md Outdated Show resolved Hide resolved
docs/user/pings/metrics.md Outdated Show resolved Hide resolved
glean-core/ios/Glean/Metrics/Ping.swift Outdated Show resolved Hide resolved
glean-core/ios/Glean/Metrics/Ping.swift Outdated Show resolved Hide resolved
@codecov-io
Copy link

codecov-io commented Feb 5, 2020

Codecov Report

Merging #649 into master will increase coverage by 12.05%.
The diff coverage is 89.74%.

Impacted file tree graph

@@              Coverage Diff              @@
##             master     #649       +/-   ##
=============================================
+ Coverage     75.52%   87.57%   +12.05%     
- Complexity      266      268        +2     
=============================================
  Files            98       59       -39     
  Lines          6191     2971     -3220     
  Branches        751      126      -625     
=============================================
- Hits           4676     2602     -2074     
+ Misses          969      312      -657     
+ Partials        546       57      -489
Impacted Files Coverage Δ Complexity Δ
...n/java/mozilla/telemetry/glean/rust/LibGleanFFI.kt 66.66% <ø> (ø) 0 <0> (ø) ⬇️
...ore/ios/Glean/Scheduler/MetricsPingScheduler.swift 100% <100%> (ø) 0 <0> (ø) ⬇️
...ozilla/telemetry/glean/debug/GleanDebugActivity.kt 75.75% <100%> (ø) 7 <0> (ø) ⬇️
glean-core/ios/Glean/Debug/GleanDebugTools.swift 80.59% <100%> (ø) 0 <0> (ø) ⬇️
.../telemetry/glean/scheduler/MetricsPingScheduler.kt 88.04% <80%> (-4.82%) 31 <2> (ø)
...oid/src/main/java/mozilla/telemetry/glean/Glean.kt 84.83% <81.81%> (-2.81%) 1 <0> (ø)
glean-core/ios/Glean/Glean.swift 92.72% <86.66%> (-0.49%) 0 <0> (ø)
...n/java/mozilla/telemetry/glean/private/PingType.kt 78.26% <87.5%> (+3.26%) 5 <5> (+2) ⬆️
glean-core/ios/Glean/Metrics/Ping.swift 82.75% <90.47%> (+5.83%) 0 <0> (ø) ⬇️
glean-core/src/metrics/timespan.rs
... and 32 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 24257f7...e4a78ae. Read the comment docs.

@mdboom mdboom force-pushed the metrics-ping-scheduler-reason branch 4 times, most recently from af91250 to 534191d Compare February 5, 2020 23:10
@mdboom
Copy link
Contributor Author

mdboom commented Feb 5, 2020

I think this beast is finally ready for a final review. Apologies for how out-of-hand it became.

EDIT: So, close, but Android tests:

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x00007fab916ac181, pid=9028, tid=0x00007fab38de5700
#
# JRE version: OpenJDK Runtime Environment (8.0_242-b08) (build 1.8.0_242-b08)
# Java VM: OpenJDK 64-Bit Server VM (25.242-b08 mixed mode linux-amd64 compressed oops)
# Problematic frame:
# C  [libc.so.6+0x15c181]
#
# Core dump written. Default location: /home/circleci/project/glean-core/android/core or core.9028
#
# An error report file with more information is saved as:
# /home/circleci/project/glean-core/android/hs_err_pid9028.log
#
# If you would like to submit a bug report, please visit:
#   http://bugreport.java.com/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#

And with that fun, I'm out for the day.

@mdboom mdboom force-pushed the metrics-ping-scheduler-reason branch 2 times, most recently from e946fd2 to e4a78ae Compare February 6, 2020 13:38
docs/user/pings/custom.md Outdated Show resolved Hide resolved
Copy link
Contributor

@Dexterp37 Dexterp37 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. What was that bad failure about? What was the fix?

@mdboom
Copy link
Contributor Author

mdboom commented Feb 6, 2020

LGTM. What was that bad failure about? What was the fix?

I was never able to see the segfault again. The other intermittent was unrelated to this PR, it turned out, and fixed in #692.

@mdboom
Copy link
Contributor Author

mdboom commented Feb 6, 2020 via email

Copy link
Contributor

@chutten chutten left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mostly skimmed it, and it looked fine. I have Feelings about how the descriptions should be approached, though.

glean-core/pings.yaml Outdated Show resolved Hide resolved
@mdboom mdboom force-pushed the metrics-ping-scheduler-reason branch from 5db0b11 to cf5d803 Compare February 11, 2020 13:22
This adds support for sending reason codes along with pings.  The reason codes
are defined as an enumeration in the pings.yaml file, and only these values
are allowed on specific pings.

Additionally, this builds on that to add reason codes to the metrics ping.
@mdboom mdboom force-pushed the metrics-ping-scheduler-reason branch from bdb369d to 8595861 Compare February 11, 2020 14:49
@mdboom mdboom merged commit 2e3f59b into mozilla:master Feb 11, 2020
@mdboom mdboom deleted the metrics-ping-scheduler-reason branch April 14, 2020 19:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants