Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add AllLabels Batcher and install default Barcher for Counters #831

Merged
merged 2 commits into from
Feb 20, 2020

Conversation

bogdandrutu
Copy link
Member

No description provided.

@bogdandrutu bogdandrutu force-pushed the newbounds branch 2 times, most recently from f912b33 to 68c76f6 Compare February 7, 2020 18:32
@bogdandrutu bogdandrutu force-pushed the newbounds branch 2 times, most recently from a11d370 to fc4fcf1 Compare February 7, 2020 22:15
@codecov-io
Copy link

codecov-io commented Feb 7, 2020

Codecov Report

Merging #831 into master will increase coverage by 0.38%.
The diff coverage is 84.9%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #831      +/-   ##
============================================
+ Coverage      82.3%   82.68%   +0.38%     
- Complexity      839      845       +6     
============================================
  Files           111      111              
  Lines          2882     2934      +52     
  Branches        253      257       +4     
============================================
+ Hits           2372     2426      +54     
+ Misses          399      397       -2     
  Partials        111      111
Impacted Files Coverage Δ Complexity Δ
.../io/opentelemetry/sdk/metrics/data/MetricData.java 100% <ø> (ø) 2 <0> (ø) ⬇️
.../io/opentelemetry/sdk/metrics/AbstractMeasure.java 88% <0%> (-3.67%) 9 <0> (ø)
...io/opentelemetry/sdk/metrics/AbstractObserver.java 84.61% <0%> (-3.39%) 9 <0> (ø)
.../io/opentelemetry/sdk/metrics/AbstractCounter.java 94.73% <100%> (+3.07%) 13 <4> (+4) ⬆️
...o/opentelemetry/sdk/metrics/view/Aggregations.java 52.63% <25%> (-3.26%) 2 <0> (ø)
...in/java/io/opentelemetry/sdk/metrics/Batchers.java 91.89% <90.62%> (-8.11%) 2 <1> (+1)
...elemetry/sdk/trace/export/BatchSpansProcessor.java 89.65% <0%> (-1.73%) 7% <0%> (ø)
...try/sdk/metrics/AbstractInstrumentWithBinding.java 76% <0%> (+8%) 6% <0%> (+1%) ⬆️
...io/opentelemetry/sdk/metrics/DoubleCounterSdk.java 95.83% <0%> (+20.83%) 5% <0%> (ø) ⬇️
...a/io/opentelemetry/sdk/metrics/LongCounterSdk.java 95.83% <0%> (+20.83%) 5% <0%> (ø) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b84bf39...22bd1e7. Read the comment docs.

@bogdandrutu bogdandrutu force-pushed the newbounds branch 4 times, most recently from 33e845d to d93ffa3 Compare February 14, 2020 01:36
private final Resource resource;
private final InstrumentationLibraryInfo instrumentationLibraryInfo;
private final AggregatorFactory aggregatorFactory;
private final Map<Map<String, String>, Aggregator> aggregatorMap;
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we can use LabelSetSdk as the key to this map, since it has a well-defined equals/hashcode via autovalue.

Signed-off-by: Bogdan Cristian Drutu <[email protected]>
@bogdandrutu bogdandrutu changed the title Bound registry work in progress Add AllLabels Batcher and install default Barcher for Counters Feb 19, 2020
@bogdandrutu
Copy link
Member Author

@jkwatson PTAL, after this PR is merged we have Counters working :)

public final List<MetricData> completeCollectionCycle() {
List<Point> points = new ArrayList<>(aggregatorMap.size());
long epochNanos = clock.now();
for (Map.Entry<Map<String, String>, Aggregator> entry : aggregatorMap.entrySet()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think there's a risk of a ConcurrentModificationException happening during this iteration, since the map can be mutated during this method call.

Copy link
Member Author

Choose a reason for hiding this comment

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

It is guaranteed that only one thread calls into a Batcher collection at a time by the collectLock in the AbstractInstrumentWithBindings

Copy link
Contributor

Choose a reason for hiding this comment

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

please add a comment in here to that effect. thanks!

Copy link
Contributor

@jkwatson jkwatson left a comment

Choose a reason for hiding this comment

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

A comment about thread safety, and this should be good to start playing with!

@bogdandrutu
Copy link
Member Author

@jkwatson done

@bogdandrutu bogdandrutu merged commit 9aa6d1e into open-telemetry:master Feb 20, 2020
@bogdandrutu
Copy link
Member Author

Please feel free to file issues or PRs against the code merged here.

@bogdandrutu bogdandrutu deleted the newbounds branch February 20, 2020 00:24
DotSpy pushed a commit to DotSpy/opentelemetry-java that referenced this pull request Feb 21, 2020
…telemetry#831)

* Bound registry work in progress

Signed-off-by: Bogdan Cristian Drutu <[email protected]>

* Add comment about protecting a collection cycle by a lock

Signed-off-by: Bogdan Cristian Drutu <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants