From 1921c452cd8a6a76ba8b546d3c779e1246b4ec27 Mon Sep 17 00:00:00 2001 From: Ozan Gunalp Date: Wed, 7 Feb 2024 22:23:00 +0100 Subject: [PATCH] Disable messaging observation by default for backwards compatibility Fixes #38889 --- docs/src/main/asciidoc/kafka.adoc | 25 ++++++++++++++++--- .../SmallRyeReactiveMessagingProcessor.java | 6 +++++ .../src/main/resources/application.properties | 1 + 3 files changed, 28 insertions(+), 4 deletions(-) diff --git a/docs/src/main/asciidoc/kafka.adoc b/docs/src/main/asciidoc/kafka.adoc index 120a2977b7e52..35255f98a82a7 100644 --- a/docs/src/main/asciidoc/kafka.adoc +++ b/docs/src/main/asciidoc/kafka.adoc @@ -2048,14 +2048,31 @@ mp.messaging.incoming.data.tracing-enabled=false If the xref:telemetry-micrometer.adoc[Micrometer extension] is present, then Kafka producer and consumer clients metrics are exposed as Micrometer meters. -Per channel metrics are also exposed as Micrometer meters. -The number of messages produced or received per channel, acknowledgments and duration of processing are exposed. +=== Channel metrics -The messaging meters can be disabled: +Per channel metrics can also be gathered and exposed as Micrometer meters. +Following metrics can be gathered per channel, identified with the _channel_ tag: + +* `quarkus.messaging.message.count` : The number of messages produced or received +* `quarkus.messaging.message.acks` : The number of messages processed successfully +* `quarkus.messaging.message.failures` : The number of messages processed with failures +* `quarkus.messaging.message.duration` : The duration of the message processing. + +For backwards compatibility reasons channel metrics are not enabled by default and can be enabled with: + +[IMPORTANT] +==== +The https://smallrye.io/smallrye-reactive-messaging/latest/concepts/observability/[message observation] +depends on intercepting messages and therefore doesn't support channels consuming messages with +a custom message type such as `IncomingKafkaRecord`, `KafkaRecord`, `IncomingKafkaRecordBatch` or `KafkaRecordBatch`. + +The message interception, and observation, still work with channels consuming the generic `Message` type, +or custom payloads enabled by https://smallrye.io/smallrye-reactive-messaging/latest/concepts/converters/[converters]. +==== [source, properties] ---- -quarkus.micrometer.binder.messaging.enabled=false +smallrye.messaging.observation.enabled=true ---- diff --git a/extensions/smallrye-reactive-messaging/deployment/src/main/java/io/quarkus/smallrye/reactivemessaging/deployment/SmallRyeReactiveMessagingProcessor.java b/extensions/smallrye-reactive-messaging/deployment/src/main/java/io/quarkus/smallrye/reactivemessaging/deployment/SmallRyeReactiveMessagingProcessor.java index e4982848cd5a4..eada958ba8648 100644 --- a/extensions/smallrye-reactive-messaging/deployment/src/main/java/io/quarkus/smallrye/reactivemessaging/deployment/SmallRyeReactiveMessagingProcessor.java +++ b/extensions/smallrye-reactive-messaging/deployment/src/main/java/io/quarkus/smallrye/reactivemessaging/deployment/SmallRyeReactiveMessagingProcessor.java @@ -205,6 +205,12 @@ public void transform(AnnotationsTransformer.TransformationContext ctx) { }); } + @BuildStep + public void disableObservation(BuildProducer runtimeConfigProducer) { + runtimeConfigProducer.produce( + new RunTimeConfigurationDefaultBuildItem("smallrye.messaging.observation.enabled", "false")); + } + @BuildStep public void enableHealth(ReactiveMessagingBuildTimeConfig buildTimeConfig, BuildProducer producer) { diff --git a/integration-tests/reactive-messaging-kafka/src/main/resources/application.properties b/integration-tests/reactive-messaging-kafka/src/main/resources/application.properties index a4635331aff3c..d2945c59151da 100644 --- a/integration-tests/reactive-messaging-kafka/src/main/resources/application.properties +++ b/integration-tests/reactive-messaging-kafka/src/main/resources/application.properties @@ -46,3 +46,4 @@ mp.messaging.outgoing.request-reply.topic=request mp.messaging.outgoing.request-reply.reply.batch=true quarkus.micrometer.binder.messaging.enabled=true +smallrye.messaging.observation.enabled=true