Two things:
-
Use rd_kafka_conf_set_log_cb() so the librdkafka output uses the Orion logging system (LM_x etc) instead of printing by stdout/stderr directly. Ref: https://docs.confluent.io/platform/current/clients/librdkafka/html/rdkafka_8h.html#a06ade2ca41f32eb82c6f7e3d4acbe19f
-
Improve error management in the following way:
In getConnection() the librdkafka error (code, name, reason) should be catpured, but now logged as ERROR.
getConnection() has technical connection context but sendKafkaNotification() has functional notification context: tenant, servicePath, topic, subscriptionId, etc.
Thus, that error information should be propagated from getConnection() to sendKafkaNotification() and printing the final log there. This way we will avoid redundant logs about the same fail and at the same time we will print error with all the useful context.
In this case, we will unifiy current logs:
time=2026-04-29T10:03:38.194Z | lvl=ERROR | corr=ac653c96-43b2-11f1-a86e-0a580a8204ef; cbnotif=37 | trans=1777360936-271-00000614134 | from=10.128.2.2 | srv=xxx| subsrv=/yyy| comp=Orion | op=KafkaConnectionManager.cpp[439]:getConnection | msg=Runtime Error (Kafka metadata/connection check failed for dev-kafka-fake:80: Local: Broker transport failure)
and
time=2026-04-29T10:03:38.195Z | lvl=ERROR | corr=ac653c96-43b2-11f1-a86e-0a580a8204ef; cbnotif=37 | trans=1777360936-271-00000614134 | from=10.128.2.2 | srv=xxx | subsrv=/yyy | comp=Orion | op=KafkaConnectionManager.cpp[601]:sendKafkaNotification | msg=Kafka producer not available for dev-kafka-fake:80
into a more useful one:
Runtime Error (Kafka notification not sent: endpoint=..., tenant=..., servicePath=..., subscriptionId=..., kafkaErrorCode=..., kafkaErrorName=..., kafkaError=...)
Two things:
Use rd_kafka_conf_set_log_cb() so the librdkafka output uses the Orion logging system (
LM_xetc) instead of printing by stdout/stderr directly. Ref: https://docs.confluent.io/platform/current/clients/librdkafka/html/rdkafka_8h.html#a06ade2ca41f32eb82c6f7e3d4acbe19fImprove error management in the following way:
In
getConnection()thelibrdkafkaerror (code, name, reason) should be catpured, but now logged asERROR.getConnection()has technical connection context butsendKafkaNotification()has functional notification context:tenant,servicePath,topic,subscriptionId, etc.Thus, that error information should be propagated from
getConnection()tosendKafkaNotification()and printing the final log there. This way we will avoid redundant logs about the same fail and at the same time we will print error with all the useful context.In this case, we will unifiy current logs:
and
into a more useful one: