Lately, we’re seeing that automation is the main focus of IT, and microservice architectures are becoming increasingly common. This means that APIs are becoming more and more important to us and our customers. With the growing adoption of APIs, the complexity of use cases based on APIs is growing as well. This means that the monitoring of these APIs needs to reflect current developments and allow the monitoring of such use cases.
Just this summer, private synthetic multi-request HTTP monitors became publicly available. Right from the start of our HTTP monitors offering, we promised extensive scripting capabilities that further expand the already extensive monitoring capabilities of HTTP monitors, and that update is finally here.
Pre- and post-execution scripting enables sophisticated API monitoring use cases
Think of your API use cases, including the monitoring of services used by mobile apps, and consider when your use cases will include:
- Complex authentication
- Logic between requests
- Passing of information between requests
- The use of custom functions that perform response parsing
- Other custom code
For such advanced scenarios, pre- and post-execution scripting is the solution.
Example use case
When you execute more complex API requests, the need for scripting may occur. Say you want to add logic between steps, skipping a request based directly on a response received from another request. To achieve this you need to:
- Define a request.
- In a post-execution script, verify the conditions based on the request.
- If the conditions are met, skip the “Pre-execution scripts” step and proceed to the “Post-execution scripts” step.
For more examples with code snippets that show how the examples were implemented, see Dynatrace Help.
With the release of ActiveGate version 1.173, it’s now possible to use:
- Variables – to pass information between requests
Head over to Dynatrace Help for more technical details, the list of available methods, and example HTTP monitors that are defined using pre- and post-execution scripts.
How to get started
To start using this feature, you only need a private synthetic location that is based on ActiveGate version 1.173+.
It’s not possible to assign monitors that use these features to locations with ActiveGates that are older than version 1.173; the locations must be upgraded to version 1.173+.
How to use this feature
The use of variables is now possible with the use of curly brackets as in other parts of Dynatrace. Use curly brackets (
}) to access the variables you’ve defined in your pre- and post-execution scripts.
Stay tuned for the next set of Synthetic Monitoring features, including, but not limited to:
- Credential Vault
- New public locations
- Support for new cloud vendors
Start a free trial!
Dynatrace is free to use for 15 days! The trial stops automatically, no credit card is required. Just enter your email address, choose your cloud location and install our agent.