How do I configure custom services?

A custom service is a service that has a manually defined method, class, or interface as its entry point. You can use custom services to monitor service components that Dynatrace doesn't detect automatically.

You can define custom services for Java, .NET, and PHP. Each custom service may contain multiple entry points.

Entry points for your custom service can be methods of a specific class or implementations of an interface. Each non-recursive call to such a method represents a single request to your custom service. OneAgent understands the concept of method delegation and only records the first call in a delegation chain. For example, if you have two versions of a method called doSomething and one method calls the other, you can safely mark both methods as entry points—instances where one method directly calls the other are recorded as single requests.

Java and .NET services

For Java and .NET you can use search to select the entry point and methods or you can specify them manually. To create a new custom Java or .NET service:

  1. Go to Settings > Server-side service monitoring > Custom service detection.
  2. Do one of the following:
    • Java Select the Java services tab, and click Define Java service.
    • .NET Select the .NET services tab, and click Define .NET service.
  3. Give your service a meaningful name.
  4. Click Find entry point.
  5. Find and select the process group that contains your entry point.
  6. Select the process that contains your entry point and click Continue.
  7. Find the class you want to instrument. Type in the name or part of the name to search for it.
  8. Select the required class and click Continue.
  9. 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.
  10. Select the methods you want to instrument, and click Finish.
    The Define custom service page displays the newly added entry point and methods.
  11. If needed, add more entry points.
  12. If needed, restrict the new custom service to certain process groups. See the Restrict a custom service to specific process groups section below.
  13. Review the entry point and methods to be instrumented.
  14. In the top right corner of the page, click Save.

PHP services

For PHP you can only specify entry points manually. To create a new custom PHP service:

  1. Go to Settings > Server-side service monitoring > Custom service detection.
  2. Select the PHP services tab, and click Define PHP service.
  3. Give your service a meaningful name.
  4. Click Define entry point manually.
  5. In the File name field, type the full path to the PHP file, containing the methods you want to instrument.
  6. In the Fully qualified class name field, type the name of the class that contains the methods you want to instrument.
  7. In the Methods field, type the name of the method you want to instrument.
  8. If needed, click Add method manually, and specify more methods for instrumentation.
  9. If needed, restrict the new custom service to specific process groups. See the Restrict a custom service to specific process groups section below.
  10. Once all methods have been added, click Save in the upper-right corner of the page.

Messaging services

Dynatrace automatically detects event-based message queue handlers. However, if your application doesn't use such a message queue handler and instead dequeues messages in a busy loop, Dynatrace can't automatically detect how the messages are processed. To get insight into this, create a custom message service. In such a case, Dynatrace can connect the custom message service to the respective queue listener service.

To create a messaging service:

  1. Go to Settings > Server-side service monitoring > Custom service detection.
  2. Select the Java services tab, and click Define Java service.
  3. Give your service a meaningful name.
  4. Specify the classes and methods to be instrumented, as described in the Java and .NET services section above.
  5. On the Define custom Java service page, select the This service is used inside a busy loop to process dequeued messages of a queue checkbox.
  6. If needed, restrict the new messaging service to certain process groups. See the Restrict a custom service to specific process groups section below.
  7. In the top right corner of the page, click Save.

Priority of 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, 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 and PHP custom services can be applied in 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 update may cause CPU spikes when changes are deployed.

Restrict a custom service to specific process groups

You can restring 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 restring a custrom service during creation or edit it later.

To restrict a custom service:

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