-
Notifications
You must be signed in to change notification settings - Fork 15
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
Conversation
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.
2cf0a25
to
4544eb0
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.
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.
filters/src/main/java/io/camunda/zeebe/process/test/filters/logger/RecordStreamLogger.java
Outdated
Show resolved
Hide resolved
filters/src/main/java/io/camunda/zeebe/process/test/filters/logger/RecordStreamLogger.java
Outdated
Show resolved
Hide resolved
extension/src/main/java/io/camunda/zeebe/process/test/extension/ZeebeProcessTestExtension.java
Outdated
Show resolved
Hide resolved
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.
@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 🙇 |
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.
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 😆
filters/src/main/java/io/camunda/zeebe/process/test/filters/logger/RecordStreamLogger.java
Outdated
Show resolved
Hide resolved
filters/src/main/java/io/camunda/zeebe/process/test/filters/logger/RecordStreamLogger.java
Show resolved
Hide resolved
filters/src/main/java/io/camunda/zeebe/process/test/filters/logger/RecordStreamLogger.java
Outdated
Show resolved
Hide resolved
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.
f87d84a
to
954bc99
Compare
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.
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:
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:
Testing:
Documentation: