batchHistogram is a mutable histogram that is updated in batches.
| 461 | // batchHistogram is a mutable histogram that is updated |
| 462 | // in batches. |
| 463 | type batchHistogram struct { |
| 464 | selfCollector |
| 465 | |
| 466 | // Static fields updated only once. |
| 467 | desc *Desc |
| 468 | hasSum bool |
| 469 | |
| 470 | // Because this histogram operates in batches, it just uses a |
| 471 | // single mutex for everything. updates are always serialized |
| 472 | // but Write calls may operate concurrently with updates. |
| 473 | // Contention between these two sources should be rare. |
| 474 | mu sync.Mutex |
| 475 | buckets []float64 // Inclusive lower bounds, like runtime/metrics. |
| 476 | counts []uint64 |
| 477 | sum float64 // Used if hasSum is true. |
| 478 | } |
| 479 | |
| 480 | // newBatchHistogram creates a new batch histogram value with the given |
| 481 | // Desc, buckets, and whether or not it has an exact sum available. |
nothing calls this directly
no outgoing calls
no test coverage detected