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

Enhancing debug information for HttpDataSource transfers #4280

Closed
zub4t opened this issue Jun 18, 2024 · 11 comments · Fixed by #4303
Closed

Enhancing debug information for HttpDataSource transfers #4280

zub4t opened this issue Jun 18, 2024 · 11 comments · Fixed by #4303
Assignees

Comments

@zub4t
Copy link
Contributor

zub4t commented Jun 18, 2024

Feature Request

Currently, when the openPartStream method on HttpDataSource is called, if the transfer fails the reason for this failure is not logged. Providing information about why a transfer fails or when it succeeds would improve the maintenance of the connector.

Which Areas Would Be Affected?

transfer

Why Is the Feature Desired?

When multiple users are using the same connector, there is sometimes a necessity to reply to support tickets. If there is no logging of the reasons for transfer failures, it becomes difficult to provide effective support services.

Solution Proposal

 if (response.isSuccessful()) {
             ...
            monitor.debug("transfer successes");
            } else {
                try {
                    monitor.debug("transfer fails with status code: "+response.code() );
                    if (NOT_AUTHORIZED == response.code() || FORBIDDEN == response.code()) {
                        return StreamResult.notAuthorized();
                    } else if (NOT_FOUND == response.code()) {
                        return StreamResult.notFound();
                    } else {
                        return error(format("Received code transferring HTTP data: %s - %s.", response.code(), response.message()));
                    }
                   ...
@github-actions github-actions bot added the triage all new issues awaiting classification label Jun 18, 2024
Copy link

Thanks for your contribution 🔥 We will take a look asap 🚀

@jimmarino
Copy link
Contributor

jimmarino commented Jun 18, 2024

Stacktraces and message payloads for requests against internal systems should not be forwarded for security reasons. This can be handled by logging the request failure at the backend and correlating it.

@zub4t
Copy link
Contributor Author

zub4t commented Jun 18, 2024

@jimmarino Is it not possible to record the request failure in the EDC without forwarding the response to the caller? If we can achieve this, it would enhance troubleshooting, especially in scenarios where access to the backend system logs is unavailable.

For example, could the message format("Received code transferring HTTP data: %s - %s.", response.code(), response.message()); also be logged using the monitor?

@jimmarino
Copy link
Contributor

No, we explicitly do not want to do that due to concerns about logging potentially private data.

@gerbigf
Copy link

gerbigf commented Jun 19, 2024

Hey @jimmarino - fully understood. Could we at least add a log statement that tells us if the request to the backend was (un-)successful and with which status code? I know that the partner receives this information, but it helps us to trace the error down ourselves and have a complete log trace. Neither do we as the EDC Ops team or our users always have access to the logs of the backend API, nor does our partner always provide us with the full response.

Knowing if it was e.g. a 404 or 403 already would help, even without getting the complete error message.

@jimmarino
Copy link
Contributor

jimmarino commented Jun 19, 2024 via email

@gerbigf
Copy link

gerbigf commented Jun 19, 2024

I'm not sure if that works as intended - in our scenario neither there's a log message of any type, nor a proper response message to the partner EDC We're working on reproducing the issue and will open a separate issue if we can reproduce.

@jimmarino
Copy link
Contributor

jimmarino commented Jun 19, 2024 via email

@ndr-brt
Copy link
Member

ndr-brt commented Jun 20, 2024

the error detail with the status code should be stored in the DataFlow object when it transition to failed.
The problem here is that it stores the failure.getFailureDetail(), that could be empty if there's no message in the failure.
That seems to be the case according to the code posted in the issue:

if (NOT_AUTHORIZED == response.code() || FORBIDDEN == response.code()) {
                        return StreamResult.notAuthorized();
                    } else if (NOT_FOUND == response.code()) {
                        return StreamResult.notFound();
                    } else {

I see different solutions:

  • avoid "empty message" failures
  • make the transitionToFailed accept a Failure as argument and put as errorDetail a string representation of the Failure, that, for the StreamFailure case will contain the reason as well
  • make the DataPlaneManager to appent the reason to the message that will be stored in the database.

I'd say that the second one is my favurite: passing the Failure object around instead of having String will make the code more expressive (and less primitive-obsessed).

@jimmarino
Copy link
Contributor

the error detail with the status code should be stored in the DataFlow object when it transition to failed. The problem here is that it stores the failure.getFailureDetail(), that could be empty if there's no message in the failure. That seems to be the case according to the code posted in the issue:

if (NOT_AUTHORIZED == response.code() || FORBIDDEN == response.code()) {
                        return StreamResult.notAuthorized();
                    } else if (NOT_FOUND == response.code()) {
                        return StreamResult.notFound();
                    } else {

I see different solutions:

  • avoid "empty message" failures
  • make the transitionToFailed accept a Failure as argument and put as errorDetail a string representation of the Failure, that, for the StreamFailure case will contain the reason as well
  • make the DataPlaneManager to appent the reason to the message that will be stored in the database.

I'd say that the second one is my favurite: passing the Failure object around instead of having String will make the code more expressive (and less primitive-obsessed).

I agree the second option is better. We just need to be careful we do not log the message body or propagate it back to the client.

@zub4t
Copy link
Contributor Author

zub4t commented Jun 20, 2024

Good 😊
@jimmarino or @ndr-brt can you assign this issue to me?

@ndr-brt ndr-brt removed the triage all new issues awaiting classification label Jun 20, 2024
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 a pull request may close this issue.

4 participants