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

Log PROCESS_INSTANCE_CREATION records with start instructions #434

Merged
merged 9 commits into from
Jul 12, 2022

Conversation

korthout
Copy link
Member

@korthout korthout commented Jul 5, 2022

Description

Expands the RecordLogger to also log the start instructions of PROCESS_INSTANCE_CREATION records.

Also adds easier testing to the RecordStreamLoggerTest.

Related issues

closes #411

Definition of Done

Not all items need to be done depending on the issue and the pull request.

Code changes:

  • The changes are backwards compatibility with previous versions
  • If it fixes a bug then PRs are created to backport the fix

Testing:

  • There are unit/integration tests that verify all acceptance criterias of the issue
  • New tests are written to ensure backwards compatibility with further versions
  • The behavior is tested manually

Documentation:

  • Javadoc has been written
  • The documentation is updated

@korthout korthout requested a review from remcowesterhoud July 5, 2022 15:20
@korthout korthout marked this pull request as ready for review July 5, 2022 15:20
@github-actions
Copy link

github-actions bot commented Jul 5, 2022

Unit Test Results

  47 files    47 suites   1m 49s ⏱️
111 tests 111 ✔️ 0 💤 0
356 runs  356 ✔️ 0 💤 0

Results for commit 723fe0e.

♻️ This comment has been updated with latest results.

Copy link
Contributor

@remcowesterhoud remcowesterhoud left a comment

Choose a reason for hiding this comment

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

Thanks for the change Nico! Overall it looks good but there are some excessive commas being logged which shouldn’t be there.

Please also have a look at the ci, it is failing because the dependency you’ve introduced is not used.

@korthout korthout force-pushed the korthout-411-log-start-instructions branch from 90c4e04 to ef24358 Compare July 7, 2022 14:58
korthout added 9 commits July 7, 2022 17:09
The logRecords method could never be used to test because it only has
side effects (printing to log), but internally it works by building up a
String with a StringBuilder. By extracting this string building into a
separate method, its easy to test the produced String that will be
logged.
The logStartInstructions is a direct copy of the CompactRecordLogger
implementation in Zeebe, with 1 exception:
- removed the spaces around the resulting string to fit better into the
  result
Uses the ImmutableRecord builder to create a record, stringify the
record for logging and then asserts the resulting string.

I've chosen to test 2 cases: no instructions, 2 instructions. 1
instruction would be an untested edge case, but it doesn't really matter
IMO.
By using a parameterized test, its easier to expand the tests. Simply
add another Argument with a record and what the log should contain.
These commas look strange in the printed logs. They shouldn't be
necessary
@korthout korthout force-pushed the korthout-411-log-start-instructions branch from ccee8d4 to 723fe0e Compare July 7, 2022 15:09
@korthout
Copy link
Member Author

korthout commented Jul 7, 2022

@remcowesterhoud, I've made the requested change.

I feel like the error logging is a very important part of ZPT, and we should probably focus on improving the test coverage of this logging. That's why I've gone back and tried to improve the tests that I originally added. It should now be easier to expand them for other records.

I've also applied the comma fix for Job record logging, but I haven't changed it for all records. I don't want to mess too much with it without having tests in place. We should consider making that a bigger issue

@korthout korthout requested a review from remcowesterhoud July 7, 2022 15:11
@korthout
Copy link
Member Author

korthout commented Jul 8, 2022

@remcowesterhoud Would be cool to get this merged before creating 8.1.0-alpha3

Copy link
Contributor

@remcowesterhoud remcowesterhoud left a comment

Choose a reason for hiding this comment

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

Sorry for taking so long to review, thanks for the fix @korthout 🏆

@remcowesterhoud remcowesterhoud merged commit 140ff89 into main Jul 12, 2022
@remcowesterhoud remcowesterhoud deleted the korthout-411-log-start-instructions branch July 12, 2022 08:57
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.

Extend record logger with start instructions
2 participants