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 headers to predictor exception logging #3658

Merged
merged 3 commits into from
May 3, 2024

Conversation

grandbora
Copy link
Contributor

What this PR does / why we need it:
Adds the headers to exception logging, which includes request and trace ids. This maybe useful in debugging issues.

Type of changes

  • New feature (non-breaking change which adds functionality)

Special notes for your reviewer:

  1. Please confirm that if this PR changes any image versions, then that's the sole change this PR makes.

Checklist:

  • Have you added unit/e2e tests that prove your fix is effective or that this feature works?
  • Has code been commented, particularly in hard-to-understand areas?
  • Have you made corresponding changes to the documentation?

Re-running failed tests

  • /rerun-all - rerun all failed workflows.
  • /rerun-workflow <workflow name> - rerun a specific failed workflow. Only one workflow name can be specified. Multiple /rerun-workflow commands are allowed per comment.

@@ -347,6 +347,7 @@ async def _http_predict(
except Exception as exc:
logger.error(
f"Could not send a request to predictor at url {predict_url} "
f"with headers {predict_headers} "
Copy link
Contributor Author

@grandbora grandbora Apr 30, 2024

Choose a reason for hiding this comment

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

No information other than Content-Type, x-request-id and x-b3-traceid exist in these headers. This should be safe to log.

Copy link
Contributor

Choose a reason for hiding this comment

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

I am not sure if it really is all the headers that are added, however, for the Id ones, it might be good to log a small portion of it, if it is big enough to split in smaller pieces.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is actually all the headers added. The UI may not show it, it is defined a few lines above. Nevertheless, this code can change. To be more future proof I pulled the request id from the headers and logged only that.

Signed-off-by: grandbora <grandbora@fb.com>
@spolti
Copy link
Contributor

spolti commented May 2, 2024

/rerun-workflow Huggingface Docker Publisher

@spolti
Copy link
Contributor

spolti commented May 2, 2024

@sivanantha321 can you please take a look?

@sivanantha321
Copy link
Member

/rerun-all

@sivanantha321
Copy link
Member

@grandbora Can you help sign-off the commit ?

Signed-off-by: grandbora <grandbora@fb.com>
@grandbora
Copy link
Contributor Author

Signed the commit. Thank you @sivanantha321

logger.error(
f"Could not send a request to predictor at url {predict_url} "
f"for {request_id=} "
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
f"for {request_id=} "
f"for {request_id} "

Copy link
Member

Choose a reason for hiding this comment

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

Let's be consistent with predictive models here?

request_id = headers.get("x-request-id", "N.A.") if headers else "N.A."

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated the default value to N.A.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@yuzisun the equals above was intentional (https://docs.python.org/3/whatsnew/3.8.html#f-strings-support-for-self-documenting-expressions-and-debugging). Is there a reason not to use it? We are at python 3.9 as far as i see.

Copy link
Member

@yuzisun yuzisun May 3, 2024

Choose a reason for hiding this comment

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

Ah ok ye we deprecated 3.8

Signed-off-by: grandbora <grandbora@fb.com>
@grandbora grandbora requested a review from yuzisun May 3, 2024 19:23
@yuzisun
Copy link
Member

yuzisun commented May 3, 2024

/lgtm
/approve

Copy link

oss-prow-bot bot commented May 3, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: grandbora, yuzisun

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@oss-prow-bot oss-prow-bot bot added the approved label May 3, 2024
@yuzisun yuzisun merged commit 0fb5696 into kserve:master May 3, 2024
57 of 58 checks passed
asd981256 pushed a commit to asd981256/kserve that referenced this pull request May 14, 2024
* Add headers to predictor exception logging

Signed-off-by: grandbora <grandbora@fb.com>

* Log request id only

Signed-off-by: grandbora <grandbora@fb.com>

* Update log

Signed-off-by: grandbora <grandbora@fb.com>

---------

Signed-off-by: grandbora <grandbora@fb.com>
Signed-off-by: asd981256 <asd981256@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants