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

Allow setting request timeout #277

Open
FRosner opened this issue Feb 19, 2024 · 3 comments · May be fixed by #280
Open

Allow setting request timeout #277

FRosner opened this issue Feb 19, 2024 · 3 comments · May be fixed by #280

Comments

@FRosner
Copy link

FRosner commented Feb 19, 2024

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.

@FRosner
Copy link
Author

FRosner commented Feb 26, 2024

@4n4nd let me know what you think about this. I can try to submit a PR, but I just wanted to confirm with you if you agree with the issue / proposed solution.

@4n4nd
Copy link
Owner

4n4nd commented Feb 26, 2024

yeah that seems like a reasonable solution. Could you please create a PR?

FRosner added a commit to FRosner/prometheus-api-client-python that referenced this issue Feb 28, 2024
FRosner added a commit to FRosner/prometheus-api-client-python that referenced this issue Feb 28, 2024
@FRosner FRosner linked a pull request Feb 28, 2024 that will close this issue
@FRosner
Copy link
Author

FRosner commented Feb 28, 2024

Could you please create a PR?

#280

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants