MCPcopy
hub / github.com/prometheus/client_golang / swapBufs

Method swapBufs

prometheus/summary.go:409–418  ·  view source on GitHub ↗

swapBufs needs mtx AND bufMtx locked, coldBuf must be empty.

(now time.Time)

Source from the content-addressed store, hash-verified

407
408// swapBufs needs mtx AND bufMtx locked, coldBuf must be empty.
409func (s *summary) swapBufs(now time.Time) {
410 if len(s.coldBuf) != 0 {
411 panic("coldBuf is not empty")
412 }
413 s.hotBuf, s.coldBuf = s.coldBuf, s.hotBuf
414 // hotBuf is now empty and gets new expiration set.
415 for now.After(s.hotBufExpTime) {
416 s.hotBufExpTime = s.hotBufExpTime.Add(s.streamDuration)
417 }
418}
419
420type summaryCounts struct {
421 // sumBits contains the bits of the float64 representing the sum of all

Callers 2

WriteMethod · 0.95
asyncFlushMethod · 0.95

Calls 1

AddMethod · 0.65

Tested by

no test coverage detected