An alternative solution would be using a plugin to label the events.
This is how we could achieve it:
postEvent
method in com.google.gerrit.server.events.EventBroker
EventEnvelope
) as a wrapper of the Event class, containing the instanceName
as an additional fieldEventEnvelope
class as a base class to extend Events fromThis will label all the events, but the replication one, which are fundamental in a multi-master setup.
To label the replication events the core plugin will need to be modified to expose the postEvent
method and allow to override it.
This would create dependency among plugins, which is a complicated pattern.
Linking of the plugins into the /lib directory would be complex, since we will have to make sure the base plugin is loaded before the dependant one.
Also, a different JSON payload for the stream events, depending if you have or not the plugin to enrich them, will be generated.
Same consideration as in the proposed solution.