Skip to content

Commit

Permalink
ingester: rename config to PushGrpcMethodEnabled
Browse files Browse the repository at this point in the history
Signed-off-by: Vladimir Varankin <[email protected]>
  • Loading branch information
narqo committed Mar 12, 2024
1 parent b547fc2 commit f4e24c5
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 10 deletions.
7 changes: 3 additions & 4 deletions pkg/ingester/ingester.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ 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"`
PushGrpcMethodEnabled bool `yaml:"push_grpc_method_enabled" category:"experimental" doc:"hidden"`

// This config is dynamically injected because defined outside the ingester config.
IngestStorageConfig ingest.Config `yaml:"-"`
Expand All @@ -232,8 +232,7 @@ func (cfg *Config) RegisterFlags(f *flag.FlagSet, logger log.Logger) {
f.BoolVar(&cfg.UseIngesterOwnedSeriesForLimits, "ingester.use-ingester-owned-series-for-limits", false, "When enabled, only series currently owned by ingester according to the ring are used when checking user per-tenant series limit.")
f.BoolVar(&cfg.UpdateIngesterOwnedSeries, "ingester.track-ingester-owned-series", false, "This option enables tracking of ingester-owned series based on ring state, even if -ingester.use-ingester-owned-series-for-limits is disabled.")
f.DurationVar(&cfg.OwnedSeriesUpdateInterval, "ingester.owned-series-update-interval", 15*time.Second, "How often to check for ring changes and possibly recompute owned series as a result of detected change.")

f.BoolVar(&cfg.EnablePushAPI, "ingester.enable-push-api", true, "When disabled, disallows Push API in ingester. Use after migrating ingester to ingest-storage.")
f.BoolVar(&cfg.PushGrpcMethodEnabled, "ingester.push-grpc-method-enabled", true, "Enables Push gRPC method on ingester. Can be only disabled when using ingest-storage to make sure ingesters only receive data from Kafka.")

// The ingester.return-only-grpc-errors flag has been deprecated.
// According to the migration plan (https://github.com/grafana/mimir/issues/6008#issuecomment-1854320098)
Expand Down Expand Up @@ -3502,7 +3501,7 @@ func (i *Ingester) PushToStorage(ctx context.Context, req *mimirpb.WriteRequest)

// Push implements client.IngesterServer
func (i *Ingester) Push(ctx context.Context, req *mimirpb.WriteRequest) (*mimirpb.WriteResponse, error) {
if !i.cfg.EnablePushAPI {
if !i.cfg.PushGrpcMethodEnabled {
return nil, errPushAPIDisabled
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/ingester/ingester_ingest_storage_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ func createTestIngesterWithIngestStorage(t testing.TB, ingesterCfg *Config, over
defaultIngesterConfig := defaultIngesterTestConfig(t)

// Always disable gRPC Push API when testing ingest store.
ingesterCfg.EnablePushAPI = false
ingesterCfg.PushGrpcMethodEnabled = false

ingesterCfg.IngestStorageConfig.Enabled = true
ingesterCfg.IngestStorageConfig.KafkaConfig.Topic = "mimir"
Expand Down
4 changes: 2 additions & 2 deletions pkg/ingester/ingester_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6748,9 +6748,9 @@ func TestIngester_PushInstanceLimitsWithCircuitBreaker_LimitInflightRequestsUsin
}
}

func TestIngester_PushAPIDisabled(t *testing.T) {
func TestIngester_PushGrpcMethod_Disabled(t *testing.T) {
cfg := defaultIngesterTestConfig(t)
cfg.EnablePushAPI = false
cfg.PushGrpcMethodEnabled = false

registry := prometheus.NewRegistry()

Expand Down
4 changes: 2 additions & 2 deletions pkg/mimir/mimir.go
Original file line number Diff line number Diff line change
Expand Up @@ -244,8 +244,8 @@ func (c *Config) Validate(log log.Logger) error {
if c.IngestStorage.Enabled && !c.Ingester.DeprecatedReturnOnlyGRPCErrors {
return errors.New("to use ingest storage (-ingest-storage.enabled) also enable -ingester.return-only-grpc-errors")
}
if !c.IngestStorage.Enabled && !c.Ingester.EnablePushAPI {
return errors.New("cannot disable Push API in ingester, while ingest storage (-ingest-storage.enabled) is also disabled")
if !c.IngestStorage.Enabled && !c.Ingester.PushGrpcMethodEnabled {
return errors.New("cannot disable Push gRPC method in ingester, while ingest storage (-ingest-storage.enabled) is not enabled")
}
}
if err := c.BlocksStorage.Validate(c.Ingester.ActiveSeriesMetrics); err != nil {
Expand Down
2 changes: 1 addition & 1 deletion pkg/mimir/mimir_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@ func TestConfigValidation(t *testing.T) {
getTestConfig: func() *Config {
cfg := newDefaultConfig()
_ = cfg.Target.Set("ingester")
cfg.Ingester.EnablePushAPI = false
cfg.Ingester.PushGrpcMethodEnabled = false
cfg.IngestStorage.Enabled = false

return cfg
Expand Down

0 comments on commit f4e24c5

Please sign in to comment.