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

http status codes not passed back to caller #408

Closed
mzizzi opened this issue Jun 16, 2019 · 7 comments
Closed

http status codes not passed back to caller #408

mzizzi opened this issue Jun 16, 2019 · 7 comments
Labels
kind/bug Bug related issue resource/api

Comments

@mzizzi
Copy link

mzizzi commented Jun 16, 2019

In some cases it's useful for the caller to know the underlying http status code returned by requests. As of now, status codes never make their way back to the caller. This makes it difficult to decide how to proceed after a failed request. Just about every error that the API could throw is wrapped in something like {'errors': [...]}. This is fine for some use cases but unless we know every possible message that might end up in that datastruct we'll have a hard time knowing exactly how to proceed.

There is the option to set datadog.api._mute = False which will cause exceptions to bubble up to the caller. But in this case, things like ApiError are too broad to take make decisions on. e.g. I may wish to never retry a failed request due to a 403 or 404 but I certainly want to retry a request with that has failed with a 429.

#378 is related in that it's asking for a little more detail on failed requests. Maybe we pass both status codes and relevant headers back to the caller?

@mzizzi mzizzi changed the title http status codes never visible to caller http status codes not passed back to caller Jun 16, 2019
@nmuesch
Copy link
Contributor

nmuesch commented Jun 25, 2019

Hey, we just merged in #412 which allows you to retrieve the full response object from the previous request. This way you can access the status_code as well as the response headers in whichever cases make sense. Going to close this issue as this will be out in the next release. Thanks for the report!

@nmuesch nmuesch closed this as completed Jun 25, 2019
@mzizzi
Copy link
Author

mzizzi commented Jun 25, 2019

I'd like to re-open this. The method of fetching the entire http response in #412 isn't sufficient for multi-threaded programs.

@nmuesch
Copy link
Contributor

nmuesch commented Jun 27, 2019

Posting an update here for completeness: we continued this discussion on the original PR. This was reimplemented in a more threadsafe way #414 that allows you to retrieve the full raw response object.

@nmuesch
Copy link
Contributor

nmuesch commented Jun 27, 2019

Reopening based on the note from #414

@nmuesch nmuesch reopened this Jun 27, 2019
@github-actions
Copy link

github-actions bot commented Jan 7, 2020

Thanks for your contribution!

This issue has been automatically marked as stale because it has not had activity in the last 30 days. Note that the issue will not be automatically closed, but this notification will remind us to investigate why there's been inactivity. Thank you for participating in the Datadog open source community.

If you would like this issue to remain open:

  1. Verify that you can still reproduce the issue in the latest version of this project.

  2. Comment that the issue is still reproducible and include updated details requested in the issue template.

@github-actions github-actions bot added the stale Stale - Bot reminder label Jan 7, 2020
@jirikuncar jirikuncar added kind/bug Bug related issue resource/api and removed stale Stale - Bot reminder labels Jan 22, 2020
@github-actions
Copy link

Thanks for your contribution!

This issue has been automatically marked as stale because it has not had activity in the last 30 days. Note that the issue will not be automatically closed, but this notification will remind us to investigate why there's been inactivity. Thank you for participating in the Datadog open source community.

If you would like this issue to remain open:

  1. Verify that you can still reproduce the issue in the latest version of this project.

  2. Comment that the issue is still reproducible and include updated details requested in the issue template.

@github-actions github-actions bot added the stale Stale - Bot reminder label Feb 22, 2020
@zippolyte zippolyte added stale/exempt Exempt from being marked as stale and removed stale Stale - Bot reminder labels Mar 3, 2020
@zippolyte
Copy link
Contributor

As discussed in #414, this is likely not something that we'll be able to do without and significant rework of the library while keeping backward compatibility.
However we are currently working on a new and fresh python library for interacting with Datadog's API that wouldn't have that issue. I can't share an exact ETA at the moment.

@zippolyte zippolyte removed the stale/exempt Exempt from being marked as stale label Mar 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Bug related issue resource/api
Projects
None yet
Development

No branches or pull requests

4 participants