Skip to content

Commit 58f4db4

Browse files
committed
Include 'accountId' in exception tags
1 parent 87b1ed4 commit 58f4db4

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

kork-core/src/main/java/com/netflix/spinnaker/kork/aws/AwsMetricsSupport.java

+7-1
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,18 @@ public class AwsMetricsSupport {
2626
static String[] buildExceptionTags(AmazonWebServiceRequest originalRequest, Exception exception) {
2727
final AmazonServiceException ase = amazonServiceException(exception);
2828

29+
String targetAccountId = DEFAULT_UNKNOWN;
30+
if (ase.getHttpHeaders() != null) {
31+
targetAccountId = ase.getHttpHeaders().get("targetAccountId");
32+
}
33+
2934
return new String[] {
3035
"requestType", originalRequest.getClass().getSimpleName(),
3136
"statusCode", Integer.toString(ase.getStatusCode()),
3237
"errorCode", Optional.ofNullable(ase.getErrorCode()).orElse(DEFAULT_UNKNOWN),
3338
"serviceName", Optional.ofNullable(ase.getServiceName()).orElse(DEFAULT_UNKNOWN),
34-
"errorType", Optional.ofNullable(ase.getErrorType()).orElse(AmazonServiceException.ErrorType.Unknown).name()
39+
"errorType", Optional.ofNullable(ase.getErrorType()).orElse(AmazonServiceException.ErrorType.Unknown).name(),
40+
"accountId", Optional.ofNullable(targetAccountId).orElse(DEFAULT_UNKNOWN)
3541
};
3642
}
3743

0 commit comments

Comments
 (0)