Skip to content

Conversation

@jmacd
Copy link
Contributor

@jmacd jmacd commented Jan 4, 2021

The target Aggregator of a SynchronizedMove (for synchronous instruments, typically ValueRecorder) has a reference to a slice that is effectively discarded. This PR avoids that by recycling the allocated slice when possible.

@jmacd jmacd added the area:metrics Part of OpenTelemetry Metrics label Jan 4, 2021
@codecov
Copy link

codecov bot commented Jan 4, 2021

Codecov Report

Merging #1435 (2381491) into master (c29c6fd) will decrease coverage by 0.2%.
The diff coverage is 100.0%.

Impacted file tree graph

@@           Coverage Diff            @@
##           master   #1435     +/-   ##
========================================
- Coverage    79.2%   78.9%   -0.3%     
========================================
  Files         128     128             
  Lines        6642    6672     +30     
========================================
+ Hits         5263    5269      +6     
- Misses       1124    1148     +24     
  Partials      255     255             
Impacted Files Coverage Δ
sdk/metric/aggregator/histogram/histogram.go 96.2% <100.0%> (+0.4%) ⬆️
sdk/export/metric/exportkind_string.go 57.1% <0.0%> (-42.9%) ⬇️
label/type_string.go 7.1% <0.0%> (-26.2%) ⬇️
metric/instrumentkind_string.go 10.0% <0.0%> (-23.4%) ⬇️
metric/number/kind_string.go 16.6% <0.0%> (-16.7%) ⬇️

o.clearState()
}

c.lock.Lock()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the SynchronizedMove function comment still true? "Since no locks are taken, there is a chance that the independent Sum, Count and Bucket Count are not consistent with each other."

@jmacd
Copy link
Contributor Author

jmacd commented Jan 5, 2021

@bogdandrutu Please review.

Co-authored-by: Sam Xie <[email protected]>
boundaries []float64
kind number.Kind
state state
state *state
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

State has only 40B, not sure you need to use pointer here.

@Aneurysm9 Aneurysm9 merged commit 207587b into open-telemetry:master Jan 14, 2021
@jmacd jmacd deleted the jmacd/swaphisto branch June 18, 2021 07:06
@pellared pellared added this to the untracked milestone Nov 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:metrics Part of OpenTelemetry Metrics

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants