lib/service.js
function apiAttemptEvent(request) {
    var api = request.service.api.operations[request.operation];
    var monitoringEvent = {
      Type: 'ApiCallAttempt',
      Api: api ? api.name : request.operation,
      Version: 1,
      Service: request.service.api.serviceId || request.service.api.endpointPrefix,
      Fqdn: request.httpRequest.endpoint.hostname,
      UserAgent: request.httpRequest.getUserAgent(),
    };
    var response = request.response;
    if (response.httpResponse.statusCode) {
      monitoringEvent.HttpStatusCode = response.httpResponse.statusCode;
    }
    if (
      !request._unAuthenticated &&
      request.service.config.credentials &&
      request.service.config.credentials.accessKeyId
    ) {
      monitoringEvent.AccessKey = request.service.config.credentials.accessKeyId;
    }
    if (!response.httpResponse.headers) return monitoringEvent;
    if (request.httpRequest.headers['x-amz-security-token']) {
      monitoringEvent.SessionToken = request.httpRequest.headers['x-amz-security-token'];
    }
    if (response.httpResponse.headers['x-amzn-requestid']) {
      monitoringEvent.XAmznRequestId = response.httpResponse.headers['x-amzn-requestid'];
    }
    if (response.httpResponse.headers['x-amz-request-id']) {
      monitoringEvent.XAmzRequestId = response.httpResponse.headers['x-amz-request-id'];
    }
    if (response.httpResponse.headers['x-amz-id-2']) {
      monitoringEvent.XAmzId2 = response.httpResponse.headers['x-amz-id-2'];
    }
    return monitoringEvent;
  }
function apiAttemptEvent(request) {
    var api = request.service.api.operations[request.operation];
    var monitoringEvent = {
      Type: 'ApiCallAttempt',
      Api: api ? api.name : request.operation,
      Version: 1,
      Service: request.service.api.serviceId || request.service.api.endpointPrefix,
      Fqdn: request.httpRequest.endpoint.hostname,
      UserAgent: request.httpRequest.getUserAgent(),
    };
    var response = request.response;
    if (response.httpResponse.statusCode) {
      monitoringEvent.HttpStatusCode = response.httpResponse.statusCode;
    }
    if (
      !request._unAuthenticated &&
      request.service.config.credentials &&
      request.service.config.credentials.accessKeyId
    ) {
      monitoringEvent.AccessKey = request.service.config.credentials.accessKeyId;
    }
    if (!response.httpResponse.headers) return monitoringEvent;
    if (request.httpRequest.headers['x-amz-security-token']) {
      monitoringEvent.SessionToken = request.httpRequest.headers['x-amz-security-token'];
    }
    if (response.httpResponse.headers['x-amzn-requestid']) {
      monitoringEvent.XAmznRequestId = response.httpResponse.headers['x-amzn-requestid'];
    }
    if (response.httpResponse.headers['x-amz-request-id']) {
      monitoringEvent.XAmzRequestId = response.httpResponse.headers['x-amz-request-id'];
    }
    if (response.httpResponse.headers['x-amz-id-2']) {
      monitoringEvent.XAmzId2 = response.httpResponse.headers['x-amz-id-2'];
    }
    return monitoringEvent;
  }
function apiAttemptEvent ( request ) { var api = request . service . api . operations [ request . operation ] ; var monitoringEvent = { Type : 'ApiCallAttempt' , Api : api ? api . name : request . operation , Version : 1 , Service : request . service . api . serviceId || request . service . api . endpointPrefix , Fqdn : request . httpRequest . endpoint . hostname , UserAgent : request . httpRequest . getUserAgent ( ) , } ; var response = request . response ; if ( response . httpResponse . statusCode ) { monitoringEvent . HttpStatusCode = response . httpResponse . statusCode ; } if ( ! request . _unAuthenticated && request . service . config . credentials && request . service . config . credentials . accessKeyId ) { monitoringEvent . AccessKey = request . service . config . credentials . accessKeyId ; } if ( ! response . httpResponse . headers ) return monitoringEvent ; if ( request . httpRequest . headers [ 'x-amz-security-token' ] ) { monitoringEvent . SessionToken = request . httpRequest . headers [ 'x-amz-security-token' ] ; } if ( response . httpResponse . headers [ 'x-amzn-requestid' ] ) { monitoringEvent . XAmznRequestId = response . httpResponse . headers [ 'x-amzn-requestid' ] ; } if ( response . httpResponse . headers [ 'x-amz-request-id' ] ) { monitoringEvent . XAmzRequestId = response . httpResponse . headers [ 'x-amz-request-id' ] ; } if ( response . httpResponse . headers [ 'x-amz-id-2' ] ) { monitoringEvent . XAmzId2 = response . httpResponse . headers [ 'x-amz-id-2' ] ; } return monitoringEvent ; }
Event recording metrics for an API call attempt.
@returns {object} a subset of api call attempt metrics
@api private
Event recording metrics for an API call attempt .