Correlate Business Transactions with Network Requests (Optional)

To correlate business transactions (BTs) with network requests, you need to have instrumented a business application and enabled business transactions in the Controller UI. See Correlate Business Transactions for IoT Monitoring to learn more.

The steps below show you how to get the BT response headers and use them to correlate the BT with an IoT Network Request event.

  1. Make a network request that includes the Splunk AppDynamics HTTP request headers ADRUM and ADRUM_1 to one of your business applications:
    PYTHON
    import com.appdynamics.iot.HttpRequestTracker;
    ...    
    // Create a network request to the business app.  
    String url = "<url_to_business_application>";        
    URL thisUrl = new URL(url);
    [AppDynamics Instrumentation] Get a Tracker            
    HttpURLConnection con = (HttpURLConnection) thisUrl.openConnection();            
    final HttpRequestTracker tracker = Instrumentation.beginHttpRequest(thisUrl);
    con.setRequestMethod("POST"); // Some HTTP method: GET, POST, PUT...
     
    // Add the AppDynamics HTTP headers ADRUM and ADRUM_1 to the request.
    con.setRequestProperty("ADRUM", "isAjax:true");
    con.setRequestProperty("ADRUM_1", "isMobile:true");
     
    // Make the request to your business app.
    con.setDoInput(true);
  2. The call will return response headers that contain information for correlating business transactions. If you were to print these BT response headers, you would see something like the following:
    JSON
    {
      ADRUM_1=[globalAccountName:customer1_78203698-278e-428f-8726-bb381219c6cb], 
      null=[HTTP/1.1 200 OK], 
      ADRUM_0=[clientRequestGUID:2ff45113-6746-4c94-b6d0-4af26055613c], 
      ADRUM_3=[btERT:269], 
      ADRUM_2=[btId:4423], 
      Server=[Jetty(9.4.z-SNAPSHOT)], 
      ADRUM_5=[btDuration:327], 
      ADRUM_4=[serverSnapshotType:f], 
      Content-Length=[514], 
    }
  3. Send a beacon containing the BT response headers to the EUM Server:
    CODE
    // Fetch the response headers, which will include the BT headers (ADRUM_0, ADRUM_1, ...).
    Map<String, List<String>> headerFields = con.getHeaderFields();
     
    // Add the BT response headers to the request body of the Network Request event.
    // that you're reporting.
    tracker.withResponseCode(responseCode).withError(response.toString()).reportDone();
                       .withResponseHeaderFields(headerFields)                    
                       .reportDone();
     
    // Report the Network Request event to the EUM Server.
    Instrumentation.sendAllEvents();
  4. In the Controller UI, you should be able to view the correlated business transaction in the Device Details dialog.