This topic explains how to use JMX to enable Server-Side Profiling on a PAS for OpenEdge instance. You may not want to gather performance data for every request handled by an instance. Use filters to restrict which requests are profiled on a particular instance. Filters are configured and enabled using JMX and REST APIs. Filters are described in the Supported JSON values for JMX queries topic.

For information on how to configure and enable filters using REST APIs, see Push profiler data and Get profiler settings.

Before executing the steps in this topic, ensure the diagnostic store is deployed and running.

Note: Line breaks are not supported in JMX queries ran through the OEJMX utility. The queries must be written on a single line even though they appear formatted in this document.

In this procedure, you are configuring profiling on the target PAS for OpenEdge instance and sending the profiled data to the diagnostic store. Perform the following steps:

  1. Ensure the diagnostic store and the target PAS for OpenEdge instance are running. The target instance requires the oemanager.war deployed to access REST APIs.
  2. Run an JMX query to return the list of MS Agents running for a given ABL application on the target instance:
    1. In the /bin directory of the target instance, create a JMX query called agentInfo.qry. For example:
      {"O":"PASOE:type=OEManager,name=AgentManager","M":["getAgents","APP_NAME"]}

      where APP_NAME is the ABL application you want to profile.

    2. Run the query:
      oejmx.[bat|sh] -R -Q agentInfo.qry

      The output of the file is sent to the instance-name/temp directory

    3. Open the agentInfo output file and copy the agentId value. This ID is used in the following steps.
  3. In the /bin directory of the target instance, create a JMX query to capture diagnostic data.

    The following example query captures diagnostic information for the next 100 Server Status requests. It also uses the AdapterMask and Proclist filters. See Supported JSON values for JMX queries for a list of supported Profiler Settings.

    {"O":"PASOE:type=OEManager,name=AgentManager",
    "M":["pushProfilerData","AGENT_ID",
    "http://host:port/oediagstore/web/diag",100,
    "{\"Coverage\":true,\"AdapterMask\":null,
    \"ProcList\":null,\"TestRunDescriptor\":\"Sample Test\"}"]}
    where:
    • host and port to point to the diagnostic store.
    • AGENT_ID is the agent ID running on the target instance
    Note: In this example, providing null value is equivalent to not providing a filter. In such a case, the filter uses the default value.
  4. Execute the query to start profiling:
    oejmx.[bat|sh] -R -Q diaginfo.qry

    The output is sent to the instance-name/temp directory.

    The following output is returned:

    {"pushProfilerData":
    {"ABLReturnVal":true,
    "agentId":"solo8Wm7TquALsSQ1lpX4g",
    "pid":"8116"}}

    If the result of ABLReturnVal is true, the JMX Query executed successfully and profiling is successfully enabled on the target PAS for OpenEdge instance.

  5. Execute the following query to get the profiler settings and save it in the instance-name/bin directory as profilersettings.qry:
    {"O":"PASOE:type=OEManager,name=AgentManager",
    "M":["getProfilerSettings","AGENT_ID"]}
    where AGENT_ID is the agent ID.
  6. Run the following query to show that the profiler settings for the target PAS for OpenEdge instance are enabled:
    oejmx.[sh|bat] -R -Q profilersettings.qry

    The output is sent to the target instance-name/temp directory.

    The following result is returned:
    {"getProfilerSettings":{"ABLOutput":
    {
    "AdapterMask":"APSV,SOAP,REST,WEB",
    "ProcList":"",
    "RequestHiBound":-1,
    "TestRunDescriptor":"Sample Test",
    "bufsize":128,
    "RequestLoBound":0,
    "Coverage":true,
    "RequestCount":100,
    "Statistics":false,
    "URL":"http://localhost:8850/oediagstore/web/diag"},
    "ABLReturnVal":true,
    "agentId":"solo8Wm7TquALsSQ1lpX4g",
    "pid":"8116"
    }
    }
  7. Run a sample _oeping service on the target instance to see if the REST Service ABL Code is profiled and sent to the diagnostic store.

    If the request matches the filters you specified in the JMX query, the agent in the instance pushes the profiling data to the diagnostic store.

    curl http://host:port/rest/_oepingService/_oeping

    The _oepingService calls the ABL class OpenEdge.Rest.Admin.AppServerStatus and invokes ServerStatus. Since this matches the filter and the AdapterMask is REST, this request is profiled and the profiler output is sent to the diagnostic store. For more information about the OE Ping Service, see ABL application PING service.

  8. To view and analyze the profiler data, export the data from the diagnostic store (oediagdb) to a .prof file and open that file in Progress Developer Studio.

    To export the data, run the following ABL code in the Procedure Edtior after connecting to the diagnostic store database:

    DEFINE VAR requestId as Integer NO-UNDO.
    DEFINE VAR fileName as Character NO-UNDO.
    FOR EACH ProfiledRequest:    
    	requestId = requestId + 1.    
    	fileName =  "C:/OpenEdge/WRK/profiler_" + STRING(requestId) + ".prof".
        COPY-LOB ProfiledRequest.PerfData TO FILE fileName.
        MESSAGE fileName VIEW-AS ALERT-BOX.
    END.
    Note: On UNIX or Windows, replace C:/OpenEdge/WRK with the full system path to the WRK directory where you want to put the profiler files.
  9. From the specified WRK directory, open the generated .prof in Progress Developer Studio, or other profiler tool, to view the profiled data.

    In Progress Developer Studio, the profiled data appears in the Module Details page. It shows a summary of the events observed during the run-time ping request.

    Figure 1. Example ABL Profiler Data in Progress Developer Studio