Converts http stats into struct to be sent back to the client.
()
| 270 | |
| 271 | // Converts http stats into struct to be sent back to the client. |
| 272 | func (st *HTTPStats) toServerHTTPStats() ServerHTTPStats { |
| 273 | serverStats := ServerHTTPStats{} |
| 274 | serverStats.S3RequestsIncoming = atomic.SwapUint64(&st.s3RequestsIncoming, 0) |
| 275 | serverStats.S3RequestsInQueue = atomic.LoadInt32(&st.s3RequestsInQueue) |
| 276 | serverStats.TotalS3RejectedAuth = atomic.LoadUint64(&st.rejectedRequestsAuth) |
| 277 | serverStats.TotalS3RejectedTime = atomic.LoadUint64(&st.rejectedRequestsTime) |
| 278 | serverStats.TotalS3RejectedHeader = atomic.LoadUint64(&st.rejectedRequestsHeader) |
| 279 | serverStats.TotalS3RejectedInvalid = atomic.LoadUint64(&st.rejectedRequestsInvalid) |
| 280 | serverStats.CurrentS3Requests = ServerHTTPAPIStats{ |
| 281 | APIStats: st.currentS3Requests.Load(), |
| 282 | } |
| 283 | serverStats.TotalS3Requests = ServerHTTPAPIStats{ |
| 284 | APIStats: st.totalS3Requests.Load(), |
| 285 | } |
| 286 | serverStats.TotalS3Errors = ServerHTTPAPIStats{ |
| 287 | APIStats: st.totalS3Errors.Load(), |
| 288 | } |
| 289 | serverStats.TotalS34xxErrors = ServerHTTPAPIStats{ |
| 290 | APIStats: st.totalS34xxErrors.Load(), |
| 291 | } |
| 292 | serverStats.TotalS35xxErrors = ServerHTTPAPIStats{ |
| 293 | APIStats: st.totalS35xxErrors.Load(), |
| 294 | } |
| 295 | serverStats.TotalS3Canceled = ServerHTTPAPIStats{ |
| 296 | APIStats: st.totalS3Canceled.Load(), |
| 297 | } |
| 298 | return serverStats |
| 299 | } |
| 300 | |
| 301 | // Update statistics from http request and response data |
| 302 | func (st *HTTPStats) updateStats(api string, r *http.Request, w *xhttp.ResponseRecorder) { |
no test coverage detected