Page MenuHomePhabricator

MPIC: capture stream name in instrument forms
Closed, ResolvedPublic3 Estimated Story Points

Description

T360731

Description

In order to serve all platforms and custom schemas, we should capture the stream name in the instrument forms so that when MP instrument configs are merged via the MW extension, we have the stream name (which maps to a schema title in static config) to construct the requisite json for event ingestion.

Technical Notes

Current api endpoint returns json in the following format:

Screenshot 2024-05-30 at 9.21.16 AM.png (1×1 px, 286 KB)

The MediaWiki MetricsPlatform extension takes above json and transforms into the right format for stream configs merging:

Screenshot 2024-05-30 at 3.20.15 PM.png (1×2 px, 350 KB)

There are a couple of paths forward from simplest (for MVP) to most complex (required for full-fledge support of all MP based streams that use MP base schema fragments):

  • Option 1 - support base instruments only (app + web)
    • This would only require a radio type field that allows user to select the web base instrument or the app base instrument and MPIC can populate these properties by default (we know the stream name and schema title)
  • Option 2 - support base instruments + custom instruments with a simple text field to capture stream name
    • This would require the user to input a precise stream name which must be deployed to production as static config (which we could add helper text and examples in the form field description) that the instrument's stream config would validate against before event submission
  • Option 3 - support base instruments + custom instruments with an autocomplete lookup field for the stream name
    • This is the ideal option for fool-proofing entering valid stream names but is more complicated to do properly. Requires api call to return the possible array of production stream names (which maps to a specific schema title.

Decision

Recent discussion led to implementing Option 2 for MVP

Acceptance Criteria

  • A new stream name form field is added to all the forms
  • Public API endpoint includes this property
  • Data store includes this field in the instrument table
  • Design doc is updated

Required

  • Unit/Integration tests?
  • Documentation?
  • Passed QA?

Event Timeline

cjming triaged this task as Medium priority.May 30 2024, 9:31 PM
cjming created this task.

Here are a couple quick mockups to see if I'm understanding this correctly from the design side:

Option 1

Screenshot 2024-05-30 at 3.52.43 PM.png (714×1 px, 82 KB)

Option 2

Screenshot 2024-05-30 at 3.48.51 PM.png (998×1 px, 126 KB)

I would need a bit of help coming up with good helper text and an example.

nice! thanks @mwilliams -- that exactly captures options 1 + 2

fwiw i would probably place this field higher up -- like in the Details section - maybe above or below the Description field because it's a vital/critical part of the instrument

Happy to provide helper text - how about something like:

Option 1:

Schema Base Type:
The default web or app base schema title for event validation of this instrument's stream.
- app base
- web base

Option 2:

Schema Title:
To use the web base schema, enter `analytics/product_metrics/web/base`.
To use the app base schema, enter `analytics/product_metrics/app/base`.
To use a custom schema, enter the exact schema title that is used in a corresponding production event schema i.e. `analytics/mobile_apps/product_metrics/android_find_in_page_interaction`.

Note that submission of this form will create a stream which accepts events with a JSONSchema title that matches this field value. The event schema must exist in production in order for events in this stream to validate.
See https://wikitech.wikimedia.org/wiki/Event_Platform/Stream_Configuration#schema_title

A little verbose but something like this that is super explicit - we can also provide links to Wikitech docs like
https://wikitech.wikimedia.org/wiki/Event_Platform/Schemas
https://wikitech.wikimedia.org/wiki/Event_Platform/Schemas/Guidelines
https://wikitech.wikimedia.org/wiki/Event_Platform/Stream_Configuration

Thanks! Updated those and Option 2 is probably requires too much text. I agree it is confusing without it but its so much text in a form like this that people will most likely skip over it and end up getting stuck.

I attempted a variation of both options that allows for a third radio field if we think a custom schema is required. That variation also has a link for more info or help as well.

Option 1

1.png (890×1 px, 80 KB)

Option 2 (Leaning against this option)

2.png (850×1 px, 98 KB)

Option 3 / Variation if we decide we do need custom schema option.

3.png (938×1 px, 101 KB)

*I don't think we support a text input attached to a radio out of the box with Codex but imagine it could be composed together? I have seen this work fairly well in the past in regards to usability but will review with my Codex designer buddies :)

oooh - i like the option 3 variation -- maybe we can just hide the text input and if a user chooses custom, it can appear below it?

also i think i put this Q in your slides -- for the phab ticket field -- it's just a text input right? limited to one url?
should we allow for multiple tickets?
maybe a comma delimited string of task ids? and then we can construct urls from them

i.e. T123456, T987654

Posted some ideas about the phab ticket field question at https://phabricator.wikimedia.org/T366394.

Regarding the option 3 variation...I like the idea of the user understanding what to expect when they select the custom radio field. Hiding the input field could be surprising when they do select it and realize they need to fill out a blank input field. So I lean slightly against hiding, making sure its a disabled input field until the custom radio field probably does the trick.

making sure its a disabled input field until the custom radio field probably does the trick.

perfect - we will do this if we go with Option 3

cjming updated the task description. (Show Details)

@mwilliams Option 3 looks great!

@cjming I am confused a bit by the term " base": by "app base" do you mean "mobile app core schema"? Same question for "web base".

I want to suggest "Which schema are you using? More Info." instead of "The default web or app base schema title for event validation of this instrument's stream." We can elaborate in the link for additional context. I'm not sure it's important that the users know that the schema is used for event validation... let me know if I am wrong.

cjming renamed this task from MPIC: capture schema title in instrument forms to MPIC: capture stream name in instrument forms.Jun 5 2024, 2:37 PM
cjming updated the task description. (Show Details)

hi @mwilliams @VirginiaPoundstone cc @phuedx @WDoranWMF

stop the presses - I updated this ticket's description to pivot the new field from schema title to stream name

After much discussion with DE and within our DP subteam, we are keeping stream definition limited to static config only. This means for the MPIC app, we need to know production stream names to track instruments that need to validate against custom schemas derived from MP base schemas.

For instruments that are using the web/app base schemas, we will already know the stream name (and hence schema title) so if we need to support custom schemas (derived from MP base schemas), we need a Stream Name field for this use case.

Thanks for the update @cjming! I don't totally follow all of this but is there a certain set of stream names and this should be a select? Or just an open text input again?

Screenshot 2024-06-05 at 12.45.16 PM.png (412×1 px, 48 KB)

(Text input, as always could use help with copy and an example if needed)

hi @mwilliams

is there a certain set of stream names and this should be a select?

Eventually yes - Option 3 in the ticket description is the ideal scenario but for MVP I believe we're fine with a single text input field

Now I'm second-guessing if a single text input field suffices -- I just filed T366951 which depends on knowing if the stream uses a web base or an app base schema (and even if the custom schema is derived from web or app base).

Pending outcome of T366951#9872355, Option 3 might be needed here.

3.png (938×1 px, 101 KB)

mwilliams raised the priority of this task from Medium to High.Jun 8 2024, 9:30 PM
mwilliams moved this task from Backlog to Doing on the Wikimedia-Design board.

Yesterday @VirginiaPoundstone, @cjming, and I discussed this and decided that we should proceed with option 3. But that a text input for "Custom" couldn't be the longterm solution since typing in a custom schema would go wrong more times than right and that it probably should be a select.

You can see the status of this on the Codex side of things here - https://phabricator.wikimedia.org/T363416

Screenshot 2024-06-14 at 11.28.28 AM.png (542×1 px, 54 KB)

@mwilliams @VirginiaPoundstone turns out we can hit a public api (my bad - i had it in my head that we had to hit the Gerrit api) to get the stream name so rather than a text input, we can go with an autocomplete lookup field as a separate field for the custom stream name.

If that works for the alpha release, we can have this single-value autocomplete lookup field be disabled when the app or web radios are selected (and have it be prepopulated with the app or web base stream name) and enabled when the custom radio is selected.

Does this make sense?

cc @Sfaci