100 public void Add(QueryStats stats)
102 Interlocked.Exchange(ref _readOps, _readOps + stats.ReadOps);
103 Interlocked.Exchange(ref _computeOps, _computeOps + stats.ComputeOps);
104 Interlocked.Exchange(ref _writeOps, _writeOps + stats.WriteOps);
105 Interlocked.Exchange(ref _queryTimeMs, _queryTimeMs + stats.QueryTimeMs);
106 Interlocked.Exchange(ref _contentionRetries, _contentionRetries + stats.ContentionRetries);
107 Interlocked.Exchange(ref _storageBytesRead, _storageBytesRead + stats.StorageBytesRead);
108 Interlocked.Exchange(ref _storageBytesWrite, _storageBytesWrite + stats.StorageBytesWrite);
110 stats.RateLimitsHit?.ForEach(limitHit =>
114 case RateLimitReadOps:
115 Interlocked.Increment(ref _rateLimitedComputeQueryCount);
117 case RateLimitComputeOps:
118 Interlocked.Increment(ref _rateLimitedComputeQueryCount);
120 case RateLimitWriteOps:
121 Interlocked.Increment(ref _rateLimitedWriteQueryCount);
126 Interlocked.Increment(ref _queryCount);
135 ComputeOps = _computeOps,
136 WriteOps = _writeOps,
137 QueryTimeMs = _queryTimeMs,
138 ContentionRetries = _contentionRetries,
139 StorageBytesRead = _storageBytesRead,
140 StorageBytesWrite = _storageBytesWrite,
141 QueryCount = _queryCount,
142 RateLimitedReadQueryCount = _rateLimitedReadQueryCount,
143 RateLimitedComputeQueryCount = _rateLimitedComputeQueryCount,
144 RateLimitedWriteQueryCount = _rateLimitedWriteQueryCount
151 var beforeReset =
new Stats
153 ReadOps = Interlocked.Exchange(ref _readOps, 0),
154 ComputeOps = Interlocked.Exchange(ref _computeOps, 0),
155 WriteOps = Interlocked.Exchange(ref _writeOps, 0),
156 QueryTimeMs = Interlocked.Exchange(ref _queryTimeMs, 0),
157 ContentionRetries = Interlocked.Exchange(ref _contentionRetries, 0),
158 StorageBytesRead = Interlocked.Exchange(ref _storageBytesRead, 0),
159 StorageBytesWrite = Interlocked.Exchange(ref _storageBytesWrite, 0),
160 QueryCount = Interlocked.Exchange(ref _queryCount, 0),
161 RateLimitedReadQueryCount = Interlocked.Exchange(ref _rateLimitedReadQueryCount, 0),
162 RateLimitedComputeQueryCount = Interlocked.Exchange(ref _rateLimitedComputeQueryCount, 0),
163 RateLimitedWriteQueryCount = Interlocked.Exchange(ref _rateLimitedWriteQueryCount, 0)