Exemple #1
0
        public async Task <int> GetRequestCountAsync(RequestCountFilterOption filterOption)
        {
            var sql = $"SELECT COUNT(1) FROM RequestInfo {BuildSqlFilter(filterOption)}";

            TraceLogSql(sql);

            return(await LoggingSqlOperation(async connection => await connection.QueryFirstOrDefaultAsync <int>(sql).ConfigureAwait(false)));
        }
Exemple #2
0
        public async Task <int> GetTimeoutResponeCountAsync(RequestCountFilterOption filterOption, int timeoutThreshold)
        {
            var where = BuildSqlFilter(filterOption);
            var sql = $"SELECT COUNT(1) FROM RequestInfo {(string.IsNullOrWhiteSpace(where) ? "WHERE" : where)} AND Milliseconds >= {timeoutThreshold}";

            TraceLogSql(sql);

            return(await LoggingSqlOperation(async connection => await connection.QueryFirstOrDefaultAsync <int>(sql).ConfigureAwait(false)));
        }
        public async Task <int> GetTimeoutResponeCountAsync(RequestCountFilterOption option, int timeoutThreshold)
        {
            var response = await Client.SearchAsync <RequestInfo>(x => x.Index(GetIndexName <RequestInfo>())
                                                                  .Query(d =>

                                                                         d.HasDateWhere(option.StartTime, option.EndTime) &&
                                                                         d.Terms(f => f.Field(e => e.Node).Terms(option.Service)) &&
                                                                         d.Terms(f => f.Field(e => e.StatusCode).Terms(option.StatusCodes)) &&
                                                                         d.Range(f => f.Field(e => e.Milliseconds).GreaterThanOrEquals(timeoutThreshold))

                                                                         ).Size(0));

            if (response != null && response.IsValid)
            {
                return(Convert.ToInt32(response.Total));
            }

            return(0);
        }
        public async Task <int> GetRequestCountAsync(RequestCountFilterOption option)
        {
            var response = await Client.SearchAsync <RequestInfo>(x => x.Index(GetIndexName <RequestInfo>())

                                                                  .Query(c =>

                                                                         c.HasDateWhere(option.StartTime, option.EndTime)

                                                                         && c.Terms(f => f.Field(e => e.StatusCode).Terms(option.StatusCodes))

                                                                         && c.Terms(f => f.Field(e => e.Node).Terms(option.Service.ToLowerInvariant()))

                                                                         ).Size(0));

            if (response != null && response.IsValid)
            {
                return(Convert.ToInt32(response.Total));
            }

            return(0);
        }
Exemple #5
0
 public Task <int> GetTimeoutResponeCountAsync(RequestCountFilterOption filterOption, int timeoutThreshold)
 {
     throw new NotImplementedException();
 }
Exemple #6
0
 public Task <int> GetRequestCountAsync(RequestCountFilterOption filterOption)
 {
     throw new NotImplementedException();
 }