| 427 | } |
| 428 | |
| 429 | type noObjectivesSummary struct { |
| 430 | // countAndHotIdx enables lock-free writes with use of atomic updates. |
| 431 | // The most significant bit is the hot index [0 or 1] of the count field |
| 432 | // below. Observe calls update the hot one. All remaining bits count the |
| 433 | // number of Observe calls. Observe starts by incrementing this counter, |
| 434 | // and finish by incrementing the count field in the respective |
| 435 | // summaryCounts, as a marker for completion. |
| 436 | // |
| 437 | // Calls of the Write method (which are non-mutating reads from the |
| 438 | // perspective of the summary) swap the hot–cold under the writeMtx |
| 439 | // lock. A cooldown is awaited (while locked) by comparing the number of |
| 440 | // observations with the initiation count. Once they match, then the |
| 441 | // last observation on the now cool one has completed. All cool fields must |
| 442 | // be merged into the new hot before releasing writeMtx. |
| 443 | |
| 444 | // Fields with atomic access first! See alignment constraint: |
| 445 | // http://golang.org/pkg/sync/atomic/#pkg-note-BUG |
| 446 | countAndHotIdx uint64 |
| 447 | |
| 448 | selfCollector |
| 449 | desc *Desc |
| 450 | writeMtx sync.Mutex // Only used in the Write method. |
| 451 | |
| 452 | // Two counts, one is "hot" for lock-free observations, the other is |
| 453 | // "cold" for writing out a dto.Metric. It has to be an array of |
| 454 | // pointers to guarantee 64bit alignment of the histogramCounts, see |
| 455 | // http://golang.org/pkg/sync/atomic/#pkg-note-BUG. |
| 456 | counts [2]*summaryCounts |
| 457 | |
| 458 | labelPairs []*dto.LabelPair |
| 459 | |
| 460 | createdTs *timestamppb.Timestamp |
| 461 | } |
| 462 | |
| 463 | func (s *noObjectivesSummary) Desc() *Desc { |
| 464 | return s.desc |
nothing calls this directly
no outgoing calls
no test coverage detected