Creating Frontends, Backends and App Map data for non J2EE applications

Document ID : KB000019015
Last Modified Date : 14/02/2018
Show Technical Document Details

Description:

Non J2EE applications tend not to report Frontend and Backend metrics and may not populate the Application Triage map. This can be corrected with a number of custom directives.

Solution:

In order to illustrate how to provide Frontend/Backend metrics with AppMap data, a simple test application has been uploaded to this article. It contains three java classes:


mainMethod
   main
 
MyFrontend
  void frontend(MyBackend be)
 
MyBackend
  void backend()

MyFrontend.frontend calls MyBackend.backend. The thread sleeps for random time intervals before, after and during the call to introduce changing metrics values. Please refer to mainMethod.java, MyBackend.java and MyFrontend.java for full details.

The first step is to mark the frontend/backend metrics using the following directives:


custom.pbd:
------------------------------------------------------------------------------------
#This directives file is provided as a place to try out directives
# without having to modify the out-of-the-box configuration.
 
SetFlag: CustomFrontendTracing
TurnOn: CustomFrontendTracing
SetFlag: CustomBackendTracing
TurnOn: CustomBackendTracing
 
IdentifyClassAs: MyFrontend CustomFrontendTracing
IdentifyClassAs: MyBackend CustomBackendTracing
 
TraceOneMethodIfFlagged: CustomFrontendTracing frontend FrontendMarker "Apps|{classname}|{method}"
TraceOneMethodIfFlagged: CustomBackendTracing backend BackendMarker "Custom Services|{classname}|{method}"
------------------------------------------------------------------------------------

A test application can be deployed with an agent from 9.1 and above. Make sure the following directives are in a file custom.pbd and this is added to the agent profile:

introscope.autoprobe.directivesFile=default-typical.pbl,custom.pbd,hotdeploy

Once it has been confirmed that the frontend/backend metrics are populated the AppMap can be added:


------------------------------------------------------------------------------------
# In order to trace custom nodes in AppMap in addition to standard nodes, we need to create some custom
# tracer mappings. One for determining application name, and another for tracing nodes.
 
SetTracerClassMapping: AppMapCustomAppNameTracer com.wily.introscope.appmap.agent.trace.AppMapApplicationNameTracer
com.wily.introscope.probebuilder.validate.ResourceNameValidator
SetTracerParameter: AppMapCustomAppNameTracer ownerType Application
SetTracerOrdering: AppMapCustomAppNameTracer -5001
 
 
SetTracerClassMapping: AppMapCustomAppTracer com.wily.introscope.appmap.agent.trace.AppMapEnablingTracer 
com.wily.introscope.probebuilder.validate.ResourceNameValidator
SetTracerParameter: AppMapCustomAppTracer nodeType Servlet
SetTracerParameter: AppMapCustomAppTracer nodeLevel MethodClass
SetTracerParameter: AppMapCustomAppTracer ownerType Application
SetTracerOrdering: AppMapCustomAppTracer -5000
 
SetTracerClassMapping: AppMapCustomBackendTracer com.wily.introscope.appmap.agent.trace.AppMapEnablingTracer 
com.wily.introscope.probebuilder.validate.ResourceNameValidator
SetTracerParameter: AppMapCustomBackendTracer nodeType Database
SetTracerParameter: AppMapCustomBackendTracer nodeLevel MethodClass
SetTracerParameter: AppMapCustomBackendTracer ownerType Application
SetTracerParameter: AppMapCustomBackendTracer boundaryType Backend
SetTracerOrdering: AppMapCustomBackendTracer -5000
 
# Now we need to add a tracer to generate application name. It needs to be called before other tracers, 
so put it on frontend method.
 
TraceOneMethodIfFlagged: CustomFrontendTracing frontend AppMapCustomAppNameTracer "MyFrontend"
 
# Now let's add AppMap nodes. We can use the same tracer flags that we used for blame point metrics.
 
# First create frontend node:
TraceOneMethodIfFlagged: CustomFrontendTracing frontend AppMapCustomAppTracer "{classname}|{method}" 
# And backend node:
TraceAllMethodsIfFlagged: CustomBackendTracing AppMapCustomBackendTracer "{method}" 
------------------------------------------------------------------------------------

Watch out for line feeds added to these directives, see the custom.pbd uploaded to check syntax. This will add the console application to the AppMap.

File Attachments:
TEC605137.zip