Skip to content

feat: utility function to persist critical error#178

Merged
adarsh0728 merged 7 commits intomainfrom
error-util
Apr 7, 2025
Merged

feat: utility function to persist critical error#178
adarsh0728 merged 7 commits intomainfrom
error-util

Conversation

@adarsh0728
Copy link
Copy Markdown
Member

Signed-off-by: adarsh0728 <gooneriitk@gmail.com>
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 3, 2025

Codecov Report

Attention: Patch coverage is 67.50000% with 13 lines in your changes missing coverage. Please review.

Please upload report for BASE (main@8389e17). Learn more about missing BASE report.

Files with missing lines Patch % Lines
...numaproj/numaflow/errors/PersistCriticalError.java 67.50% 9 Missing and 4 partials ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main     #178   +/-   ##
=======================================
  Coverage        ?   59.98%           
  Complexity      ?      467           
=======================================
  Files           ?      151           
  Lines           ?     3354           
  Branches        ?      204           
=======================================
  Hits            ?     2012           
  Misses          ?     1204           
  Partials        ?      138           

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@adarsh0728 adarsh0728 requested review from KeranYang and yhl25 April 3, 2025 06:41

errorCode = (errorCode == null || errorCode.isEmpty()) ? INTERNAL_ERROR : errorCode;
long timestamp = Instant.now().getEpochSecond();
String errorEntry = String.format("{\"container\":\"%s\",\"timestamp\":\"%d\",\"code\":\"%s\",\"message\":\"%s\",\"details\":\"%s\"}",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can we use a type?

Signed-off-by: adarsh0728 <gooneriitk@gmail.com>
Signed-off-by: adarsh0728 <gooneriitk@gmail.com>
@adarsh0728
Copy link
Copy Markdown
Member Author

Testing:

Ran multiple threads and invoked PersistCriticalError method

[pool-3-thread-1] INFO io.numaproj.numaflow.errors.PersistCriticalError - ErrorEntry object created: io.numaproj.numaflow.errors.PersistCriticalError$ErrorEntry@5f47290a
[pool-3-thread-1] INFO io.numaproj.numaflow.errors.PersistCriticalError - ErrorEntry JSON: {"container":"transformer","timestamp":1743772205,"code":"500","message":"Critical Error","details":"A critical error occurred during processing."}
[pool-5-thread-4] INFO io.numaproj.numaflow.examples.sourcetransformer.eventtimefilter.EventTimeFilterFunction - IllegalStateException caught as expected: Persist critical error function has already been executed.
[pool-6-thread-3] INFO io.numaproj.numaflow.examples.sourcetransformer.eventtimefilter.EventTimeFilterFunction - IllegalStateException caught as expected: Persist critical error function has already been executed.
[pool-4-thread-3] INFO io.numaproj.numaflow.examples.sourcetransformer.eventtimefilter.EventTimeFilterFunction - IllegalStateException caught as expected: Persist critical error function has already been executed.
[pool-6-thread-2] INFO io.numaproj.numaflow.examples.sourcetransformer.eventtimefilter.EventTimeFilterFunction - IllegalStateException caught as expected: Persist critical error function has already been executed.

Only one file saved in the directory:

root@simple-mono-vertex-mv-0:/var/numaflow/runtime/application-errors/transformer# ls
1743772205-udf.json
root@simple-mono-vertex-mv-0:/var/numaflow/runtime/application-errors/transformer# cat 1743772205-udf.json 
{"container":"transformer","timestamp":1743772205,"code":"500","message":"Critical Error","details":"A critical error occurred during processing."}root@simple-mono-vertex-mv-0:/var/numaflow/runtime/application-errors/transformer# 

Signed-off-by: adarsh0728 <gooneriitk@gmail.com>
Signed-off-by: adarsh0728 <gooneriitk@gmail.com>
/**
* Private static class representing an error entry.
*/
private static class ErrorEntry {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
private static class ErrorEntry {
private static class RuntimeErrorEntry {

Signed-off-by: adarsh0728 <gooneriitk@gmail.com>
@adarsh0728 adarsh0728 merged commit a884673 into main Apr 7, 2025
5 checks passed
@adarsh0728 adarsh0728 deleted the error-util branch April 7, 2025 06:04
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.

2 participants