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

Improve failure logging #207

Merged
merged 10 commits into from
Feb 25, 2022
Merged

Improve failure logging #207

merged 10 commits into from
Feb 25, 2022

Conversation

remcowesterhoud
Copy link
Contributor

@remcowesterhoud remcowesterhoud commented Feb 24, 2022

Description

It's important users are able to debug their process properly if a test fails. To enable this we should provide them with proper logging upon a failure.
In the past we used the CompactRecordLogger from zeebe-test-util for this. This solution had 2 problems:

  1. zeebe-test-util is not bound to Java 8. This means users running on Java 8 cannot use it.
  2. The CompactRecordLogger provides too much information for the targeted users of this project.

To solve these problems I have introduced a new logger. This will also log all records of the stream, but only logs the most important fields that users need for debugging their processes. At the moment it is a guess which fields these are. Once we receive user feedback we can easily modify the logging for the specific records that are not clear enough.

Related issues

closes #188
closes #175

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

It's important users are able to debug their process properly if a test fails. To enable this we should provide them with proper logging upon a failure.
In the past we used the CompactRecordLogger from zeebe-test-util for this. This solution had 2 problems:
1. zeebe-test-util is not bound to Java 8. This means users running on Java 8 cannot use it.
2. The CompactRecordLogger provides too much information for the targeted users of this project.

To solve these problems I have introduced a new logger. This will also log all records of the stream, but only logs the most important fields that users need for debugging their processes. At the moment it is a guess which fields these are. Once we receive user feedback we can easily modify the logging for the specific records that are not clear enough.
We shouldn't use System.out logging, but instead use a proper logger.
@github-actions
Copy link

github-actions bot commented Feb 24, 2022

Unit Test Results

124 files  124 suites   5m 55s ⏱️
321 tests 321 ✔️ 0 💤 0
772 runs  772 ✔️ 0 💤 0

Results for commit 5fe8c0f.

♻️ This comment has been updated with latest results.

Copy link
Member

@korthout korthout left a comment

Choose a reason for hiding this comment

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

I really like these changes @remcowesterhoud Great job! 👍

❌ I have a few improvements we should consider before merging. Mainly, I want to avoid confusing users unnecessarily.

We always call #logGenericRecord for any record. If we haven't defined the value type in the constructor we would call #logGenericRecord a second time, thus logging the record twice. If we haven't defined the value type we shouldn't log any extra information.
Adding new records to this project is something that will easily be forgotten. By adding a test we can guarantee that all Records have been accounted for.
We logged all incidents. This also included all incidents that were resolved. If the user resolved an incident then it's safe to assume they are aware of the it, and we don't need to log it anymore.
With this change we only log the incidents that have not yet been resolved.
Some record types, value types and intents did not fit in the dedicated space reserved for it.
The largest RecordType (COMMAND_REJECTION) is 17 characters. This fits in the 20 character range.
The largest ValueType (MESSAGE_START_EVENT_SUBSCRIPTION) is 32 characters. This fits in the 35 character range.
The larges Intent (CREATE_WITH_AWAITING_RESULT) is 27 characters. This fits in the 30 character range.
@remcowesterhoud
Copy link
Contributor Author

@korthout Thanks a lot for all the reviews you're doing for me! 🏆

You raised some valid points here and I've made the necessary changes. Please have another look 🙇

Copy link
Member

@korthout korthout left a comment

Choose a reason for hiding this comment

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

Nice work @remcowesterhoud 🦖

🔑 I have one last change request, but I already want to provide my approval so this isn't blocked by me anymore. So here's a key to represent me handing this over 😆

The RecordStreamLogger also took care of printing any incidents that occurred. It's fitting to put this responsibility into a separate logger.
With this change we general text surrounding the logging has been improved. This is done to give the users some more detailed information about what could be wrong and where to look to fix it.
Renamed value loggers from log*Record to log*RecordValue. This makes it more clear that we are logging the value of the record in these functions.
@remcowesterhoud remcowesterhoud merged commit 1b660b3 into main Feb 25, 2022
@remcowesterhoud remcowesterhoud deleted the 188-failure_logging branch February 25, 2022 09:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants