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

3 changes/fixes around how tuples are output by the replayer. #513

Merged
merged 1 commit into from
Feb 20, 2024

Conversation

gregschohn
Copy link
Collaborator

Simplify and fix the json output of the 'tuples' that the replayer emits. No longer wrap the tuples within a log4j json record, just shoot it straight out, followed by a newline. Furthermore, the bodies often had many null values within them. That's been fixed by copying just the readable bytes rather than taking the whole byte array.

Description

  • Category Bug fix
  • Why these changes are required? Looking at the output was just about impossible
  • What is the old behavior before changes and new behavior after changes? Now users can run humanReadableLogs.py and look at the output that it dumps to readable-tuples.log. Users will also find that it is easier to read the tuple output even without that.

Issues Resolved

#511
https://opensearch.atlassian.net/browse/MIGRATIONS-1510

Testing

Updated unit tests. Ran the docker solution and a standalone replayer with an input stream.

Check List

  • New functionality includes testing
    • All tests pass, including unit test, integration test and doctest
  • New functionality has been documented
  • Commits are signed per the DCO using --signoff

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.

Copy the bytes into the tuple output rather than try to use the array (which could be very big and full of padded zeros).
Don't use a json layout for log4j output - that cases the tuples to be escaped. Instead, just output the json-coded contents + a newline.
Fix the humanReadables script to work with the above change.

Signed-off-by: Greg Schohn <[email protected]>
Copy link

codecov bot commented Feb 16, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (c253aa8) 76.71% compared to head (f6d7069) 76.93%.
Report is 2 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main     #513      +/-   ##
============================================
+ Coverage     76.71%   76.93%   +0.21%     
- Complexity     1385     1388       +3     
============================================
  Files           158      158              
  Lines          6086     6105      +19     
  Branches        532      532              
============================================
+ Hits           4669     4697      +28     
  Misses         1059     1059              
+ Partials        358      349       -9     
Flag Coverage Δ
unittests 76.93% <100.00%> (+0.21%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Collaborator

@lewijacn lewijacn left a comment

Choose a reason for hiding this comment

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

Very happy to see this fix

@@ -156,7 +156,7 @@ public void testOutputterForGet() throws IOException {
" \"Status-Code\": 200,\n" +
" \"Reason-Phrase\": \"OK\",\n" +
" \"response_time_ms\": 0,\n" +
" \"body\": \"SFRUUC8xLjEgMjAwIE9LDQpDb250ZW50LXRyYW5zZmVyLWVuY29kaW5nOiBjaHVua2VkDQpEYXRlOiBUaHUsIDA4IEp1biAyMDIzIDIzOjA2OjIzIEdNVA0KVHJhbnNmZXItZW5jb2Rpbmc6IGNodW5rZWQNCkNvbnRlbnQtdHlwZTogdGV4dC9wbGFpbg0KRnVudGltZTogY2hlY2tJdCENCg0KMWUNCkkgc2hvdWxkIGJlIGRlY3J5cHRlZCB0ZXN0ZXIhCg0KMA0KDQo=\",\n" +
" \"body\": \"SSBzaG91bGQgYmUgZGVjcnlwdGVkIHRlc3RlciEK\",\n" +
Copy link
Collaborator

Choose a reason for hiding this comment

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

I was hoping there was funny message encoded ◡̈

@@ -156,7 +156,7 @@ public void testOutputterForGet() throws IOException {
" \"Status-Code\": 200,\n" +
" \"Reason-Phrase\": \"OK\",\n" +
" \"response_time_ms\": 0,\n" +
" \"body\": \"SFRUUC8xLjEgMjAwIE9LDQpDb250ZW50LXRyYW5zZmVyLWVuY29kaW5nOiBjaHVua2VkDQpEYXRlOiBUaHUsIDA4IEp1biAyMDIzIDIzOjA2OjIzIEdNVA0KVHJhbnNmZXItZW5jb2Rpbmc6IGNodW5rZWQNCkNvbnRlbnQtdHlwZTogdGV4dC9wbGFpbg0KRnVudGltZTogY2hlY2tJdCENCg0KMWUNCkkgc2hvdWxkIGJlIGRlY3J5cHRlZCB0ZXN0ZXIhCg0KMA0KDQo=\",\n" +
" \"body\": \"SSBzaG91bGQgYmUgZGVjcnlwdGVkIHRlc3RlciEK\",\n" +
Copy link
Collaborator

Choose a reason for hiding this comment

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

I was hoping there was funny message encoded ◡̈

@sumobrian
Copy link
Collaborator

Was human readable script tested?

@gregschohn
Copy link
Collaborator Author

Yes, the script was tested against a simple run. There still aren't unit tests, so I'm not sure exactly what the behavior should be.

@gregschohn gregschohn merged commit 6a02317 into opensearch-project:main Feb 20, 2024
8 checks passed
@gregschohn gregschohn deleted the TupleOutputFix branch April 3, 2024 12:34
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.

3 participants