It has been decided in the parent ticket to create EventBus adapters for Monolog interfaces in order to be able to send Monolog events to Kafka via EventBus/EventGate. This ticket is created to track that work.
The plan is to create 'EventBusMonologHandler' and 'EventBusMonolog Formatter' classes and use them instead of the current 'KafkaHandler' and 'AvroFormatter' classes.
The only roadblock is that EventGate requires .$schema property with a schema URI and a .meta.stream property with a stream corresponding to the Kafka topic the messages should go to, but Monolog does not require those. I believe adding the schema URI and the stream should be a part of the configuration for the formatter. So, the formatter config would look somewhat like this:
'eventbus' => [ 'class' => 'EventBusMonologFormatter', 'args' => [ 'ApiAction' => [ 'schema' => '/mediawiki/api/request/0.0.1', 'stream' => 'mediawiki-api-request' ], ... ] ]
The downside of having the schema and stream configured in MW config is that we will have this configuration in multiple places. We could eliminate the steam config by adopting a policy that for monolog events the stream name equals to the monolog channel name, however for the $schema config I do not see a viable solution. The schema version corresponds to a producer code, so it should be configured either within the code or within WMF-config