Skip to content

Commit 7b79e43

Browse files
committed
add comment about concurrent collection
1 parent c91490b commit 7b79e43

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

sdk/metric/exemplar/storage.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,12 @@ func (r *storage) Collect(dest *[]Exemplar) {
4040
*dest = reset(*dest, len(r.measurements), len(r.measurements))
4141
var n int
4242
for _, val := range r.measurements {
43+
// For performance reasons, this iterates over measurements
44+
// concurrently with new measurements being written. This means we do
45+
// not get a point-in-time snapshot of the state of the reservoir.
46+
// This means that for sequential Offer calls, a later Offer call may
47+
// be collected and an earlier call not collected if they are written
48+
// to different indices.
4349
loaded := val.Load()
4450
if loaded == nil {
4551
continue

0 commit comments

Comments
 (0)