Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upAllow mechanism for propagating internal errors from the storage #2571
Comments
This was referenced Apr 4, 2017
This comment has been minimized.
This comment has been minimized.
|
I think the storage layer should have no notion of any API using it (and thus of the API's error types) and should instead define its own error types that can be interpreted by users of the storage layer. These errors should probably live in a relatively non-implementation-specific package (maybe the existing |
This comment has been minimized.
This comment has been minimized.
|
Do we currently need to know anything more than "the storage reported an error"? |
This comment has been minimized.
This comment has been minimized.
|
@brian-brazil Yes, some errors are the user's fault, at least upon ingestion:
Cortex has a few more of those that are related to rate-limting/throttling. Currently they are all on the ingestion side, but there will also be query-related ones. |
This comment has been minimized.
This comment has been minimized.
|
(I guess the rate-limiting / throttling could be wrapped around everything though) |
This comment has been minimized.
This comment has been minimized.
|
I'm not particularly worries about the ingestion side, as we implement it end-to-end in Cortex. Its really only important for the query side, where the promql library sits in the middle. I'm happy to make a "InternalStorageError" type in the storage package that gets interpreted as a 500 by the query layer if you like? |
tomwilkie
referenced this issue
Apr 4, 2017
Merged
Propagate promql.ErrStorage on the query path, so the user gets 500s where appropriate. #384
This comment has been minimized.
This comment has been minimized.
|
Hm yeah, if we're happy with just treating any error from the storage as an internal error for now, then this can indeed all be done in the API handling code. |
This comment has been minimized.
This comment has been minimized.
|
AFAICT the query.Exec method can still return non-storage related errors (hence the original error handling), so a special error type is still needed to differentiate storage error (which should be 500s) from non-storage errors (which are currently 422s). |
This comment has been minimized.
This comment has been minimized.
|
Ah yes, |
juliusv
closed this
in
#2572
Apr 6, 2017
This comment has been minimized.
This comment has been minimized.
lock
bot
commented
Mar 23, 2019
|
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
tomwilkie commentedApr 4, 2017
Currently, any error from storage is returned to the user as a 422 (see #1213 for the discussion). The argument for this seems predicated on the idea that "the storage interface doesn't report errors", but thats not the case any more.
I propose we allow the storage layer to propagate errors by exposing the apiErr type, and adding a case to https://github.com/prometheus/prometheus/blob/master/web/api/v1/api.go#L192 that passes apiErrs straight through. That way, the storage can throw an apiErr for internal error.
May need to more apiErr to a new package, so prevent circular imports.
WDYT?