Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support canary events #87

Merged
merged 1 commit into from
Nov 2, 2023
Merged

Support canary events #87

merged 1 commit into from
Nov 2, 2023

Conversation

ChlodAlejandro
Copy link
Owner

@ChlodAlejandro ChlodAlejandro commented Oct 27, 2023

Filter out canary (heartbeat) events by default by checking if meta.domain == "canary", per Data Engineering and Event Platform Team at T266798. Canary events can be re-enabled by passing enableCanary when creating the stream.

Will be released as 2.1.0 when finished.

To-do:

  • Add option to re-enable
  • Document canary event behavior
  • Utilize canary events as part of tests
  • Not-so-possible since canary events are only fired once every hour; much longer than the CI timeout.

@ChlodAlejandro ChlodAlejandro changed the title Filter out canary events Support canary events Oct 27, 2023
@ChlodAlejandro
Copy link
Owner Author

Given that canary events will start appearing by next month, it might also be worth backporting this to 2.0.x and 1.0.x tags so that no bumps to package.json would be required for anyone on those versions. I'll think about this more tomorrow.

@ottomata
Copy link

ottomata commented Nov 1, 2023

Given that canary events will start appearing by next month

FWIW, canary events are already present in many of the available streams. The ones that will have them newly enabled are the ones listed in the ticket: mostly ones that were created before 2020.

@ChlodAlejandro
Copy link
Owner Author

ChlodAlejandro commented Nov 1, 2023

Most of the streams covered by this library are part of the list (only exception being mediawiki.revision-tags-change), so it's more or less the same for this specific library. This is probably still something worth backporting to older versions. (currently running tests to see if this is something worth backporting)

@ChlodAlejandro
Copy link
Owner Author

Based on what I understood from wikitech:Data Engineering/Systems/Hadoop Event Ingestion Lifecycle#Canary Events, the meta.stream field remains intact and unchanged by ProduceCanaryEvents. The following lines are what fires the events for any client using this library:

// Emit event.
this.emit( data.meta.stream, data, event );
// Emit event to aliases of event stream.
if ( WikimediaEventStreamAliasesKey[ data.meta.stream ] ) {
    for ( const alias of WikimediaEventStreamAliasesKey[ data.meta.stream ] ) {
	this.emit( alias, data, event );
    }
}

which means if meta.stream remains unchanged, canary events will still be received by dependents. TL;DR: The way the code is written right now won't protect current users of this library from receiving canary events when they are enabled. So a backport (even one that only drops canary events and doesn't include an option to enable them) might help in getting this to users who use an older version of this library. This does mean everyone will be required to update when the events become enabled, but I've set the old versions as deprecated on npm anyway, so that was already a given from long ago.

Will now be merging this in a bit!

@ChlodAlejandro ChlodAlejandro merged commit a2733ee into master Nov 2, 2023
11 checks passed
@ChlodAlejandro ChlodAlejandro deleted the T266798 branch February 29, 2024 08:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants