mozilla / testpilot-metrics

Metrics broker library for Test Pilot experiments. Pings Google Analytics and Mozilla metrics servers
Mozilla Public License 2.0
3 stars 7 forks source link

First big project commit as pull request #4

Closed jaredhirsch closed 7 years ago

jaredhirsch commented 7 years ago

I've added the whole team as admins on this repo. Comments and questions very welcome.

Take a look at my branch to see the formatted README and API docs: https://github.com/6a68/testpilot-metrics/tree/test

I'll plan to land this EOD Tuesday, unless there are major concerns :-)

meandavejustice commented 7 years ago

Some experiments (min-vid for example) send extra fields to metrics. We should add another parameter to handle this data. example data

in progress branch to integrate testpilot-metrics on min-vid

jaredhirsch commented 7 years ago

Some experiments (min-vid for example) send extra fields to metrics. We should add another parameter to handle this data.

Good point. The simplest solution here seems to be: let experiments pass extra key/value pairs in the object. This works fine for Firefox client metrics, but GA doesn't support random extra named parameters.

GA does support custom dimensions, though they are just named cd1 up to cd200. This seems like a rather fancy use case, compared with "does event/object demonstrate DAU growth".

Maybe the best thing is to let fancy experiment authors solve their own problems: I'll add support for a transform function parameter that is called to transform the ping object into a set of GA parameters ready to be encoded and sent. Adding transform would solve a related issue where testpilot-metrics, currently, only uses the GA event type, while some experiments might want to use other GA hit types. I'll add that tonight.

meandavejustice commented 7 years ago

@6a68 That sounds like a good compromise, thanks Jared

lmorchard commented 7 years ago

I'll add support for a transform function parameter that is called to transform the ping object into a set of GA parameters ready to be encoded and sent.

Does that mean, conversely, that whatever object gets passed in to sendEvent() will be sent as-is to Telemetry? (i.e. rather than stripped down to id, event, & object?) If so then :+1:

(Also guessing a transform function would resolve my confusion about the GA params too, if I'm assembling them in my own code.)

lmorchard commented 7 years ago

FWIW, I've got a hacky start at integrating this into Snooze Tabs. The parameters seem a little confusing to me, but I was able to get some data flowing to GA in the realtime view:

screenshot 2017-01-25 17 09 50 screenshot 2017-01-25 17 17 32
jaredhirsch commented 7 years ago

Does that mean, conversely, that whatever object gets passed in to sendEvent() will be sent as-is to Telemetry?

Yup! That's the idea...excluding the transform function, of course ;-)

jaredhirsch commented 7 years ago

Made some changes, just about to squash, push, and merge. Just FYI for those who reviewed: