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

Add request id context to logging and error responses #312

Merged
merged 2 commits into from
May 5, 2019

Conversation

Brutus5000
Copy link
Member

Each http request creates a request id (either from nginx or random uuid).
This request id is then applied to every log message during processing until the http request is finished, then it is cleaned up.
Furthermore the request id is added to each error message the API sends back to the client. So the user has an id that he can give on error reports to check the related logs.

@Brutus5000 Brutus5000 merged commit 06048cf into develop May 5, 2019

import java.util.ArrayList;

@Data
public class ErrorResponse {
private final String requestId;
Copy link
Member

Choose a reason for hiding this comment

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

why dont we leave it as response header?

Copy link
Member Author

Choose a reason for hiding this comment

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

That's probably my personal preference. As part of the payload I have it immediately available e.g. when deserializing the message with a Spring RestTemplate

@Brutus5000 Brutus5000 deleted the feature/request-logging branch September 5, 2019 19:51
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