Define queue messaging consuming custom services

Dynatrace automatically detects event-based message queue handlers for certain technologies like JMS and Rabbit MQ. Dynatrace can't automatically detect how the messages are processed if your application uses a non-standard RabbitMQ handler, a Kafka or .NET messaging service, or simply processes messages in a non-event driven fashion. To get insight into these, you must define a custom messaging service.

Define a custom messaging service

To define a custom messaging service, go to Settings > Server-side service monitoring > Custom service detection. Select whether your messaging service is based on Java or .NET. Click the Define messaging service button.

When you follow the workflow, ensure that you give the service a meaningful name and select the proper technology.

  1. Click Find entry point.

  2. Find and select the process group that contains your entry point.

  3. Select the process that contains your entry point and click Continue.

  4. Find the class you want to instrument. Type in the name or part of the name to search for it.

  5. Select the required class and click Continue.

  6. Define how you want to instrument the class. You have two options:

    • Use the selected class for instrumenting methods of the selected class only.
    • Use an implemented interface or superclass for instrumenting methods in any interface or super class in the class hierarchy. In such cases, click Load inheritance to load all available superclasses and interfaces, then select the one you need.
  7. Select the methods you want to instrument and click Finish.

    For Apache Kafka messaging services, you can only select methods with a ConsumerRecord argument. See the Apache Kafka section below.

    The Define custom service page displays the newly added entry point and methods.

  8. If needed, add more entry points.

  9. If needed, restrict the new custom service to certain process groups. See the Restrict a custom service to specific process groups section below.

  10. Review the entry point and methods to be instrumented.

  11. In the bottom right corner of the page, click Save.

Apache Kafka

Apache Kafka is different from other messaging services. Its interfaces are designed to process messages in bulk, yet the purpose of Dynatrace is to follow single transactions. Dynatrace can only do this if you define a Java method that is responsible for processing a single Kafka message in your code and use this as the entry point of your Kafka messaging service. To enforce this, the wizard ensures that you only pick methods that have a Kafka ConsumerRecord as an argument.

Priority of messaging custom services

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.

Edit custom service

You can edit any custom service at any time. For changes to take effect, you need to restart the affected processes, unless the real-time updates are activated for Java and PHP. For .NET, you must restart the process.

To edit a custom service, click the service's Edit button in the list of services.

You can activate/deactivate existing entry points, add/delete entry points, and add/delete methods in entry points.

You can also restrict the custom service to certain process groups. See the Restrict a custom service to specific process groups section below.

Real-time updates

Updates to Java custom messaging services can be applied in near real-time, without process restarts. To activate this feature, enable the Enable real-time updates to Java and PHP services selector at Custom service detection.

Real-time updates may cause CPU spikes when changes are deployed.

Restrict a custom service to specific process groups

You can restrict usage of any custom service to certain process groups. Custom services rules will apply in specified process groups only and will be ignored in other process groups. You can restrict a custom service during creation or edit it later.

To restrict a custom service:

  1. On the Define custom service or Edit service page, expand the Optionally restrict custom service rules by process groups drop-down menu.
  2. Click Add process group.
  3. Select the process group where you want to apply the custom service.
  4. Click Add.
  5. In the bottom right corner of the Define custom service or Edit service page, click Save.