Mailing List Archive

Collect telemetry (using WikimediaEvents) for a gadget
Hi there,

I'm User:Diskdance, and recently I'm developing a default gadget for Chinese Wikipedia enhancing MediaWiki's variant handling logic, and under certain circumstances a prompt is shown at page load asking for a user's preferred variant. Consider it as a conditional Cookie notice, and its English screenshot can be found at https://commons.wikimedia.org/wiki/File:VariantAlly-En.png.

Iknowthis can be very disruptive on UX, so I tend to be careful about its negative impact on page views. If the gadget can collect telemetry data about the prompt's display frequency and user interactions(using e.g. WikimediaEvents), I can know about its possible impact.

Is this possible? It would be much appreciated if anybody could provide assistance.

Best wishes,Diskdance
Re: Collect telemetry (using WikimediaEvents) for a gadget [ In reply to ]
On Mon, Nov 27, 2023 at 7:36?AM psnbaotg via Wikitech-l <
wikitech-l@lists.wikimedia.org> wrote:

> I *know *this can be very disruptive on UX, so I tend to be careful about
> its negative impact on page views. If the gadget can collect telemetry
> data about the prompt's display frequency and user interactions (using
> e.g. WikimediaEvents), I can know about its possible impact.
>
> Is this possible? It would be much appreciated if anybody could provide
> assistance.
>

Possible but quite complex. You need to define a corresponding event schema
and event stream, send data from the gadget to the event stream, and access
the data (or have some access the data) in the analytics cluster. The
documentation we have is not great but you need roughly these steps:
- request a volunteer NDA (or find someone who has one) [1] for hive access
[2]
- define your event schema (e.g. list of user interactions you are going to
log) in the form of a patch to the schemas/event/secondary [3] repository.
See docs [4][5].
- assign a stream to the schema in the main Wikimedia configuration [6]
- from the gadget, log the event using `mw.eventLog.submit( streamName,
eventObject )`. [7]
- ssh into the statistics server [8], authenticate with Kerberos, run hive,
and you can query the data under event_sanitized.<schema name>

[1] https://wikitech.wikimedia.org/wiki/Volunteer_NDA
[2]
https://wikitech.wikimedia.org/wiki/Analytics/Data_access#ssh_login_to_analytics_client_servers_(AKA_stat_boxes)_with_Hadoop,_Hive,_Presto_access
[3]
https://gerrit.wikimedia.org/r/plugins/gitiles/schemas/event/secondary/+/refs/heads/master
[4]
https://wikitech.wikimedia.org/wiki/Event_Platform/Schemas#Creating_a_new_schema
[5] https://wikitech.wikimedia.org/wiki/Event_Platform/Schemas/Guidelines
[6]
https://wikitech.wikimedia.org/wiki/Metrics_Platform/Creating_An_Instrument#Deployment
[7]
https://www.mediawiki.org/wiki/Extension:EventLogging/Guide#Underlying_technology
[8]
https://wikitech.wikimedia.org/wiki/SRE/Production_access#Setting_up_your_access
Re: Collect telemetry (using WikimediaEvents) for a gadget [ In reply to ]
I would suggest using the Statsd counters that WikimediaEvents exposes to MediaWiki JavaScript (including Gadgets and user scripts!). This is a public API, with aggregate data publicly accessible via Grafana.

These require no server-side configurations, schemas, or private data access. And (on the flipside) also do not record any personal information.

To use it, call mw.track( counter.gadget_<gadgetname>.<metricname> ) in your gadget.

For example:

mw.track( 'counter.gadget_VariantAlly.storage_empty_dialog' );

To make visualising easier, I've put together a generic dashboard to plot these:
https://grafana.wikimedia.org/d/000000037/gadget-stats

--
Timo Tijhof
https://timotijhof.net/




On Mon, 27 Nov 2023, at 09:33, psnbaotg via Wikitech-l wrote:
>
> Hi there,
>
> I'm User:Diskdance, and recently I'm developing a default gadget for Chinese Wikipedia enhancing MediaWiki's variant handling logic, and under certain circumstances a prompt is shown at page load asking for a user's preferred variant. Consider it as a conditional Cookie notice, and its English screenshot can be found at https://commons.wikimedia.org/wiki/File:VariantAlly-En.png.
>
> I *know *this can be very disruptive on UX, so I tend to be careful about its negative impact on page views. If the gadget can collect telemetry data about the prompt's display frequency and user interactions (using e.g. WikimediaEvents), I can know about its possible impact.
>
> Is this possible? It would be much appreciated if anybody could provide assistance.
>
> Best wishes,
> Diskdance
>
> _______________________________________________
> Wikitech-l mailing list -- wikitech-l@lists.wikimedia.org
> To unsubscribe send an email to wikitech-l-leave@lists.wikimedia.org
> https://lists.wikimedia.org/postorius/lists/wikitech-l.lists.wikimedia.org/
Re: Collect telemetry (using WikimediaEvents) for a gadget [ In reply to ]
+1 to statsd as a great way to get started with as little friction
as possible. I've bubbled this up to the folks that make decisions about
instrumentation, so if you find yourself wanting to do things beyond what's
possible with statsv, please chime back in here and let us know.

On Thu, Nov 30, 2023 at 8:02?PM Krinkle <krinkle@fastmail.com> wrote:

> I would suggest using the Statsd counters that WikimediaEvents exposes to
> MediaWiki JavaScript (including Gadgets and user scripts!). This is a
> public API, with aggregate data publicly accessible via Grafana.
>
> These require no server-side configurations, schemas, or private data
> access. And (on the flipside) also do not record any personal information.
>
> To use it, call mw.track( counter.gadget_<gadgetname>.<metricname> ) in
> your gadget.
>
> For example:
>
> mw.track( 'counter.gadget_VariantAlly.storage_empty_dialog' );
>
> To make visualising easier, I've put together a generic dashboard to plot
> these:
> https://grafana.wikimedia.org/d/000000037/gadget-stats
>
> --
> Timo Tijhof
> https://timotijhof.net/
>
>
>
>
> On Mon, 27 Nov 2023, at 09:33, psnbaotg via Wikitech-l wrote:
>
>
> Hi there,
>
> I'm User:Diskdance, and recently I'm developing a default gadget for
> Chinese Wikipedia enhancing MediaWiki's variant handling logic, and under
> certain circumstances a prompt is shown at page load asking for a user's
> preferred variant. Consider it as a conditional Cookie notice, and its
> English screenshot can be found at
> https://commons.wikimedia.org/wiki/File:VariantAlly-En.png.
>
> I *know *this can be very disruptive on UX, so I tend to be careful about
> its negative impact on page views. If the gadget can collect telemetry
> data about the prompt's display frequency and user interactions (using
> e.g. WikimediaEvents), I can know about its possible impact.
>
> Is this possible? It would be much appreciated if anybody could provide
> assistance.
>
> Best wishes,
> Diskdance
>
> _______________________________________________
> Wikitech-l mailing list -- wikitech-l@lists.wikimedia.org
> To unsubscribe send an email to wikitech-l-leave@lists.wikimedia.org
> https://lists.wikimedia.org/postorius/lists/wikitech-l.lists.wikimedia.org/
>
>
> _______________________________________________
> Wikitech-l mailing list -- wikitech-l@lists.wikimedia.org
> To unsubscribe send an email to wikitech-l-leave@lists.wikimedia.org
> https://lists.wikimedia.org/postorius/lists/wikitech-l.lists.wikimedia.org/
>
Re: Collect telemetry (using WikimediaEvents) for a gadget [ In reply to ]
Wow, this method looks promising. Will try this to see if it suits my needs. Thank you!

Best regards,
Diskdance

On Friday, December 1st, 2023 at 8:59 AM, Krinkle <krinkle@fastmail.com> wrote:

> I would suggest using the Statsd counters that WikimediaEvents exposes to MediaWiki JavaScript (including Gadgets and user scripts!). This is a public API, with aggregate data publicly accessible via Grafana.
>
> These require no server-side configurations, schemas, or private data access. And (on the flipside) also do not record any personal information.
>
> To use it, call mw.track( counter.gadget_<gadgetname>.<metricname> ) in your gadget.
>
> For example:
>
> mw.track( 'counter.gadget_VariantAlly.storage_empty_dialog' );
>
> To make visualising easier, I've put together a generic dashboard to plot these:
> https://grafana.wikimedia.org/d/000000037/gadget-stats
>
> --
> Timo Tijhof
> https://timotijhof.net/
>
> On Mon, 27 Nov 2023, at 09:33, psnbaotg via Wikitech-l wrote:
>
>> Hi there,
>>
>> I'm User:Diskdance, and recently I'm developing a default gadget for Chinese Wikipedia enhancing MediaWiki's variant handling logic, and under certain circumstances a prompt is shown at page load asking for a user's preferred variant. Consider it as a conditional Cookie notice, and its English screenshot can be found at https://commons.wikimedia.org/wiki/File:VariantAlly-En.png.
>>
>> Iknowthis can be very disruptive on UX, so I tend to be careful about its negative impact on page views. If the gadget can collect telemetry data about the prompt's display frequency and user interactions(using e.g. WikimediaEvents), I can know about its possible impact.
>>
>> Is this possible? It would be much appreciated if anybody could provide assistance.
>>
>> Best wishes,
>> Diskdance
>>
>> _______________________________________________
>> Wikitech-l mailing list -- wikitech-l@lists.wikimedia.org
>> To unsubscribe send an email to wikitech-l-leave@lists.wikimedia.org
>> https://lists.wikimedia.org/postorius/lists/wikitech-l.lists.wikimedia.org/
Re: Collect telemetry (using WikimediaEvents) for a gadget [ In reply to ]
Hi all,

The new version of VariantAlly using mw.track has been deployed on Chinese Wikipedia, and it works great.

But currently I can only see one metric at a time on [this dashboard](https://grafana.wikimedia.org/d/000000037/gadget-stats), it would be better if I could see multiple metrics at the same time for comparation (grouped by variant-prompt-* and variant-prompt-mobile-*). It seems that I cannot edit the panel myself. Could somebody provide any assistance? It will be much appreciated.

Best,
Diskdance
On Friday, December 1st, 2023 at 1:10 PM, psnbaotg via Wikitech-l <wikitech-l@lists.wikimedia.org> wrote:

> Wow, this method looks promising. Will try this to see if it suits my needs. Thank you!
>
> Best regards,
> Diskdance
>
> On Friday, December 1st, 2023 at 8:59 AM, Krinkle <krinkle@fastmail.com> wrote:
>
>> I would suggest using the Statsd counters that WikimediaEvents exposes to MediaWiki JavaScript (including Gadgets and user scripts!). This is a public API, with aggregate data publicly accessible via Grafana.
>>
>> These require no server-side configurations, schemas, or private data access. And (on the flipside) also do not record any personal information.
>>
>> To use it, call mw.track( counter.gadget_<gadgetname>.<metricname> ) in your gadget.
>>
>> For example:
>>
>> mw.track( 'counter.gadget_VariantAlly.storage_empty_dialog' );
>>
>> To make visualising easier, I've put together a generic dashboard to plot these:
>> https://grafana.wikimedia.org/d/000000037/gadget-stats
>>
>> --
>> Timo Tijhof
>> https://timotijhof.net/
>>
>> On Mon, 27 Nov 2023, at 09:33, psnbaotg via Wikitech-l wrote:
>>
>>> Hi there,
>>>
>>> I'm User:Diskdance, and recently I'm developing a default gadget for Chinese Wikipedia enhancing MediaWiki's variant handling logic, and under certain circumstances a prompt is shown at page load asking for a user's preferred variant. Consider it as a conditional Cookie notice, and its English screenshot can be found at https://commons.wikimedia.org/wiki/File:VariantAlly-En.png.
>>>
>>> Iknowthis can be very disruptive on UX, so I tend to be careful about its negative impact on page views. If the gadget can collect telemetry data about the prompt's display frequency and user interactions(using e.g. WikimediaEvents), I can know about its possible impact.
>>>
>>> Is this possible? It would be much appreciated if anybody could provide assistance.
>>>
>>> Best wishes,
>>> Diskdance
>>>
>>> _______________________________________________
>>> Wikitech-l mailing list -- wikitech-l@lists.wikimedia.org
>>> To unsubscribe send an email to wikitech-l-leave@lists.wikimedia.org
>>> https://lists.wikimedia.org/postorius/lists/wikitech-l.lists.wikimedia.org/
Re: Collect telemetry (using WikimediaEvents) for a gadget [ In reply to ]
On Thu, Dec 7, 2023 at 6:41?AM psnbaotg via Wikitech-l <
wikitech-l@lists.wikimedia.org> wrote:

> But currently I can only see one metric at a time on this dashboard
> <https://grafana.wikimedia.org/d/000000037/gadget-stats>, it would be
> better if I could see multiple metrics at the same time for comparation
> (grouped by variant-prompt-* and variant-prompt-mobile-*).
>

I've created a draft dashboard that does this, which can be found here:
https://grafana.wikimedia.org/d/2wpKk7DIk/gadget-variantally-metrics.
Hopefully that's what you were aiming for.


> It seems that I cannot edit the panel myself. Could somebody provide any
> assistance? It will be much appreciated.
>

Per https://wikitech.wikimedia.org/wiki/Grafana#Editing_dashboards, you'll
need to request a volunteer NDA in order to be able to edit Grafana
dashboards.

-Sam
Re: Collect telemetry (using WikimediaEvents) for a gadget [ In reply to ]
On 2023-12-07 15:58, Sam Smith wrote:
> On Thu, Dec 7, 2023 at 6:41?AM psnbaotg via Wikitech-l
> <wikitech-l@lists.wikimedia.org <mailto:wikitech-l@lists.wikimedia.org>>
> wrote:
>
> But currently I can only see one metric at a time on this dashboard
> <https://grafana.wikimedia.org/d/000000037/gadget-stats>, it would
> be better if I could see multiple metrics at the same time for
> comparation (grouped by variant-prompt-* and variant-prompt-mobile-*).
>
>
> I've created a draft dashboard that does this, which can be found here:
> <https://grafana.wikimedia.org/d/2wpKk7DIk/gadget-variantally-metrics>.
> Hopefully that's what you were aiming for.


This seems like a good idea, so I went ahead and made similar changes to
the generic dashboard as well, to allow selecting and graphing multiple
metrics.


--
Bartosz Dziewo?ski
_______________________________________________
Wikitech-l mailing list -- wikitech-l@lists.wikimedia.org
To unsubscribe send an email to wikitech-l-leave@lists.wikimedia.org
https://lists.wikimedia.org/postorius/lists/wikitech-l.lists.wikimedia.org/