[receiver/googlecloudpubsubpush] Add implementation#44101
Conversation
…' into googlecloudpubsub-implementation
# Conflicts: # receiver/googlecloudpubsubpushreceiver/go.mod # receiver/googlecloudpubsubpushreceiver/go.sum
axw
left a comment
There was a problem hiding this comment.
Looks good overall, mostly quibbles
| // Pub/Sub retries everything that is not a valid response. A valid response | ||
| // has the following HTTP codes: [102, 200, 201, 202, 204]. | ||
| // You can verify this in the official documentation. For this, refer to | ||
| // https://cloud.google.com/pubsub/docs/push. | ||
| // | ||
| // This becomes an issue for permanent errors, because it means that if we | ||
| // don't return one of those codes, Pub/Sub will keep retrying. This would | ||
| // only stop retrying if: | ||
| // 1. We add event arc advanced after Pub/Sub. For this, we need to set the | ||
| // correct HTTP code for permanent/transient errors. You can refer to | ||
| // the official documentation for this. See: | ||
| // https://docs.cloud.google.com/eventarc/advanced/docs/retry-events#transient | ||
| // 2. Or return 2xx for permanent errors. Since this is not semantically correct, | ||
| // we are holding on this option. |
There was a problem hiding this comment.
@axw Here is the comment. What do you think of it? Is it time for us to return 2xx for permanent errors? I feel torn on it. It doesn't seem right, but at the same time, it is wrong to retry permanent errors
There was a problem hiding this comment.
Thanks, that's very clear. It seems there's no perfect solution here, so we could consider adding configuration to control the response code in the case of permanent errors. Maybe in a followup?
There was a problem hiding this comment.
Yes, that's fine by me
| // 2. Or return 2xx for permanent errors. Since this is not semantically correct, | ||
| // we are holding on this option. | ||
| logger.Error("failed to handle Pub/Sub push request", zap.Error(err)) | ||
| code := http.StatusInternalServerError |
There was a problem hiding this comment.
I think we should still use different status codes depending on the gRPC error codes for retryable errors, but we can do that in a followup.
Description
Add implementation to the googlecloudpubsubpush receiver.
Testing
Unit tests added.
Documentation
README already up to date.