Client middleware logging #664
Unanswered
daraghscopey
asked this question in
Q&A
Replies: 2 comments 2 replies
-
|
I'm interested in this as well |
Beta Was this translation helpful? Give feedback.
0 replies
-
|
I've used global middleware to achieve this. (And a macro to reset the global middleware after the request). You have to be careful with streams though; if you consume the stream response in the middleware it won't be consumed in the generator loop. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I want to be able to add middleware to all requests and responses so that I can log to the database for analytics, cost management, and observability reasons. I can't seem to see an easy way to hook into the Prism Http client request/responses?
I see this trait is used with each provider, but it seems to be deliberately creating a clean
PendingRequestwithout any middleware or exceptions:Within the providers, eg. OpenAI, there isn't a way to hook into anything from what I can see.
How are others handling being able to log all requests and responses?
Beta Was this translation helpful? Give feedback.
All reactions