Define custom services
If your application services aren't built on standard technologies, they may not be recognized out-of-the box. You can monitor these technologies, but you'll need to define them as custom services with specific service entry points. Another use case for custom services are microservices that are used by a larger application that aren't exposed via communication technologies.
Dynatrace allows you to define any method, class, or interface as the entry point of a service to be monitored.
A custom service is a service that has a manually defined method, class, or interface as its entry point.
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.
If transactions aren't connected, creating a custom service will not help to stitch them. A custom service will create a new entry point.
OneAgent understands the concept of method delegation and only records the first call in a delegation chain. For example, if you have several methods that are calling each other, you can safely mark all these methods as entry points—instances where one method directly calls the other are recorded as single requests.
OneAgent suppresses method delegation per service. That is, any calls between two methods of one service are not recorded. If you need to capture such calls you must create a separate custom service for it.
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:
Note that some scenarios do not work in Dynatrace, like the Queue/Worker scenario. Anything that is put into a
java.util.Queue and is handled by another worker thread, cannot be seen in the Pure Path. See Oracle java.util Interface Queue.
For PHP you can use search to select the entry point and methods or you can specify them manually. To create a new custom PHP service:
To create a new custom Go service via UI or API, see Custom Go services.
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.
For HTTP requests, Dynatrace uses an additional HTTP header called
x-dynatrace for transaction stitching. This header is set by OneAgent between web servers to link them with each other. PurePath® technology for distributed tracing relies heavily on such headers, which is why it’s important to ensure that network components, such as firewalls and routers, are never configured to remove these headers. Incorrect configuration of network components can potentially lead to broken pure paths. Also, some of the network components completely disable such requests (and deliver HTTP 403 error) as the additional header may be considered as unsafe. In such cases, it is necessary to configure these components to accept the
Edit a 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, select 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.
Updates to Java and PHP custom 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.
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:
- On the Define custom service or Edit service page, expand Optionally restrict custom service rules by process groups.
- Select Add process group.
Select the process group where you want to apply the custom service.
- Select Add.
- In the lower-right corner of the Define custom service or Edit service page, select Save.