Пример #1
0
        // 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();
            });
        }
Пример #2
0
        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);
        }
Пример #3
0
 public void ResponseHandle()
 {
     ApplicationMetricsHandle(EnumRequestResponse.Response);
     TimerMetrics.StopRequest();
     RequestMetricsHandle();
 }