ビジネストランザクションをネットワークリクエストと関連付ける(オプション)
ビジネストランザクション(BT)をネットワークリクエストと関連付けるには、ビジネスアプリケーションをインストゥルメント化し、コントローラ UI でビジネストランザクションを有効にしておく必要があります。IoT モニタリング用のビジネストランザクションの相関 IoT モニタリング用のビジネストランザクションの相関
次の手順では、BT レスポンスヘッダーを取得し、それらを使用して、その BT を IoT ネットワーク リクエスト イベントと関連付ける方法について説明します。
- Splunk AppDynamics HTTP リクエストヘッダー ADRUM と ADRUM_1 を含むネットワークリクエストをビジネスアプリケーションのいずれかに実行します。
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); - コールは、関連するビジネストランザクションの情報を含むレスポンスヘッダーを返します。これらの BT レスポンスヘッダーを出力する場合は、次のように表示されます。
{ 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], } - BT レスポンスヘッダーを含むビーコンを EUM サーバに送信します。
// 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(); - コントローラ UI では、[Device Details] ダイアログで関連するビジネストランザクションを確認できます。