Dynatrace automatically detects event-based message queue handlers. To get insight into applications using non-standard or non-event-based message queue handlers, you must first define a custom messaging service for your consumers.
To define a custom messaging service for your consumers
Go to Settings > Service detection > Custom service detection.
Select whether your messaging service is based on Java, .NET, or Node.js, and then select Define messaging service.
Define the name of your messaging service, choose your messaging technology from the list, and then select Find entry point.
Select the process that contains your entry point from the list and select Continue.
Find the class you want to instrument, select the required class or file, and select Continue.
Java .NET To instrument the class, you can
Node.js Select the file containing the custom service. Dynatrace presents a list of methods that can be used as a custom service. Select the desired method to complete the configuration.
Select the methods you want to instrument and select Finish.
See the requirements for Apache Kafka, Amazon SQS SDK and Spring Cloud AWS SQS in the section below.
The Define custom service page displays the newly added entry point and methods.
optional Add more entry points if needed.
optional Restrict the new custom service to certain process groups. See the Restrict a custom service to specific process groups section below.
Review the entry point and methods to be instrumented.
In the lower-right corner of the page, select Save.
.NET Node.js Restart your consumer application so that the custom messaging service can be detected.
Custom incoming messaging services for the AWS SQS SDK must define a method in your code that is responsible for processing a single SQS message. Only such methods can be used as an entry point for AWS SQS SDK messaging services. The defined method must have exactly one Message
parameter (and any number of other parameters) defined.
Select a method that has one of the following arguments. The full package path is required.
com.amazonaws.services.sqs.model.Message
software.amazon.awssdk.services.sqs.model.Message
The required tracing attributes for incoming tagging (x-dynatrace
, traceparent
and tracestate
) are automatically added by OneAgent. To disable this option,
optionDisableSqsReceiveAutomaticTracingMessageAttributesJava
property to true
.messageAttributeNames
on the ReceiveMessageRequest
to the tracing attributes mentioned above or to .*
or All
to receive all message attributes.Custom messaging services for Apache Kafka must define a method in your code that is responsible for processing a single Kafka message. Only such methods can be used as an entry point for Kafka messaging services.
Select a method that has a Kafka org.apache.kafka.clients.consumer.ConsumerRecord
as an argument. The full package path is required.
If you use the @SqsListener
annotation or the MessageListener interface, no further configuration is needed.
If you use the SqsTemplate, a custom messaging service for Spring Cloud AWS SQS incoming must define a method in your code that is responsible for processing a single SQS message. This method can be used as an entry point for Spring Cloud AWS SQS messaging services. The defined method must have exactly one Message
parameter (and any number of other parameters).
Select a method that has exactly one Spring Cloud AWS SQS org.springframework.messaging.Message
parameter, no AWS SDKv1 SQS com.amazonaws.services.sqs.model.Message
and AWS SDKv2 SQS software.amazon.awssdk.services.sqs.model.Message
parameters and any amount of other parameters. The full package path is required.
The required tracing attributes for incoming tagging (x-dynatrace
, traceparent
and tracestate
) are automatically added by OneAgent. To disable this option, set the optionDisableSqsReceiveAutomaticTracingMessageAttributesJava
property to true
. In Spring, the message attribute names to receive is set to All
by default.
If you have several custom services defined, the evaluation goes from top to bottom, applying the first matching rule. If for some reason you have the same class and method defined in several custom services, make sure to prioritize the services accordingly.
You can edit any custom service at any time. For changes to take effect, you need to restart the affected processes, unless real-time updates are activated for Java and PHP. For .NET and Node.js, you must restart the process.
To edit a custom service, select the service's Edit button in the list of services. You can
Updates to Java and PHP custom messaging services can be applied in near real time, without process restarts. To activate this feature, go to Settings > Server-side service detection > Deep monitoring > Real-time updates to Java and PHP services and enable the dedicated switches.
Note that with real-time updates, you do not need to restart processes; however, such updates might cause CPU spikes when deployed.
You can restrict usage of any custom service to certain process groups. Custom service rules apply in specified process groups only and are ignored in other process groups. You can restrict a custom service when you create it or edit it.
To restrict a custom service