docs: private void addConditionalFieldsToAttemptEvent(AWSRequestMetrics metrics, HandlerAfterAttemptContext context,
                                                      ApiCallAttemptMonitoringEvent event) {
          TimingInfo timingInfo = metrics == null ? null : metrics.getTimingInfo();
          Response<?> response = context.getResponse();
          Integer statusCode = null;
          String xAmznRequestId = null;
          String xAmzRequestId = null;
          String xAmzId2 = null;
          Long requestLatency = null;
  
          Map<String, String> responseHeaders = null;
          if (response != null && response.getHttpResponse() != null) {
              responseHeaders = response.getHttpResponse().getHeaders();
              statusCode = response.getHttpResponse().getStatusCode();
              requestLatency = calculateRequestLatency(timingInfo);
          } else if (context.getException() instanceof AmazonServiceException) {
              responseHeaders = ((AmazonServiceException) context.getException()).getHttpHeaders();
              statusCode = extractHttpStatusCode((AmazonServiceException) context.getException());
              requestLatency = calculateRequestLatency(timingInfo);
          }
  
          if (responseHeaders != null) {
              xAmznRequestId = responseHeaders.get(X_AMZN_REQUEST_ID_HEADER_KEY);
              xAmzRequestId = responseHeaders.get(X_AMZ_REQUEST_ID_HEADER_KEY);
              xAmzId2 = responseHeaders.get(X_AMZ_REQUEST_ID_2_HEADER_KEY);
          }
  
          event.withXAmznRequestId(xAmznRequestId)
               .withXAmzRequestId(xAmzRequestId)
               .withXAmzId2(xAmzId2)
               .withHttpStatusCode(statusCode)
               .withRequestLatency(requestLatency);
          addException(context.getException(), event);
      }