-
Notifications
You must be signed in to change notification settings - Fork 27
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
DataGenerator readability improvements #1103
DataGenerator readability improvements #1103
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1103 +/- ##
============================================
+ Coverage 80.66% 80.67% +0.01%
- Complexity 2892 2906 +14
============================================
Files 383 384 +1
Lines 14359 14358 -1
Branches 989 989
============================================
+ Hits 11582 11584 +2
+ Misses 2183 2181 -2
+ Partials 594 593 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
eeff3be
to
b26db3c
Compare
@@ -6,7 +6,7 @@ appender.console.type = Console | |||
appender.console.name = Console | |||
appender.console.target = SYSTEM_OUT | |||
appender.console.layout.type = PatternLayout | |||
appender.console.layout.pattern = %m%n | |||
appender.console.layout.pattern = %d{yyyy-MM-dd HH:mm:ss,SSS}{UTC} %p %c{1.} [%t] %m%n |
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.
Keeping thread identifiers is critical for multi-threaded code like this. It's necessary to correlate log lines together.
|
||
var docIdCounter = new AtomicInteger(0); | ||
var allDocs = workload.createDocs(options.totalDocs) | ||
.map(doc -> new DocumentReindexer.BulkDocSection(indexName + "_ " + docIdCounter.incrementAndGet(), doc.toString())) | ||
.map(doc -> { |
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 would have liked to have used peek() here, but I didn't want to have to lose the sonarqube check for the whole file.
} | ||
} | ||
).log(); | ||
return new DocumentReindexer.BulkDocSection(indexName + "_" + docIdCounter.incrementAndGet(), doc.toString()); |
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.
notice that "_ " has been replaced with just "_"
b26db3c
to
32e6139
Compare
…the structure of what's being cons'ed together is much more immediately clear. Fixed a bug in the docId having a space in it (I presume that was unintentional) Signed-off-by: Greg Schohn <greg.schohn@gmail.com>
32e6139
to
9078313
Compare
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.
The indenting around the ObjectNode construction is easier to read, thanks for making that change.
GEONAMES(Geonames::new), | ||
HTTP_LOGS(HttpLogs::new), | ||
NESTED(Nested::new), | ||
NYC_TAXIS(NycTaxis::new); |
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.
Readme needs to be updated with these changed names, even if we parsed the enum case insensitively the underscore in NYC_TAXIS
breaks the existing documentation. Good news, the help output is automatically updated.
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.
thx - done
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.
Easier to read now - thanks Greg!
Signed-off-by: Greg Schohn <greg.schohn@gmail.com>
Description
Rewrite the workload classes to use a fluent style w/ mixins so that the structure of what's being cons'ed together is much more immediately clear. Case in point, making the conversion took hours because 1) there weren't unit tests on the generator itself and 2) the one test that was there didn't have suitable logging - requests weren't printed out (which is probably why there what looked to be a bug in the docIds).
This also maintains the previous status-quo of the codebase in how to eschew static imports and shows how to favor mixins and for DSL-like (DSL-lite) applications.
Issues Resolved
Same sonar cleanup as this PR, which was merged before this one was opened for review.
Testing
gradle testing
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.