-
Notifications
You must be signed in to change notification settings - Fork 85
[PLUGIN-1868] Error Management for Google Publisher #1524
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
[PLUGIN-1868] Error Management for Google Publisher #1524
Conversation
1a3d5fe to
764c443
Compare
| String error = String.format( | ||
| "Could not auto-create topic '%s' in project '%s'. " | ||
| + "Please ensure it is created before running the pipeline, " | ||
| + "or ensure that the service account has permission to create the topic.", | ||
| config.topic, projectId); | ||
| throw ErrorUtils.getProgramFailureException(new ErrorCategory(ErrorCategory.ErrorCategoryEnum.PLUGIN), | ||
| error, error, ErrorType.USER, false, e1); |
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.
ApiException should have much more details, like statusCode which can help in computing error type. Dependency should also be true.
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.
Updated with the status code and dependency
| String error = String.format("Error publishing records to PubSub: %s", e.getMessage()); | ||
| throw ErrorUtils.getProgramFailureException( | ||
| new ErrorCategory(ErrorCategory.ErrorCategoryEnum.PLUGIN), | ||
| error, error, ErrorType.USER, false, e); |
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.
can ExecutionException contain GoogleJsonResponseException or ApiException? Did we check the stacktrace?
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.
Updated and SS attached in the description.
764c443 to
0837503
Compare
| + "Status code: %d.", | ||
| config.topic, projectId, statusCode); | ||
| throw ErrorUtils.getProgramFailureException(new ErrorCategory(ErrorCategory.ErrorCategoryEnum.PLUGIN), | ||
| error, error, ErrorType.USER, true, e1); |
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.
Add errorCode, errorType and supportDocUrl to the exception.
This comment applies to the whole PR.
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.
done
0837503 to
d12ef2f
Compare
| String errorMessage = String.format("Failed to publish %s records: %s. For more details, see %s", | ||
| failures.get(), error.get(), GCPUtils.PUBSUB_SUPPORTED_DOC_URL); | ||
| throw ErrorUtils.getProgramFailureException(new ErrorCategory(ErrorCategory.ErrorCategoryEnum.PLUGIN), | ||
| errorMessage, errorMessage, ErrorType.USER, false, null, null, GCPUtils.PUBSUB_SUPPORTED_DOC_URL, null); |
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.
Do not add support doc when error is not from external client.
Why error type USER?
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.
Doc removed, changed user to unknown
| throw GCPErrorDetailsProviderUtil.getHttpResponseExceptionDetailsFromChain(e, errorReason, ErrorType.USER, | ||
| true, GCPUtils.PUBSUB_SUPPORTED_DOC_URL); |
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.
can ExecutionException contain GoogleJsonResponseException or ApiException? Did we check the stacktrace?
Why error type USER?
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 suggest we make this unknown, error type is correctly detected when using getHttpResponseExceptionDetailsFromChain using the http error codes, else it should be unknown.
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.
changed to UNKNOWN
d12ef2f to
ef5d48f
Compare
itsankit-google
left a comment
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.
why does the 3rd screenshot in PR description does not have errorCode in the response?
Didn't the stacktrace had GoogleJsonResponseException? If not then we should also handle ApiException in GcpErrorDetailsProviderUtil.
ef5d48f to
5de6a5d
Compare
Handled APiException in GcpErrorDetailsProviderUtil. Attached updated SS in the description . |
Did we check the stacktrace? This change will affect all GCP plugins. Can you please add the stacktrace and pipeline logs? |
ca2a4cf to
da97000
Compare
|
src/main/java/io/cdap/plugin/gcp/common/GCPErrorDetailsProviderUtil.java
Show resolved
Hide resolved
da97000 to
a4e67aa
Compare
| + "For more details, see %s", | ||
| config.topic, projectId, GCPUtils.PUBSUB_SUPPORTED_DOC_URL); | ||
| throw ErrorUtils.getProgramFailureException(new ErrorCategory(ErrorCategory.ErrorCategoryEnum.PLUGIN), | ||
| error, error, ErrorType.USER, true, ErrorCodeType.HTTP, String.valueOf(statusCode), |
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.
ErrorType.UNKNOWN by default
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.
DONE
a4e67aa to
925273a
Compare
src/main/java/io/cdap/plugin/gcp/common/GCPErrorDetailsProviderUtil.java
Show resolved
Hide resolved
925273a to
c7457f5
Compare
src/main/java/io/cdap/plugin/gcp/common/GCPErrorDetailsProviderUtil.java
Show resolved
Hide resolved
itsankit-google
left a comment
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.
Can you please also re-test somecases of GCS & BQ plugin to verify they are working as expected after these changes?
c7457f5 to
264f1c5
Compare
src/main/java/io/cdap/plugin/gcp/common/GCPErrorDetailsProviderUtil.java
Show resolved
Hide resolved
264f1c5 to
6d9a2e4
Compare
| if (t instanceof IllegalArgumentException) { | ||
| return getProgramFailureException((IllegalArgumentException) t, errorContext); | ||
| } | ||
| if (t instanceof IllegalStateException) { | ||
| return getProgramFailureException((IllegalStateException) t, errorContext); | ||
| } |
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.
these two checks can also go in later loop.
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.
done
5ab28c9 to
2570569
Compare
checkedn with GCS and BQ both. Working fine. |
2570569 to
6a78e55
Compare

Description
Error Management for Google Publisher Sink plugin exceptions
https://cdap.atlassian.net/browse/PLUGIN-1868
Code change
Modified GooglePublisher.java
Added GooglePublisherErrorDetailsProvider.java
Modified GCPUtils.java
Modified PubSubOutputFormat.java
Tests
Test Case - tested with valid and invalid scenarios
1. Success
2. Permission denied to create topic
Logs

3. Failed to publish records

BQ plugin after changes


GCS move plugin after changes

