/// <summary> /// Store a request metric into the HTTP context for later use /// </summary> /// <param name="context"></param> /// <param name="metricTracker"></param> internal static void Store(this HttpContext context, RequestMetric metricTracker) { string key = HttpContextMetricPrefix + metricTracker.UniqueId; context.Items[key] = metricTracker; }
/// <summary> /// Store a request metric into the HTTP context for later use /// </summary> /// <param name="context"></param> /// <param name="metricTracker"></param> internal static void Store(this HttpRequestMessage context, RequestMetric metricTracker) { context.Properties[HttpContextMetricPrefix] = metricTracker; }
IEnumerable <RequestMetric> CreateTestRequestMetrics() { var metrics = new RequestMetric[] { new RequestMetric { EndpointHttpVerb = "GET", EndpointPath = "/Resource1", Errors = 0, IdleTime = 15, Latency = 125 }, new RequestMetric { EndpointHttpVerb = "GET", EndpointPath = "/Resource2", Errors = 0, IdleTime = 5, Latency = 20 }, new RequestMetric { EndpointHttpVerb = "GET", EndpointPath = "/Resource1", Errors = 1, IdleTime = 0, Latency = 5 }, new RequestMetric { EndpointHttpVerb = "GET", EndpointPath = "/Resource1", Errors = 0, IdleTime = 15, Latency = 100 }, new RequestMetric { EndpointHttpVerb = "POST", EndpointPath = "/Resource1", Errors = 0, IdleTime = 15, Latency = 250 }, new RequestMetric { EndpointHttpVerb = "POST", EndpointPath = "/Resource1", Errors = 0, IdleTime = 20, Latency = 125 }, new RequestMetric { EndpointHttpVerb = "GET", EndpointPath = "/Resource1", Errors = 1, IdleTime = 0, Latency = 5 } }; return(metrics); }