1.0 Overview
X-Request-ID is a random request-id to uniquely identify each request sent to the Fortanix-Data-Security-Manager (DSM). This ID is available as one of the parameters in the response headers of the API response object.
2.0 Java SDK
The code to fetch the X-Request-ID is available in the ApiClient
class of the Java SDK.
For every call to the Fortanix DSM, the ApiClient
class extracts the request-id from the response headers and displays it in the logs.
The code snippet from the ApiClient
class is displayed below.
this.responseHeaders = this.buildResponseHeaders(response);
xRequestId = String.valueOf(((List)response.getHeaders().get("x-request-id")).get(0));
The Java SDK logs displaying the X-Request-ID along with the latency for each API call being made to the Fortanix DSM are displayed below.
Running com.fortanix.sdkms.jce.provider.DSASignatureTest
Mar 09, 2022 2:40:48 PM com.fortanix.sdkms.v1.ApiClient invokeAPI
INFO: /sys/v1/session/auth, POST, X-Request-Id: 4p1UzqZM, Status: 200, Latency: 3458ms
Mar 09, 2022 2:40:49 PM com.fortanix.sdkms.v1.ApiClient invokeAPI
INFO: /sys/v1/version, GET, X-Request-Id: RaUiWRzD, Status: 200, Latency: 710ms
Mar 09, 2022 2:40:49 PM com.fortanix.sdkms.v1.ApiClient invokeAPI
INFO: /crypto/v1/keys, POST, X-Request-Id: phgdKhuh, Status: 201, Latency: 644ms
Mar 09, 2022 2:40:50 PM com.fortanix.sdkms.v1.ApiClient invokeAPI
INFO: /crypto/v1/digest, POST, X-Request-Id: KxxmublC, Status: 200, Latency: 447ms
Mar 09, 2022 2:40:51 PM com.fortanix.sdkms.v1.ApiClient invokeAPI
INFO: /crypto/v1/sign, POST, X-Request-Id: kmayCPb9, Status: 200, Latency: 690ms
Mar 09, 2022 2:40:51 PM com.fortanix.sdkms.v1.ApiClient invokeAPI