Last modified: 2014-02-26 12:55:06 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T51094, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 49094 - clients can't tell if the event they logged was valid
clients can't tell if the event they logged was valid
Status: RESOLVED WORKSFORME
Product: Analytics
Classification: Unclassified
EventLogging (Other open bugs)
unspecified
All All
: Unprioritized normal
: ---
Assigned To: Ori Livneh
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-06-04 00:19 UTC by spage
Modified: 2014-02-26 12:55 UTC (History)
7 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description spage 2013-06-04 00:19:56 UTC
When you call mw.eventLog.logEvent() or efLogServerSideEvent(), EventLogging validates your event against its schema, but you don't know if it passed validation. One use case for needing this is campaign tracking: ?campaign=someName should only set a cookie if someName is an active campaign, which we track as an enum in the schema.

As a workaround, browser clients can call mw.eventLog.isValid() and server clients can duplicate the code to get the RemoteSchema and pass it to efSchemaValidate() , but it's duplicating code and recalculating something EventLogging already knows. Re-fetching the schema seems expensive.

Perhaps the log functions could have an optional out parameter that returns isValid().  Or, they could have an optional parameter to return the encapsulated event, which includes clientValidated.  Or the functions could memoize the last validation they performed so a subsequent isValid()/efValidateEvent() of the same event is fast.
Comment 1 Ori Livneh 2013-06-04 00:21:52 UTC
(In reply to comment #0)
> When you call mw.eventLog.logEvent() or efLogServerSideEvent(), EventLogging
> validates your event against its schema, but you don't know if it passed
> validation. One use case for needing this is campaign tracking:
> ?campaign=someName should only set a cookie if someName is an active
> campaign, which we track as an enum in the schema.

We should not track that as an enum, in my opinion. Are there any other use cases?
Comment 2 Ori Livneh 2013-06-24 10:51:31 UTC
(In reply to comment #0)
> When you call mw.eventLog.logEvent() or efLogServerSideEvent(), EventLogging
> validates your event against its schema, but you don't know if it passed
> validation.

Yes, you do:

    mw.eventLog.logEvent('Echo', {foo: 'bar'}).done( function (event) {
            if ( event.clientValidated ) {
                console.log('It validated!');
            } else {
                console.log('It did not validate!');
            }
    } );
Comment 3 Andre Klapper 2014-02-26 12:55:06 UTC
[moving from MediaWiki extensions to Analytics product - see bug 61946]

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links