-
Notifications
You must be signed in to change notification settings - Fork 541
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
ingester: Support for disallowing Push API for ingest storage #7503
Conversation
f8262fb
to
03bbc75
Compare
03bbc75
to
4e482e0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for working on this! I left a major comment.
a61556f
to
e6498a0
Compare
Building new version of mimir-build-image. After image is built and pushed to Docker Hub, a new commit will automatically be added to this PR with new image version |
6e2599e
to
41b691d
Compare
@@ -281,7 +279,6 @@ type Ingester interface { | |||
ShutdownHandler(http.ResponseWriter, *http.Request) | |||
PrepareShutdownHandler(http.ResponseWriter, *http.Request) | |||
PreparePartitionDownscaleHandler(http.ResponseWriter, *http.Request) | |||
PushWithCleanup(context.Context, *mimirpb.WriteRequest, func()) error |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The method PushWithCleanup()
shouldn't be required by the api.Ingester
interface. Thus, I want to remove it here. IMHO, this makes the code a tiny bit simpler.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, this looks good overall. I have left some small comments.
I would not call this "Push API" because that is widely understood as HTTP push endpoint on distributors. Ingesters only have "Push" gRPC method, so I would suggest to use that name explicitely.
I would also like to see changes that are not necessary for this PR in ingester error mapping and grpc push check to be reverted.
pkg/ingester/errors.go
Outdated
var errStatus errorWithStatus | ||
if errors.As(err, &errStatus) { | ||
// If the error was already mapped (or wrapped) into appropriate errorWithStatus, | ||
// return it as is. | ||
return errStatus | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this change required? Newly introduced errPushAPIDisabled
is not mapped via this method. (We could map METHOD_NOT_ALLOWED
to codes.Unimplemented
if needed).
Same comment in mapPushErrorToErrorWithHTTPOrGRPCStatus
. I would suggest to remove unnecessary changes from the PR.
pkg/ingester/ingester.go
Outdated
@@ -206,6 +206,8 @@ type Config struct { | |||
UpdateIngesterOwnedSeries bool `yaml:"track_ingester_owned_series" category:"experimental"` | |||
OwnedSeriesUpdateInterval time.Duration `yaml:"owned_series_update_interval" category:"experimental"` | |||
|
|||
EnablePushAPI bool `yaml:"enable_push_api" category:"experimental" doc:"hidden"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We try to use "Enabled" suffix, in this case PushAPIEnabled
or perhaps PushMethodEnabled
or even PushGrpcMethodEnabled
to indicate this is very low-level thing that nobody should touch. Same name should be used for YAML field and CLI flag.
Signed-off-by: Vladimir Varankin <[email protected]> Co-authored-by: Marco Pracucci <[email protected]>
Signed-off-by: Vladimir Varankin <[email protected]>
Signed-off-by: Vladimir Varankin <[email protected]>
Signed-off-by: Vladimir Varankin <[email protected]>
Signed-off-by: Vladimir Varankin <[email protected]>
Signed-off-by: Vladimir Varankin <[email protected]>
Signed-off-by: Vladimir Varankin <[email protected]>
41b691d
to
f4e24c5
Compare
Co-authored-by: Peter Štibraný <[email protected]> Signed-off-by: Vladimir Varankin <[email protected]>
bce5c21
to
52bcfd7
Compare
🆙 I think, I've addressed all the comments. PHAL |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you very much for this PR and addressing my feedback.
@@ -46,6 +46,7 @@ enum ErrorCause { | |||
TSDB_UNAVAILABLE = 8; | |||
TOO_BUSY = 9; | |||
CIRCUIT_BREAKER_OPEN = 10; | |||
METHOD_NOT_ALLOWED = 11; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We've added a new error cause, but then this has to be explicitly mapped to HTTP status codes. As a reference, look all places where TSDB_UNAVAILABLE
is used and do something similar for METHOD_NOT_ALLOWED
too. I would return 405
for METHOD_NOT_ALLOWED
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually I see you proposed it in #7618 but got rejected with a good feedback. Let me follow up offline about it.
What this PR does
These changes are still in progress by I wanted to get some early feedback, on if the direction is rightThe changes add a new flag
-ingerster.push-grpc-method-enabled (default "true")
. It allows a user to configure the app to block "push" gRPC API in the ingester module, IFF it has ingest-store enabled.Which issue(s) this PR fixes or relates to
n/a
Checklist
CHANGELOG.md
updated - the order of entries should be[CHANGE]
,[FEATURE]
,[ENHANCEMENT]
,[BUGFIX]
.about-versioning.md
updated with experimental features.