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

Distinguish between retrialable and non-retriable errors when publishing messages with pubsub #5136

Closed
artursouza opened this issue Sep 6, 2022 · 7 comments · Fixed by #5159
Assignees
Labels
good first issue Good for newcomers kind/bug Something isn't working P2 pinned
Milestone

Comments

@artursouza
Copy link
Member

In what area(s)?

/area runtime

/area operator

/area placement

/area docs

/area test-and-release

What version of Dapr?

1.8.x

Expected Behavior

Should log WARN instead.

Actual Behavior

Logs ERROR because it returns an error to the upstream call stack:

return errors.Errorf("RETRY status returned from app while processing pub/sub event %v", cloudEvent[pubsub.IDField])

return errors.Errorf("unknown status returned from app while processing pub/sub event %v: %v", cloudEvent[pubsub.IDField], appResponse.Status)

return errors.Errorf("retriable error returned from app while processing pub/sub event %v, topic: %v, body: %s. status code returned: %v", cloudEvent[pubsub.IDField], cloudEvent[pubsub.TopicField], body, statusCode)

Code should handle retriable vs non-retriable error as different return objects

Steps to Reproduce the Problem

Release Note

RELEASE NOTE:

@artursouza artursouza added kind/bug Something isn't working P2 good first issue Good for newcomers pinned labels Sep 6, 2022
@artursouza artursouza added this to the v1.9 milestone Sep 6, 2022
@yaron2
Copy link
Member

yaron2 commented Sep 6, 2022

Maybe this should be Debug logs?

@SpikeWong
Copy link
Contributor

@artursouza I want to make sure I understand correctly that for retriable errors we don't need to log Error, but just log Warn or log Debug, while for non-retriable errors we need to log Error.
The log behavior is done by upstream call, so we need different types of error to distinguish retriable from non-retriable error, is that right?

@artursouza
Copy link
Member Author

Maybe this should be Debug logs?

I think it should log warning since users have asked for this behavior before.

@artursouza
Copy link
Member Author

@artursouza I want to make sure I understand correctly that for retriable errors we don't need to log Error, but just log Warn or log Debug, while for non-retriable errors we need to log Error.

The log behavior is done by upstream call, so we need different types of error to distinguish retriable from non-retriable error, is that right?

Correct. It probably means that the function should return two error objects, one for retriable error and one for non-retriable.

@SpikeWong
Copy link
Contributor

/assign

@SpikeWong
Copy link
Contributor

@artursouza The act of catching these errors and logging them happens in the pubsub component(e.g. rabbitmq) of the components-contrib repo, right?
So if I want to change the log level I also need to change the components-contrib repository?

@artursouza
Copy link
Member Author

@artursouza The act of catching these errors and logging them happens in the pubsub component(e.g. rabbitmq) of the components-contrib repo, right? So if I want to change the log level I also need to change the components-contrib repository?

Not necessarily. This code is handled here:

err = policy(func(ctx context.Context) error {

I think we can move the log logic there as well and we will have two error objects to differentiate between non-retriable and retriable errors. The change on each component to understand the difference can be a follow up.

@artursouza artursouza modified the milestones: v1.9, v1.10 Sep 29, 2022
@yaron2 yaron2 modified the milestones: v1.10, v1.11 Feb 1, 2023
@artursouza artursouza changed the title Sidecar logs error on RETRY pubsub result from App Distinguish between retrialable and non-retriable errors when publishing messages with pubsub Jun 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers kind/bug Something isn't working P2 pinned
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants