Ejemplo n.º 1
0
        public async Task AddRequestInfoAsync(IRequestInfo request, IRequestDetail detail)
        {
            if (Options.EnableDefer)
            {
                _deferFlushCollection.Push(request, detail);
            }
            else
            {
                await Client.IndexAsync <RequestInfo>(request as RequestInfo, x => x.Index(GetIndexName <RequestInfo>()));

                await Client.IndexAsync <RequestDetail>(detail as RequestDetail, x => x.Index(GetIndexName <RequestDetail>()));
            }
        }
Ejemplo n.º 2
0
        public async Task AddRequestInfoAsync(IRequestInfo request)
        {
            if (Options.EnableDefer)
            {
                _deferFlushCollection.Push(request);
            }
            else
            {
                request.Id = MD5_16(Guid.NewGuid().ToString());

                var res = await Client.IndexAsync <RequestInfo>(request as RequestInfo, x => x.Index(GetIndexName <RequestInfo>())).ConfigureAwait(false);
            }
        }
Ejemplo n.º 3
0
 public async Task AddRequestInfoAsync(IRequestInfo request)
 {
     if (Options.EnableDefer)
     {
         _deferFlushCollection.Push(request);
     }
     else
     {
         await LoggingSqlOperation(async connection =>
         {
             await connection.ExecuteAsync("INSERT INTO `RequestInfo`(`Node`, `Route`, `Url`, `Method`, `Milliseconds`, `StatusCode`, `IP`, `CreateTime`) VALUES (@Node, @Route, @Url, @Method, @Milliseconds, @StatusCode, @IP, @CreateTime)", request).ConfigureAwait(false);
         }, "请求数据保存失败").ConfigureAwait(false);
     }
 }
Ejemplo n.º 4
0
 public async Task AddRequestInfoAsync(IRequestInfo request)
 {
     if (_options.EnableDefer)
     {
         _deferFlushCollection.Push(request);
     }
     else
     {
         await LoggingSqlOperation(async connection =>
         {
             await connection.ExecuteAsync("INSERT INTO [RequestInfo] (Node,Route,Url,Method,Milliseconds,StatusCode,IP,CreateTime)  VALUES (@Node, @Route, @Url, @Method, @Milliseconds, @StatusCode, @IP, @CreateTime)", request).ConfigureAwait(false);
         }, "请求数据保存失败").ConfigureAwait(false);
     }
 }
Ejemplo n.º 5
0
        public async Task AddRequestInfoAsync(IRequestInfo request, IRequestDetail detail)
        {
            if (_options.EnableDefer)
            {
                _deferFlushCollection.Push(request, detail);
            }
            else
            {
                await LoggingSqlOperation(async connection =>
                {
                    await connection.ExecuteAsync("INSERT INTO [RequestInfo] (Id,ParentId,Node,Route,Url,RequestType,Method,Milliseconds,StatusCode,IP,Port,LocalIP,LocalPort,CreateTime)  VALUES (@Id,@ParentId,@Node, @Route, @Url,@RequestType, @Method, @Milliseconds, @StatusCode, @IP,@Port,@LocalIP,@LocalPort,@CreateTime)", request).ConfigureAwait(false);

                    await connection.ExecuteAsync("INSERT INTO [RequestDetail] (Id,RequestId,Scheme,QueryString,Header,Cookie,RequestBody,ResponseBody,ErrorMessage,ErrorStack,CreateTime)  VALUES (@Id,@RequestId,@Scheme,@QueryString,@Header,@Cookie,@RequestBody,@ResponseBody,@ErrorMessage,@ErrorStack,@CreateTime)", detail).ConfigureAwait(false);
                }, "请求数据保存失败").ConfigureAwait(false);
            }
        }
Ejemplo n.º 6
0
        public async Task AddRequestInfoAsync(IRequestInfo request, IRequestDetail detail)
        {
            if (Options.EnableDefer)
            {
                _deferFlushCollection.Push(request, detail);
            }
            else
            {
                await LoggingSqlOperation(async connection =>
                {
                    await connection.ExecuteAsync("INSERT INTO `RequestInfo` (`Id`,`ParentId`,`Node`, `Route`, `Url`, `RequestType`, `Method`, `Milliseconds`, `StatusCode`, `IP`,`Port`,`LocalIP`,`LocalPort`,`CreateTime`) VALUES (@Id,@ParentId, @Node, @Route, @Url,@RequestType, @Method, @Milliseconds, @StatusCode, @IP,@Port,@LocalIP,@LocalPort, @CreateTime)", request).ConfigureAwait(false);

                    await connection.ExecuteAsync("INSERT INTO `RequestDetail` (`Id`,`RequestId`,`Scheme`,`QueryString`,`Header`,`Cookie`,`RequestBody`,`ResponseBody`,`ErrorMessage`,`ErrorStack`,`CreateTime`)  VALUES (@Id,@RequestId,@Scheme,@QueryString,@Header,@Cookie,@RequestBody,@ResponseBody,@ErrorMessage,@ErrorStack,@CreateTime)", detail).ConfigureAwait(false);
                }, "请求数据保存失败").ConfigureAwait(false);
            }
        }
Ejemplo n.º 7
0
        public async Task AddRequestInfoAsync(IRequestInfo request)
        {
            if (_options.EnableDefer)
            {
                _deferFlushCollection.Push(request);
            }
            else
            {
                await LoggingSqlOperation(async connection =>
                {
                    string sql = $@"Insert Into RequestInfo Values (request_seq_id.nextval,'{request.Node}','{request.Route}','{request.Url}','{request.Method}',{request.Milliseconds},{request.StatusCode},'{request.IP}', 
                 to_date('{request.CreateTime.ToString("yyyy-MM-dd HH:mm:ss")}','yyyy-mm-dd hh24:mi:ss'))";

                    await connection.ExecuteAsync(sql).ConfigureAwait(false);
                }, "请求数据保存失败").ConfigureAwait(false);
            }
        }
Ejemplo n.º 8
0
        public async Task AddRequestInfoAsync(IRequestInfo request, IRequestDetail detail)
        {
            if (_options.EnableDefer)
            {
                _deferFlushCollection.Push(request, detail);
            }
            else
            {
                await LoggingSqlOperation(async connection =>
                {
                    string requestSql = $@"Insert Into RequestInfo Values ('{request.Id}','{request.Node}','{request.Route}','{request.Url}','{request.Method}',{request.Milliseconds},{request.StatusCode},'{request.IP}',to_date('{request.CreateTime.ToString("yyyy-MM-dd HH:mm:ss")}','yyyy-mm-dd hh24:mi:ss'))";

                    await connection.ExecuteAsync(requestSql).ConfigureAwait(false);

                    string detailSql = $@"Insert Into RequestDetail Values ('{detail.Id}','{detail.RequestId}','{detail.Scheme}','{detail.QueryString}','{detail.Header}','{detail.Cookie}','{detail.RequestBody}','{detail.ResponseBody}','{detail.ErrorMessage}','{detail.ErrorStack}',to_date('{detail.CreateTime.ToString("yyyy-MM-dd HH:mm:ss")}','yyyy-mm-dd hh24:mi:ss'))  ";

                    await connection.ExecuteAsync(detailSql).ConfigureAwait(false);
                }, "请求数据保存失败").ConfigureAwait(false);
            }
        }
Ejemplo n.º 9
0
        public async Task AddRequestInfoAsync(IRequestInfo request, IRequestDetail detail)
        {
            detail = CutRequestDetail(detail);

            if (_options.EnableDefer)
            {
                _deferFlushCollection.Push(request, detail);
            }
            else
            {
                await LoggingSqlOperation(async _ =>
                {
                    string requestSql = $@"Insert Into RequestInfo  Values (:Id,:ParentId, :Node, :Route, :Url,:RequestType,:Method, :Milliseconds, :StatusCode, :IP,:Port,:LocalIP,:LocalPort,:CreateTime) ";

                    await _.ExecuteAsync(requestSql, request);

                    string detailSql = $@"Insert Into RequestDetail Values  (:Id,:RequestId,:Scheme,:QueryString,:Header,:Cookie,:RequestBody,:ResponseBody,:ErrorMessage,:ErrorStack,:CreateTime)  ";

                    await _.ExecuteAsync(detailSql, detail);
                }, "请求数据保存失败");
            }
        }
Ejemplo n.º 10
0
 public void Write(IRequestInfo requestInfo, IRequestDetail requestDetail)
 {
     _deferFlushCollection.Push(requestInfo as HttpReports.Collector.Grpc.RequestInfo, requestDetail as HttpReports.Collector.Grpc.RequestDetail);
 }