Context-based monitoring for Java applications
Let's say your application server has three Java applications running on it.
By default, transactions of all applications coming from the same app server are shown collectively under the Web Transactions tab in APM Insight.
In the image cited below, ZYLKER is the application monitor name, and travel,cafe and tourism are three contexts running on the same application server.
The transactions of these three applications are listed out in the Web Transaction tab.
Now, with context-based monitoring, you can monitor the performance of all individual applications running in the same app server separately, which helps you analyze your application performance at a more granular level.
This means that by enabling context-based monitoring, transactions of travels, tourism and cafe can be viewed separately.
Read on to know
- How to enable context-based monitoring
- How to rename or group your contexts
- How to disbale context-based monitoring
How to enable context-based monitoring
- Log in to Site24x7.
- Download and install the APM Insight Java agent if you haven't already.
- Add the following key in the apminsight.conf file:
- "context.monitoring.enabled=true"
- Restart the server.
- Perform some transactions in respective contexts for the agent to identify them as individual monitors.
Note: Each context name is prefixed with the application name provided in the configuration file.
Example: If the application name provided in the configuration file is ZYLKER, and individual context names are tourism, cafe, and travels, then the individual contexts will be shown in the APM Insight client as shown below:
ZYLKER/Tourism
ZYLKER/Cafe
ZYLKER/Travels
If context-based monitoring is enabled, each individual context is considered a separate APM application, and each context consumes an advanced monitor license.
How to rename or group context names
To rename your contexts:
- Navigate to the APM Insight agent directory.
- Create a file named:
- "context_naming_patterns_conf"
- Provide a key-value pair, with the syntax key=value, wherein:
- Key denotes the exact context name or regex matching the context names.
- Value denotes the name used to rename the context.
Example:
- When you want to change your context name from sampleapp to jpetstore, provide the key-value pair as sampleapp=jpetstore
- When you have contexts like /api/1, /api/2 and you want to monitor them as a single application, they can be grouped as /api/\d+=/api
Keep in mind:
- Background transactions are not shown for individual contexts. Since it is not possible to identify which context triggered a background transaction, background transactions are captured at the JVM level, and the data is shown at the application level.
- Thread profiling is completed for the entire JVM and is not specific to context. Irrespective of which context the profiling is initiated from, it's performed on whole JVM and pushed to the main APM application (the one with name provided in the configuration file).
Note: This feature is available only from APM Insight Java agent version 4.4
Disabling context-based monitoring
To disable context based monitoring:
- Add the following parameter in your apminsight.conf file:
- "context.monitoring.enabled=false"
- In your agent directory, check for the directory "apminsight_monitors," and delete it, if it exists.
- Restart your app server.