prometheus-api-client-python
prometheus-api-client-python copied to clipboard
Allow setting request timeout
Is your feature request related to a problem? Please describe.
We see requests getting stuck forever which blocks our app. The fix is to set a request timeout, which is not possible with the current APIs.
Describe the solution you'd like
I'd like the ability to provide a global timeout when creating the client, as well as the ability to override the timeout for each request.
response = self._session.get(
"{0}/api/v1/query".format(self._url),
params={**{"query": query}, **params},
verify=self._ssl_verification,
timeout=self._timeout,
)
Describe alternatives you've considered
I don't think there are good alternatives. You gotta be defensive towards requests getting stuck.