Skip to content

Commit 7457c73

Browse files
committed
add comment about concurrent collection
1 parent 800a39e commit 7457c73

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
@@ -43,6 +43,12 @@ func (r *storage) Collect(dest *[]Exemplar) {
4343
*dest = reset(*dest, len(r.measurements), len(r.measurements))
4444
var n int
4545
for _, val := range r.measurements {
46+
// For performance reasons, this iterates over measurements
47+
// concurrently with new measurements being written. This means we do
48+
// not get a point-in-time snapshot of the state of the reservoir.
49+
// This means that for sequential Offer calls, a later Offer call may
50+
// be collected and an earlier call not collected if they are written
51+
// to different indicies.
4652
loaded := val.Load()
4753
if loaded == nil {
4854
continue

0 commit comments

Comments
 (0)