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

[JSON-API] Fix logging of internal server errors #12822

Merged
merged 1 commit into from
Feb 11, 2022

Conversation

realvictorprm
Copy link
Contributor

@realvictorprm realvictorprm commented Feb 8, 2022

Fixes #12887

Changes we did in the past caused that internal server errors were not logged anymore. With these changes they will be logged again which is quite helpful for understanding what is going on if smth goes wrong 😂

changelog_begin

  • [HTTP-JSON] Internal server errors are now properly logged again

changelog_end

Pull Request Checklist

  • Read and understand the contribution guidelines
  • Include appropriate tests
  • Set a descriptive title and thorough description
  • Add a reference to the issue this PR will solve, if appropriate
  • Include changelog additions in one or more commit message bodies between the CHANGELOG_BEGIN and CHANGELOG_END tags
  • Normal production system change, include purpose of change in description
  • If you mean to change the status of a component, please make sure you keep the Component Status page up to date.

NOTE: CI is not automatically run on non-members pull-requests for security
reasons. The reviewer will have to comment with /AzurePipelines run to
trigger the build.

@stefanobaghino-da
Copy link
Contributor

stefanobaghino-da commented Feb 8, 2022

@realvictorprm Can you create a ticket for this, please? It would be quite important to make sure we can keep track of the version when this bug was first introduced so that we can answer to support requests about it and possibly think about backports if and when relevant. Please refer to that in the changelog as well (saying that "server errors are now properly logged again" without saying since when this was an issue could be a problem for users). Thanks.

@stefanobaghino-da
Copy link
Contributor

@S11001001 can you review this, please?

Comment on lines 90 to 94
)(implicit metrics: Metrics, jsonWriter: JsonWriter[A]): Route =
)(implicit
lc: LoggingContextOf[InstanceUUID with RequestID],
metrics: Metrics,
jsonWriter: JsonWriter[A],
): Route =
responseToRoute(httpResponse(res))
private def toRoute(res: => Future[Error \/ SearchResult[Error \/ JsValue]]): Route =
private def toRoute(res: => Future[Error \/ SearchResult[Error \/ JsValue]])(implicit
lc: LoggingContextOf[InstanceUUID with RequestID]
): Route =
Copy link
Contributor

Choose a reason for hiding this comment

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

This will definitely conflict with main.

changelog_begin

- [HTTP-JSON] Internal server errors are now properly logged again

changelog_end
@realvictorprm realvictorprm force-pushed the http-json/fix-internal-server-error-logging branch from 9fffc33 to f36f7ef Compare February 9, 2022 11:08
@realvictorprm
Copy link
Contributor Author

@realvictorprm Can you create a ticket for this, please? It would be quite important to make sure we can keep track of the version when this bug was first introduced so that we can answer to support requests about it and possibly think about backports if and when relevant. Please refer to that in the changelog as well (saying that "server errors are now properly logged again" without saying since when this was an issue could be a problem for users). Thanks.

I don't know yet when this started to happened and need to investigate myself first. However I do remember my past idea that it is probably linked to when we refactored our code to not expose internal server errors anymore via the response.

@stefanobaghino-da
Copy link
Contributor

stefanobaghino-da commented Feb 9, 2022

I don't know yet when this started to happened and need to investigate myself first. However I do remember my past idea that it is probably linked to when we refactored our code to not expose internal server errors anymore via the response.

I understand, please do the research. Checking only major versions is fine, so bisecting manually should take a short time.

@realvictorprm
Copy link
Contributor Author

OK I think the "bug" was introduced with #11184

@realvictorprm
Copy link
Contributor Author

I think this solution probably isn't perfect because if I understand the code correctly, errors from futures and sources will be logged twice with these changes.

@realvictorprm
Copy link
Contributor Author

OK I think best is if we merge this first and make a follow up PR where I fix the duplicate logging (again, did smth like that already in the past 😂 ).

@realvictorprm realvictorprm merged commit 9e77b8d into main Feb 11, 2022
@realvictorprm realvictorprm deleted the http-json/fix-internal-server-error-logging branch February 11, 2022 12: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.

[BUG] JSON API doesn't log all kind of internal server errors
3 participants