-
Notifications
You must be signed in to change notification settings - Fork 848
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 JMH support and improve MultiSpanExporter performance #678
Conversation
Codecov Report
@@ Coverage Diff @@
## master #678 +/- ##
===========================================
- Coverage 78.61% 78.51% -0.1%
- Complexity 777 779 +2
===========================================
Files 101 101
Lines 2777 2788 +11
Branches 268 270 +2
===========================================
+ Hits 2183 2189 +6
- Misses 492 494 +2
- Partials 102 105 +3
Continue to review full report at Codecov.
|
benchmark.gradle
Outdated
enabled benchmarksAvailable | ||
description 'Run benchmarks. Use property benchmarkFilter to set benchmark filtering regex.' | ||
group 'Verification' | ||
classpath = sourceSets.benchmark.runtimeClasspath |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think jmh works by default with jmh directory not benchmark, am I wrong?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure there is a 'default' directory. I opted for benchmark in similar fashion to 'test' which describes the purpose of the code in the sourceset, but not the test framework (junit, testng, ...).
No problem to change if there is a preference for jmh.
Working on getting the CLA signed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If jmh
is the default, then that's the way I would go, as well.
@sfriberg can you please sign the CLA and respond to the comment(s)? |
@sfriberg any update on the CLA? |
Got some issues with my CNCF account so have emailed them to see if it can be resolved so I can sign the CLA |
I signed it |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is excellent. I'd love to get this merged, as I would like to start writing some benchmarks for various bits of the system ASAP.
Before we merge this, can you rebase off of master and try running the benchmark? I think the SpanData creation in here will probably fail due to some changes in that class between when you wrote it and now. |
Fix to work with latest master
@jkwatson Thanks, yes had to do a minor change to make it work Added some comments in the script about how to use it as well so I think it should be in a good state to merge now. |
This PR adds support for building benchmarks as part of opentelemetry using JMH. Simply add
benchmarks/java/
folder under source and your benchmark and an artifact withsubproject-benchmark.jar
will be built with them. To run either usegradle benchmarkRun
orjava -jar XYZ-benchmark.jar
if you have copied/downloaded all artifacts to the same directory.I added a single microbenchmark and did an optimization to the MultiSpanExporter implementation to avoid allocation that happens when you are doing iteration of a unmodifiable collection, each entry returned by the iterator will be wrapped by an unmodifiable entry to ensure no modifications can be done.
If someone has a good idea on how to avoid the ErrorProne warnings when compiling the generated JMH code please let me know.