// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env) { app.UseMiddleware <MetricsMiddleware>(); if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } else { app.UseHsts(); } app.UseHttpsRedirection(); app.UseMvc(); app.Use(async(context, next) => { TimerMetrics.StopRequest(); await next.Invoke(); }); }
private void RequestMetrics() { TimerMetrics.StopRequest(); TimerMetrics.StopResponse(); var dto = new RequestMetricsDTO { Client = _client, Application = _application, Environment = _environment, UserCall = _owinContext.Request.Headers.Get("UserId"), Endpoint = _owinContext.Request.Path.Value, Method = _owinContext.Request.Method, StatusCode = _owinContext.Response.StatusCode, // RequestTime = TimerMetrics.RequestTime, ResponseTime = TimerMetrics.ResponseTime, }; SendRabbitMQQueue("RequestMetrics", dto); }
public void ResponseHandle() { ApplicationMetricsHandle(EnumRequestResponse.Response); TimerMetrics.StopRequest(); RequestMetricsHandle(); }