Custom Metrics to AWS CloudWatch from ASP.NET Core

added by DotNetKicks
8/9/2019 2:39:29 AM

2 Kicks, 126 Views

I was playing around with AWS CloudWatch and was curious to send custom metrics from ASP.NET Core. Specifically the execution time of an HTTP request. I created a simple middleware that starts a StopWatch before calling the next middleware in the pipeline. When it returns, stop the StopWatch and send the data to CloudWatch.