Example usage for com.amazonaws AmazonServiceException getHttpHeaders

List of usage examples for com.amazonaws AmazonServiceException getHttpHeaders

Introduction

In this page you can find the example usage for com.amazonaws AmazonServiceException getHttpHeaders.

Prototype

public Map<String, String> getHttpHeaders() 

Source Link

Usage

From source file:com.netflix.spinnaker.kork.aws.AwsMetricsSupport.java

License:Apache License

static String[] buildExceptionTags(AmazonWebServiceRequest originalRequest, Exception exception) {
    final AmazonServiceException ase = amazonServiceException(exception);

    String targetAccountId = DEFAULT_UNKNOWN;
    if (ase.getHttpHeaders() != null) {
        targetAccountId = ase.getHttpHeaders().get("targetAccountId");
    }/*w  ww  .j  a va  2 s  .com*/

    return new String[] { "requestType", originalRequest.getClass().getSimpleName(), "statusCode",
            Integer.toString(ase.getStatusCode()), "errorCode",
            Optional.ofNullable(ase.getErrorCode()).orElse(DEFAULT_UNKNOWN), "serviceName",
            Optional.ofNullable(ase.getServiceName()).orElse(DEFAULT_UNKNOWN), "errorType",
            Optional.ofNullable(ase.getErrorType()).orElse(AmazonServiceException.ErrorType.Unknown).name(),
            "accountId", Optional.ofNullable(targetAccountId).orElse(DEFAULT_UNKNOWN) };
}