Class LogEventsKafkaEmitter
- All Implemented Interfaces:
LogEventsEmitter
Log events provide better visibility into the progress of connector, by capturing specific and important events like failures, lifecycle events, config changes, etc. in the form of Kafka events. Further, these events are formatted as per the Cloudevents specification, which makes the consumption and usage of these events more portable and consistent across platforms.
Usage: Each Connect Worker instantiates the LogEventsKafkaEmitter based upon the worker's
configuration. From there, any class that has access to the Worker instance can obtain this
emitter and use the LogEvents methods to log specific events of interest. Helper class
LogEvents is provided with static methods which help in construction of ConnectLogEntry objects and forward them to the emit(ConnectLogEntry, String, String, String). In future, instance of LogEventsEmitter will also be introduced into
WorkerSourceConnectorContext, WorkerSinkConnectorContext, WorkerSourceTaskContext,
WorkerSinkTaskContext objects, enabling the connectors to capture logs of interest in the form of
LogEvents.
-
Constructor Summary
ConstructorsConstructorDescriptionLogEventsKafkaEmitter(io.confluent.telemetry.events.EventLogger eventLogger, LogEventsConfig logEventsConfig, String dataContentType) -
Method Summary
Modifier and TypeMethodDescriptionio.confluent.remote.config.poller.RemoteConfigurationSource<RemoteConnectLogsConfiguration> configureRemoteConfigurationSource(Map<String, ?> configs) voidemit(ConnectLogEntry connectLogEntry, String subject, String source, String type) Construct a connect Log Event and emit it to the preconfigured destination.Returns the initializedLogEventsConfiginstance from the user configs.voidonReceiveCallback(RemoteConnectLogsConfiguration newRemoteConfiguration) voidStart up the event logger.voidstop()Needs to be called only once during teardown of the worker.toString()
-
Constructor Details
-
LogEventsKafkaEmitter
public LogEventsKafkaEmitter(io.confluent.telemetry.events.EventLogger eventLogger, LogEventsConfig logEventsConfig, String dataContentType) -
LogEventsKafkaEmitter
public LogEventsKafkaEmitter()
-
-
Method Details
-
start
Start up the event logger. This must be called only once from worker.- Parameters:
configs- the configs; may not be null
-
onReceiveCallback
-
logEventsConfig
Returns the initializedLogEventsConfiginstance from the user configs. This should only be invoked after thestart(Map)is invoked. It throws a runtime exception if invoked before the start was called.- Returns:
- logEventsKafkaConfig instance, if this logEventsKafkaEmitter is already started.
- Throws:
IllegalStateException- if invoked before the start was called.
-
emit
Description copied from interface:LogEventsEmitterConstruct a connect Log Event and emit it to the preconfigured destination.- Specified by:
emitin interfaceLogEventsEmitter- Parameters:
connectLogEntry- Payload containing details of the connect log event. May not be null.subject- From CloudEvents spec. Subject captures what the event is about. May not be null.source- From CloudEvents spec. Source captures the context in which the event happened. May not be null.type- From CloudEvents spec. Identifies the event type. May not be null.
-
stop
public void stop()Needs to be called only once during teardown of the worker. -
toString
-
configureRemoteConfigurationSource
public io.confluent.remote.config.poller.RemoteConfigurationSource<RemoteConnectLogsConfiguration> configureRemoteConfigurationSource(Map<String, ?> configs) -
getRemoteConfiguration
-