/// <summary> /// Captures the overall execution time and logs final metrics. /// </summary> /// <param name="executionContext">The execution context which contains both the /// requests and response context.</param> public override void InvokeSync(IExecutionContext executionContext) { executionContext.RequestContext.Metrics.AddProperty(Metric.AsyncCall, false); try { executionContext.RequestContext.Metrics.StartEvent(Metric.ClientExecuteTime); base.InvokeSync(executionContext); } finally { var latency = AWSSDKUtils.ConvertTimeSpanToMilliseconds(executionContext.RequestContext.Metrics .StopEvent(Metric.ClientExecuteTime) .ElapsedTime); #if BCL || CORECLR // capture the latency for the entire SDK call if CSM is enabled if (executionContext.RequestContext.CSMEnabled) { executionContext.RequestContext.CSMCallEvent.Latency = latency; CSMUtilities.SerializetoJsonAndPostOverUDP(executionContext.RequestContext.CSMCallEvent); } #endif this.LogMetrics(executionContext); } }
/// <summary> /// Invokes the CSM handler and captures data for the CSM events. /// </summary> public override void InvokeSync(IExecutionContext executionContext) { try { PreInvoke(executionContext); base.InvokeSync(executionContext); } catch (Exception e) { CaptureCSMCallEventExceptionData(executionContext.RequestContext, e); throw; } finally { CSMCallEventMetricsCapture(executionContext); CSMUtilities.SerializetoJsonAndPostOverUDP(executionContext.RequestContext.CSMCallEvent); } }
/// <summary> /// Invokes the CSM handler and captures data for the CSM attempts. /// </summary> public override void InvokeSync(IExecutionContext executionContext) { try { PreInvoke(executionContext); base.InvokeSync(executionContext); } catch (AmazonServiceException e) { CaptureAmazonException(executionContext.RequestContext.CSMCallAttempt, e); throw; } catch (Exception e) { CaptureSDKExceptionMessage(executionContext.RequestContext.CSMCallAttempt, e); throw; } finally { CSMCallAttemptMetricsCapture(executionContext.RequestContext, executionContext.ResponseContext); CSMUtilities.SerializetoJsonAndPostOverUDP(executionContext.RequestContext.CSMCallAttempt); } }