/// <summary> /// Method that gets called in the final clause that captures data for each http request /// from the request and response context. /// </summary> protected static void CSMCallAttemptMetricsCapture(IRequestContext requestContext, IResponseContext responseContext) { requestContext.CSMCallAttempt.Service = requestContext.CSMCallEvent.Service; requestContext.CSMCallAttempt.Fqdn = requestContext.Request.GetHeaderValue(HeaderKeys.HostHeader); requestContext.CSMCallAttempt.UserAgent = requestContext.Request.GetHeaderValue(HeaderKeys.UserAgentHeader); requestContext.CSMCallAttempt.SessionToken = requestContext.Request.GetHeaderValue(HeaderKeys.XAmzSecurityTokenHeader); requestContext.CSMCallAttempt.Region = requestContext.Request.DeterminedSigningRegion; requestContext.CSMCallAttempt.Api = CSMUtilities. GetApiNameFromRequest(requestContext.Request.RequestName, requestContext.ServiceMetaData.OperationNameMapping, requestContext.CSMCallAttempt.Service); requestContext.CSMCallAttempt.AccessKey = requestContext.ImmutableCredentials.AccessKey; requestContext.CSMCallAttempt.AttemptLatency = AWSSDKUtils.ConvertTimeSpanToMilliseconds(requestContext .Metrics.StopEvent(Metric.CSMAttemptLatency) .ElapsedTime); if (responseContext.HttpResponse != null) { if ((int)responseContext.HttpResponse.StatusCode > 0) { requestContext.CSMCallAttempt.HttpStatusCode = (int)responseContext.HttpResponse.StatusCode; } requestContext.CSMCallAttempt.XAmznRequestId = responseContext.HttpResponse.GetHeaderValue(HeaderKeys.RequestIdHeader); requestContext.CSMCallAttempt.XAmzRequestId = responseContext.HttpResponse.GetHeaderValue(HeaderKeys.XAmzRequestIdHeader); requestContext.CSMCallAttempt.XAmzId2 = responseContext.HttpResponse.GetHeaderValue(HeaderKeys.XAmzId2Header); } }
public MonitoringAPICall(IRequestContext requestContext) : this() { Service = requestContext.ServiceMetaData.ServiceId; Api = CSMUtilities.GetApiNameFromRequest(requestContext.RequestName, requestContext.ServiceMetaData.OperationNameMapping, Service); }