-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Conversation
python/kserve/kserve/model.py
Outdated
@@ -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} " |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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>
9b7ea29
to
46f085e
Compare
/rerun-workflow Huggingface Docker Publisher |
@sivanantha321 can you please take a look? |
/rerun-all |
@grandbora Can you help sign-off the commit ? |
Signed-off-by: grandbora <grandbora@fb.com>
d81a065
to
5be18fb
Compare
Signed the commit. Thank you @sivanantha321 |
logger.error( | ||
f"Could not send a request to predictor at url {predict_url} " | ||
f"for {request_id=} " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
f"for {request_id=} " | |
f"for {request_id} " |
There was a problem hiding this comment.
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?
kserve/python/kserve/kserve/model.py
Line 161 in 9c6a6b8
request_id = headers.get("x-request-id", "N.A.") if headers else "N.A." |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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>
/lgtm |
[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 |
* 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>
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
Special notes for your reviewer:
Checklist:
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.