Este contenido no está disponible en el idioma seleccionado.
Chapter 5. Understand OpenTelemetry integration
OpenTelemetry integration in JBoss EAP provides observability and distributed tracing for applications. As an administrator or developer, you can monitor performance, trace requests across services, and better understand system behavior.
This integration uses the OpenTelemetry protocol and tools to track and analyze traces from incoming and outgoing requests, automatically tracing REST requests with minimal configuration. OpenTelemetry in JBoss EAP supports configuring exporters, span processors, and samplers, offering flexible tracing and exporting options. It also enables creating custom traces within user applications, enhancing observability in complex environments.
OpenTelemetry integration provides several key benefits:
- Automatic tracing: REST requests are automatically traced, providing visibility into the system.
- Customizable configuration: You can adjust tracing with support for exporters, span processors, and samplers.
- Seamless context propagation: The trace context propagates across REST client calls for accurate end-to-end tracing.
- Simplified monitoring: You can track performance and behavior without additional dependencies.
By configuring OpenTelemetry, you can improve application performance tracking, troubleshoot more effectively, and enhance system observability.
5.1. OpenTelemetry integration with MicroProfile Reactive Messaging Kafka and AMQP connector Copiar enlaceEnlace copiado en el portapapeles!
You can configure MicroProfile Reactive Messaging to trace messages in JBoss EAP, including incoming and outgoing messages over AMQP and Kafka connectors. Enable tracing by using the MicroProfile Reactive Messaging subsystem with the SmallRye Reactive Messaging connectors.
To enable tracing, adjust the subsystem settings along with the connector and channel configurations. These properties determine whether tracing is active, enabling you to track message flow and enhance observability and monitoring. Additionally, you can override some of this configuration by using any MicroProfile Config ConfigSource.
Ensure that the MicroProfile Telemetry subsystem is enabled. It delegates tracing to the OpenTelemetry subsystem, which contains the configuration for how tracing is performed.
Additional resources
5.1.1. MicroProfile Telemetry configuration for message tracing Copiar enlaceEnlace copiado en el portapapeles!
MicroProfile Telemetry traces message flows in systems like Kafka and AMQP to improve monitoring and observability. By default, tracing is disabled in JBoss EAP and requires configuration of the MicroProfile Telemetry subsystem.
Tracing behavior is controlled by properties defined at various levels:
-
Channel-level properties: Provide granular control and override other settings. A channel refers to a specific messaging endpoint, such as
from-kafkaorto-amqp. - Connector-level properties: Used when no channel-level property is set.
- Subsystem attributes: Used as the default when neither channel nor connector properties are defined.
The value for the connector attributes, such as kafka-connector and amqp-connector, in the subsystem configuration path at /subsystem=microprofile-reactive-messaging-smallrye/opentelemetry-tracing=config can be one of the following:
- NEVER: Disables MicroProfile Telemetry tracing integration and prevents it from being enabled in deployed applications. This overrides any channel or connector-level properties that configure the tracing functionality. If the attribute is not set in the subsystem, NEVER is the default value.
- OFF: Disables MicroProfile Telemetry tracing by default. You can enable it in applications by using MicroProfile Config properties for the deployment.
- ON: Enables tracing by default. You can disable it in applications by using MicroProfile Config properties for the deployment.
- ALWAYS: Enables MicroProfile Telemetry tracing integration and prevents it from being disabled in deployed applications. This overrides any channel or connector-level properties configuring the tracing functionality.
After configuring OpenTelemetry tracing, it integrates with the relevant connectors and channels to track message flow, such as through settings in the META-INF/microprofile-config.properties file.
5.1.1.1. Kafka connector tracing configuration Copiar enlaceEnlace copiado en el portapapeles!
To enable tracing for Kafka connectors, configure the kafka-connector attribute at the subsystem level and set the relevant channel and connector properties:
-
Channel-level properties: Set
mp.messaging.incoming.[channel-name].tracing-enabledto configure tracing for specific Kafka channels. -
Connector-level properties: Set
mp.messaging.connector.smallrye-kafka.tracing-enabledto configure tracing for all Kafka channels using the SmallRye Kafka connector. -
Subsystem configuration: Configure the
kafka-connectorattribute to control tracing for Kafka channels.
For example, when the subsystem value is set to kafka-connector=OFF, the tracing behavior for each Kafka channel is as follows:
The incoming
from-kafkachannel will have tracing enabled because themp.messaging.incoming.from-kafka.tracing-enabledproperty is set totrueat the channel level, which overrides other settings. For example, themicroprofile-config.propertiesfile might include the following:mp.messaging.incoming.from-kafka.tracing-enabled=true-
The outgoing
to-kafkachannel will not have tracing because no channel or connector configuration is set, and thekafka-connectorattribute is set to OFF, which defaults tofalse.
If kafka-connector=ON is set, tracing is enabled by default for both Kafka channels. Tracing is enabled for both the incoming from-kafka and outgoing to-kafka channels based on their respective channel or connector-level properties.
5.1.1.2. AMQP Connector Tracing Configuration Copiar enlaceEnlace copiado en el portapapeles!
To enable tracing for AMQP connectors, configure the amqp-connector attribute at the subsystem level and set the relevant channel and connector properties:
-
Channel-level properties: Set
mp.messaging.incoming.[channel-name].tracing-enabledto configure tracing for specific AMQP channels. -
Connector-level properties: Set
mp.messaging.connector.smallrye-amqp.tracing-enabledto configure tracing for all AMQP channels using the SmallRye AMQP connector. -
Subsystem configuration: Configure the
amqp-connectorattribute to control tracing for AMQP channels.
For example, when the subsystem value is set to amqp-connector=OFF, the tracing behavior for each channel is as follows:
The incoming
from-amqpchannel will not have tracing because themp.messaging.incoming.from-amqp.tracing-enabledproperty is set tofalse, overriding other settings. For example, themicroprofile-config.propertiesfile might include the following:mp.messaging.incoming.from-amqp.tracing-enabled=falseThe outgoing
to-amqpchannel will have tracing because it uses the connector-level settingmp.messaging.connector.smallrye-amqp.tracing-enabled, which is set totrue. For example, to enable tracing for the incoming to-amqp channel, set:mp.messaging.outgoing.to-amqp.tracing-enabled=true
If amqp-connector=ON is set, tracing will be enabled for both AMQP channels by default. Tracing will be enabled for the outgoing to-amqp channel, while the incoming from-amqp channel will not have tracing because the mp.messaging.incoming.from-amqp.tracing-enabled property is set to false.
5.2. Configuring tracing with MicroProfile Reactive Messaging for Kafka and AMQP connectors Copiar enlaceEnlace copiado en el portapapeles!
You can configure tracing for Kafka and AMQP connectors in JBoss EAP to track message flows and integrate with OpenTelemetry. This improves observability and simplifies performance diagnostics, making system monitoring and troubleshooting more effective.
Prerequisites
- You have enabled the MicroProfile Telemetry subsystem, which delegates tracing to the OpenTelemetry subsystem. The OpenTelemetry subsystem manages tracing and configures the exporters and their endpoints.
- You have installed and configured MicroProfile Reactive Messaging with the SmallRye Kafka and SmallRye AMQP connectors.
-
You have added the OpenTelemetry tracing configuration to the
microprofile-reactive-messaging-smallryesubsystem.
Procedure
Add the extension for MicroProfile Telemetry by using the following command:
/extension=org.wildfly.extension.microprofile.telemetry:addAdd the MicroProfile Telemetry subsystem by using the following command:
/subsystem=microprofile-telemetry:addAdd the OpenTelemetry tracing configuration to the MicroProfile Reactive Messaging subsystem by using the following command:
/subsystem=microprofile-reactive-messaging-smallrye/opentelemetry-tracing=config:addConfigure the tracing settings for the Kafka and AMQP connectors at the connector level by using the following commands:
For Kafka configuration:
/subsystem=microprofile-reactive-messaging-smallrye/opentelemetry-tracing=config:write-attribute(name=kafka-connector, value=ON)For AMQP configuration:
/subsystem=microprofile-reactive-messaging-smallrye/opentelemetry-tracing=config:write-attribute(name=amqp-connector, value=ON)
Enable MicroProfile Telemetry tracing for your application by setting the MicroProfile Config property to
false, as tracing is disabled by default. Add the following property to theMETA-INF/microprofile-config.propertiesfile:otel.sdk.disabled=falseSet tracing for individual incoming and outgoing channels by configuring the
META-INF/microprofile-config.propertiesfile as follows:For Kafka Channels:
Enable tracing for the incoming channel:
mp.messaging.incoming.from-kafka.tracing-enabled=trueEnable tracing for the outgoing channel:
mp.messaging.outgoing.to-kafka.tracing-enabled=trueFor AMQP Channels:
Disable tracing for the incoming channel:
mp.messaging.incoming.from-amqp.tracing-enabled=falseEnable tracing for the outgoing channel:
mp.messaging.outgoing.to-amqp.tracing-enabled=true
Add the following properties in the
META-INF/microprofile-config.propertiesfile to enable tracing for the entire application at the connector level:For the AMQP connector:
mp.messaging.connector.smallrye-amqp.tracing-enabled=trueFor the Kafka connector:
mp.messaging.connector.smallrye-kafka.tracing-enabled=true
Tracing will be enabled for both Kafka and AMQP connectors in JBoss EAP. For a complete example of configuring both an AMQP connector and a Kafka connector, see Example for configuring an AMQP connector and a Kafka connector.
5.3. Example for configuring an AMQP connector and a Kafka connector Copiar enlaceEnlace copiado en el portapapeles!
Refer to the following complete example of a microprofile-config.properties file that configures both an AMQP connector and a Kafka connector, including tracing configuration for both connectors with the values:
# Global AMQP settings
amqp-host=localhost
amqp-port=5672
amqp-username=artemis
amqp-password=artemis
mp.messaging.connector.smallrye-amqp.tracing-enabled=true
# Global Kafka settings
kafka.bootstrap.servers=localhost:9990
# Setting needed to allow MicroProfile Telemetry for the application
otel.sdk.disabled=false
# Less MP Telemetry output
otel.metrics.exporter=none
otel.logs.exporter=none
# Settings for the 'to-kafka' and 'from-kafka' channels
mp.messaging.outgoing.to-kafka.connector=smallrye-kafka
mp.messaging.outgoing.to-kafka.topic=testkafka
mp.messaging.outgoing.to-kafka.value.serializer=org.apache.kafka.common.serialization.StringSerializer
mp.messaging.incoming.from-kafka.connector=smallrye-kafka
mp.messaging.incoming.from-kafka.topic=testkafka
mp.messaging.incoming.from-kafka.value.deserializer=org.apache.kafka.common.serialization.StringDeserializer
mp.messaging.outgoing.from-kafka.tracing-enabled=true
# Settings for the 'to-amqp' and 'from-amqp' channels
mp.messaging.outgoing.to-amqp.connector=smallrye-amqp
mp.messaging.outgoing.to-amqp.address=testamqp
mp.messaging.incoming.from-amqp.connector=smallrye-amqp
mp.messaging.incoming.from-amqp.address=testamqp
mp.messaging.outgoing.from-amqp.tracing-enabled=false