Background
Currently, if an instrumentor wants to register interest in all events that an instrument dispatches, then they have to list all of those events verbatim. This is both inflexible and error prone.
For example, consider the example stream config in https://phabricator.wikimedia.org/T309013#7953227:
// ... 'events' => [ 'dt.init', 'dt.ready', 'dt.loaded', 'dt.first_change', 'dt.save_intent', 'dt.save_attempt', 'dt.save_success', 'dt.save_failure', 'dt.abort', ], // ...
It should be possible to write the above using a shorthand, e.g.:
// ... 'events' => [ 'dt.', ], // ...
Notes
- It would be better for everyone involved if we copy the semantics of other partial or wildcard subscription mechanisms familiar to Wikimedia developers. With that in mind, I propose that we copy the semantics of mw.trackSubscribe( t, callback ), which subscribes the callback to events on all topics starting with t, i.e.
mw.trackSubscribe( 'foo', topic => console.log( topic ) ); mw.track( 'foo' ); // => "foo" mw.track( 'fooo' ); // => "fooo" mw.track( 'foo2' ); // => "foo2" mw.track( 'foo.bar' ); // => "foo.bar" mw.track( 'fo' ); // NOP