Description
Problem Statement
I ran into an issue where an HTTP request to Grok failed with a pretty mysterious error message, which got logged in Sentry. I tried to follow up with their support, but they wanted to know the value of the X-Request-Id header to debug it further. It would be nice if Sentry tracked this information. (Note: I am using the OpenAI client, but I am actually connecting to X.ai.)
Solution Brainstorm
It would be nice if the OpenAIIntegration tracked the value of this header.
Idea 1
I only really care about X-Request-Id in the case where I am getting an error back. If I understand correctly, all APIStatusException exceptions that are thrown include a APIStatusException.request_id
value, which is the X-Request-ID header. citation.
So, one solution is that when OpenAIIntegration is executing a Completion.create request, and it throws an exception, Sentry reads the request_id
attribute of that exception, and attaches it to the span where it tracking the completion request.
Idea 2
I also see that there is a request through httpx and httplib to this endpoint. Unfortunately, I don't see a way to customize HttpxIntegration or StdlibIntegration to track the value of particular HTTP headers. It would be nice if I could ask HttpxIntegration to track the value of a particular header in an HTTP response whenever it sees it. Then, I could look at the breadcrumbs in the trace to see what the request ID was.
This would be an alternative approach which would also give me what I want.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status