diff --git a/go/cmd/vtctldclient/command/throttler.go b/go/cmd/vtctldclient/command/throttler.go index da8b0763b0d..200d5f87f0b 100644 --- a/go/cmd/vtctldclient/command/throttler.go +++ b/go/cmd/vtctldclient/command/throttler.go @@ -169,10 +169,6 @@ func init() { UpdateThrottlerConfig.Flags().StringVar(&updateThrottlerConfigOptions.MetricName, "metric-name", "", "name of the metric for which we apply a new threshold (requires --threshold). If empty, the default (either 'lag' or 'custom') metric is used.") UpdateThrottlerConfig.Flags().Float64Var(&updateThrottlerConfigOptions.Threshold, "threshold", 0, "threshold for the either default check (replication lag seconds) or custom check") UpdateThrottlerConfig.Flags().StringVar(&updateThrottlerConfigOptions.CustomQuery, "custom-query", "", "custom throttler check query") - UpdateThrottlerConfig.Flags().BoolVar(&updateThrottlerConfigOptions.CheckAsCheckSelf, "check-as-check-self", false, "/throttler/check requests behave as is /throttler/check-self was called") - UpdateThrottlerConfig.Flags().BoolVar(&updateThrottlerConfigOptions.CheckAsCheckShard, "check-as-check-shard", false, "use standard behavior for /throttler/check requests") - UpdateThrottlerConfig.Flags().MarkDeprecated("check-as-check-self", "specify metric with scope in --app-metrics to apply to all checks, or use --scope in CheckThrottler for a specific check") - UpdateThrottlerConfig.Flags().MarkDeprecated("check-as-check-shard", "specify metric with scope in --app-metrics to apply to all checks, or use --scope in CheckThrottler for a specific check") UpdateThrottlerConfig.Flags().StringVar(&unthrottledAppRule.Name, "unthrottle-app", "", "an app name to unthrottle") UpdateThrottlerConfig.Flags().StringVar(&throttledAppRule.Name, "throttle-app", "", "an app name to throttle") diff --git a/go/test/endtoend/onlineddl/revert/onlineddl_revert_test.go b/go/test/endtoend/onlineddl/revert/onlineddl_revert_test.go index af88806fb26..970d79a6e45 100644 --- a/go/test/endtoend/onlineddl/revert/onlineddl_revert_test.go +++ b/go/test/endtoend/onlineddl/revert/onlineddl_revert_test.go @@ -21,7 +21,6 @@ import ( "flag" "fmt" "math/rand/v2" - "net/http" "os" "path" "strings" @@ -33,6 +32,7 @@ import ( "vitess.io/vitess/go/mysql" "vitess.io/vitess/go/mysql/capabilities" "vitess.io/vitess/go/vt/log" + tabletmanagerdatapb "vitess.io/vitess/go/vt/proto/tabletmanagerdata" "vitess.io/vitess/go/vt/schema" "vitess.io/vitess/go/vt/vttablet/tabletserver/throttle/throttlerapp" @@ -209,7 +209,7 @@ func TestRevertSchemaChanges(t *testing.T) { require.Equal(t, 1, len(shards)) throttler.EnableLagThrottlerAndWaitForStatus(t, clusterInstance) - throttler.WaitForCheckThrottlerResult(t, clusterInstance, primaryTablet, throttlerapp.TestingName, nil, http.StatusOK, time.Minute) + throttler.WaitForCheckThrottlerResult(t, clusterInstance, primaryTablet, throttlerapp.TestingName, nil, tabletmanagerdatapb.CheckThrottlerResponseCode_OK, time.Minute) t.Run("revertible", testRevertible) t.Run("revert", testRevert) diff --git a/go/test/endtoend/tabletmanager/throttler_topo/throttler_test.go b/go/test/endtoend/tabletmanager/throttler_topo/throttler_test.go index 08cea643940..9375d35794d 100644 --- a/go/test/endtoend/tabletmanager/throttler_topo/throttler_test.go +++ b/go/test/endtoend/tabletmanager/throttler_topo/throttler_test.go @@ -179,7 +179,6 @@ func throttleCheck(tablet *cluster.Vttablet, skipRequestHeartbeats bool) (*vtctl flags := &throttle.CheckFlags{ Scope: base.ShardScope, SkipRequestHeartbeats: skipRequestHeartbeats, - MultiMetricsEnabled: true, } resp, err := throttler.CheckThrottler(clusterInstance, tablet, testAppName, flags) return resp, err @@ -187,8 +186,7 @@ func throttleCheck(tablet *cluster.Vttablet, skipRequestHeartbeats bool) (*vtctl func throttleCheckSelf(tablet *cluster.Vttablet) (*vtctldatapb.CheckThrottlerResponse, error) { flags := &throttle.CheckFlags{ - Scope: base.SelfScope, - MultiMetricsEnabled: true, + Scope: base.SelfScope, } resp, err := throttler.CheckThrottler(clusterInstance, tablet, testAppName, flags) return resp, err @@ -211,7 +209,7 @@ func warmUpHeartbeat(t *testing.T) tabletmanagerdatapb.CheckThrottlerResponseCod require.NoError(t, err) time.Sleep(time.Second) - return throttle.ResponseCodeFromStatus(resp.Check.ResponseCode, int(resp.Check.StatusCode)) + return resp.Check.ResponseCode } // waitForThrottleCheckStatus waits for the tablet to return the provided HTTP code in a throttle check @@ -233,7 +231,7 @@ func waitForThrottleCheckStatus(t *testing.T, tablet *cluster.Vttablet, wantCode } select { case <-ctx.Done(): - return assert.EqualValues(t, wantCode, resp.Check.StatusCode, "response: %+v", resp) + return assert.EqualValues(t, wantCode, resp.Check.ResponseCode, "response: %+v", resp) case <-ticker.C: } } @@ -344,13 +342,6 @@ func TestInitialThrottler(t *testing.T) { assert.Equal(t, base.ShardScope.String(), metrics.Scope) } - if !assert.EqualValues(t, http.StatusOK, resp.Check.StatusCode, "Unexpected response from throttler: %+v", resp) { - rs, err := replicaTablet.VttabletProcess.QueryTablet("show replica status", keyspaceName, false) - assert.NoError(t, err) - t.Logf("Seconds_Behind_Source: %s", rs.Named().Row()["Seconds_Behind_Source"].ToString()) - t.Logf("throttler primary status: %+v", throttleStatus(t, primaryTablet)) - t.Logf("throttler replica status: %+v", throttleStatus(t, replicaTablet)) - } if !assert.EqualValues(t, tabletmanagerdatapb.CheckThrottlerResponseCode_OK, resp.Check.ResponseCode, "Unexpected response from throttler: %+v", resp) { rs, err := replicaTablet.VttabletProcess.QueryTablet("show replica status", keyspaceName, false) assert.NoError(t, err) @@ -369,13 +360,6 @@ func TestInitialThrottler(t *testing.T) { for _, metrics := range resp.Check.Metrics { assert.Equal(t, base.ShardScope.String(), metrics.Scope) } - if !assert.EqualValues(t, http.StatusOK, resp.Check.StatusCode, "Unexpected response from throttler: %+v", resp) { - rs, err := replicaTablet.VttabletProcess.QueryTablet("show replica status", keyspaceName, false) - assert.NoError(t, err) - t.Logf("Seconds_Behind_Source: %s", rs.Named().Row()["Seconds_Behind_Source"].ToString()) - t.Logf("throttler primary status: %+v", throttleStatus(t, primaryTablet)) - t.Logf("throttler replica status: %+v", throttleStatus(t, replicaTablet)) - } if !assert.EqualValues(t, tabletmanagerdatapb.CheckThrottlerResponseCode_OK, resp.Check.ResponseCode, "Unexpected response from throttler: %+v", resp) { rs, err := replicaTablet.VttabletProcess.QueryTablet("show replica status", keyspaceName, false) assert.NoError(t, err) @@ -429,7 +413,7 @@ func TestThrottleViaApplySchema(t *testing.T) { require.NotNil(t, keyspace.Keyspace.ThrottlerConfig.ThrottledApps) // ThrottledApps will actually be empty at this point, but more specifically we want to see that "online-ddl" is not there. appRule, ok := keyspace.Keyspace.ThrottlerConfig.ThrottledApps[throttlerapp.OnlineDDLName.String()] - assert.True(t, ok, "app rule: %v", appRule) + assert.False(t, ok, "app rule: %v", appRule) }) } @@ -451,13 +435,11 @@ func TestThrottlerAfterMetricsCollected(t *testing.T) { t.Run("validating primary check self", func(t *testing.T) { resp, err := throttleCheckSelf(primaryTablet) require.NoError(t, err) - assert.EqualValues(t, http.StatusOK, resp.Check.StatusCode, "Unexpected response from throttler: %+v", resp) assert.EqualValues(t, tabletmanagerdatapb.CheckThrottlerResponseCode_OK, resp.Check.ResponseCode, "Unexpected response from throttler: %+v", resp) }) t.Run("validating replica check self", func(t *testing.T) { resp, err := throttleCheckSelf(replicaTablet) require.NoError(t, err) - assert.EqualValues(t, http.StatusOK, resp.Check.StatusCode, "Unexpected response from throttler: %+v", resp) assert.EqualValues(t, tabletmanagerdatapb.CheckThrottlerResponseCode_OK, resp.Check.ResponseCode, "Unexpected response from throttler: %+v", resp) }) } @@ -485,7 +467,6 @@ func TestLag(t *testing.T) { t.Run("expecting throttler push back", func(t *testing.T) { resp, err := throttleCheck(primaryTablet, false) require.NoError(t, err) - assert.EqualValues(t, http.StatusTooManyRequests, resp.Check.StatusCode, "Unexpected response from throttler: %+v", resp) assert.EqualValues(t, tabletmanagerdatapb.CheckThrottlerResponseCode_THRESHOLD_EXCEEDED, resp.Check.ResponseCode, "Unexpected response from throttler: %+v", resp) }) t.Run("primary self-check should still be fine", func(t *testing.T) { @@ -496,10 +477,6 @@ func TestLag(t *testing.T) { assert.Equal(t, base.SelfScope.String(), metrics.Scope) } // self (on primary) is unaffected by replication lag - if !assert.EqualValues(t, http.StatusOK, resp.Check.StatusCode, "Unexpected response from throttler: %+v", resp) { - t.Logf("throttler primary status: %+v", throttleStatus(t, primaryTablet)) - t.Logf("throttler replica status: %+v", throttleStatus(t, replicaTablet)) - } if !assert.EqualValues(t, tabletmanagerdatapb.CheckThrottlerResponseCode_OK, resp.Check.ResponseCode, "Unexpected response from throttler: %+v", resp) { t.Logf("throttler primary status: %+v", throttleStatus(t, primaryTablet)) t.Logf("throttler replica status: %+v", throttleStatus(t, replicaTablet)) @@ -512,7 +489,6 @@ func TestLag(t *testing.T) { for _, metrics := range resp.Check.Metrics { assert.Equal(t, base.SelfScope.String(), metrics.Scope) } - assert.EqualValues(t, http.StatusTooManyRequests, resp.Check.StatusCode, "Unexpected response from throttler: %+v", resp) assert.EqualValues(t, tabletmanagerdatapb.CheckThrottlerResponseCode_THRESHOLD_EXCEEDED, resp.Check.ResponseCode, "Unexpected response from throttler: %+v", resp) }) t.Run("exempting test app", func(t *testing.T) { @@ -590,13 +566,11 @@ func TestLag(t *testing.T) { resp, err := throttleCheckSelf(primaryTablet) require.NoError(t, err) // self (on primary) is unaffected by replication lag - assert.EqualValues(t, http.StatusOK, resp.Check.StatusCode, "Unexpected response from throttler: %+v", resp) assert.EqualValues(t, tabletmanagerdatapb.CheckThrottlerResponseCode_OK, resp.Check.ResponseCode, "Unexpected response from throttler: %+v", resp) }) t.Run("replica self-check should be fine", func(t *testing.T) { resp, err := throttleCheckSelf(replicaTablet) require.NoError(t, err) - assert.EqualValues(t, http.StatusOK, resp.Check.StatusCode, "Unexpected response from throttler: %+v", resp) assert.EqualValues(t, tabletmanagerdatapb.CheckThrottlerResponseCode_OK, resp.Check.ResponseCode, "Unexpected response from throttler: %+v", resp) }) } @@ -641,7 +615,6 @@ func TestCustomQuery(t *testing.T) { throttler.WaitForValidData(t, primaryTablet, throttlerEnabledTimeout) resp, err := throttleCheck(primaryTablet, false) require.NoError(t, err) - assert.EqualValues(t, http.StatusOK, resp.Check.StatusCode, "Unexpected response from throttler: %+v", resp) assert.EqualValues(t, tabletmanagerdatapb.CheckThrottlerResponseCode_OK, resp.Check.ResponseCode, "Unexpected response from throttler: %+v", resp) }) t.Run("test threads running", func(t *testing.T) { @@ -668,7 +641,6 @@ func TestCustomQuery(t *testing.T) { { resp, err := throttleCheckSelf(primaryTablet) require.NoError(t, err) - assert.EqualValues(t, http.StatusTooManyRequests, resp.Check.StatusCode, "Unexpected response from throttler: %+v", resp) assert.EqualValues(t, tabletmanagerdatapb.CheckThrottlerResponseCode_THRESHOLD_EXCEEDED, resp.Check.ResponseCode, "Unexpected response from throttler: %+v", resp) } }) @@ -680,7 +652,6 @@ func TestCustomQuery(t *testing.T) { { resp, err := throttleCheckSelf(primaryTablet) require.NoError(t, err) - assert.EqualValues(t, http.StatusOK, resp.Check.StatusCode, "Unexpected response from throttler: %+v", resp) assert.EqualValues(t, tabletmanagerdatapb.CheckThrottlerResponseCode_OK, resp.Check.ResponseCode, "Unexpected response from throttler: %+v", resp) } }) @@ -704,7 +675,6 @@ func TestRestoreDefaultQuery(t *testing.T) { t.Run("validating OK response from throttler with default threshold, heartbeats running", func(t *testing.T) { resp, err := throttleCheck(primaryTablet, false) require.NoError(t, err) - assert.EqualValues(t, http.StatusOK, resp.Check.StatusCode, "Unexpected response from throttler: %+v", resp) assert.EqualValues(t, tabletmanagerdatapb.CheckThrottlerResponseCode_OK, resp.Check.ResponseCode, "Unexpected response from throttler: %+v", resp) }) t.Run("validating pushback response from throttler on default threshold once heartbeats go stale", func(t *testing.T) { diff --git a/go/test/endtoend/throttler/util.go b/go/test/endtoend/throttler/util.go index fccad19c324..7334f50a9ed 100644 --- a/go/test/endtoend/throttler/util.go +++ b/go/test/endtoend/throttler/util.go @@ -66,8 +66,7 @@ func CheckThrottlerRaw(vtctldProcess *cluster.VtctldClientProcess, tablet *clust args = append(args, "CheckThrottler") if flags == nil { flags = &throttle.CheckFlags{ - Scope: base.SelfScope, - MultiMetricsEnabled: true, + Scope: base.SelfScope, } } if appName != "" { @@ -124,11 +123,6 @@ func UpdateThrottlerTopoConfigRaw( args = append(args, "--threshold", fmt.Sprintf("%f", opts.Threshold)) } args = append(args, "--custom-query", opts.CustomQuery) - if opts.CustomQuery != "" { - args = append(args, "--check-as-check-self") - } else { - args = append(args, "--check-as-check-shard") - } if appRule != nil { args = append(args, "--throttle-app", appRule.Name) args = append(args, "--throttle-app-duration", time.Until(protoutil.TimeFromProto(appRule.ExpiresAt).UTC()).String()) @@ -485,7 +479,7 @@ func EnableLagThrottlerAndWaitForStatus(t *testing.T, clusterInstance *cluster.L } } -func WaitForCheckThrottlerResult(t *testing.T, clusterInstance *cluster.LocalProcessCluster, tablet *cluster.Vttablet, appName throttlerapp.Name, flags *throttle.CheckFlags, expect int32, timeout time.Duration) (*vtctldatapb.CheckThrottlerResponse, error) { +func WaitForCheckThrottlerResult(t *testing.T, clusterInstance *cluster.LocalProcessCluster, tablet *cluster.Vttablet, appName throttlerapp.Name, flags *throttle.CheckFlags, expect tabletmanagerdatapb.CheckThrottlerResponseCode, timeout time.Duration) (*vtctldatapb.CheckThrottlerResponse, error) { ctx, cancel := context.WithTimeout(context.Background(), timeout) defer cancel() ticker := time.NewTicker(time.Second) @@ -493,7 +487,7 @@ func WaitForCheckThrottlerResult(t *testing.T, clusterInstance *cluster.LocalPro for { resp, err := CheckThrottler(clusterInstance, tablet, appName, flags) require.NoError(t, err) - if resp.Check.StatusCode == expect { + if resp.Check.ResponseCode == expect { return resp, nil } select { @@ -534,11 +528,11 @@ func WaitForValidData(t *testing.T, tablet *cluster.Vttablet, timeout time.Durat for { checkResp, checkErr := http.Get(checkURL) - if checkErr != nil { + if checkErr == nil { defer checkResp.Body.Close() } selfCheckResp, selfCheckErr := http.Get(selfCheckURL) - if selfCheckErr != nil { + if selfCheckErr == nil { defer selfCheckResp.Body.Close() } if checkErr == nil && selfCheckErr == nil && diff --git a/go/test/endtoend/vreplication/helper_test.go b/go/test/endtoend/vreplication/helper_test.go index 3795b6f52d5..ec2ce2da4d1 100644 --- a/go/test/endtoend/vreplication/helper_test.go +++ b/go/test/endtoend/vreplication/helper_test.go @@ -55,6 +55,7 @@ import ( "vitess.io/vitess/go/vt/vttablet/tabletserver/throttle/throttlerapp" binlogdatapb "vitess.io/vitess/go/vt/proto/binlogdata" + tabletmanagerdatapb "vitess.io/vitess/go/vt/proto/tabletmanagerdata" topodatapb "vitess.io/vitess/go/vt/proto/topodata" ) @@ -178,16 +179,32 @@ func waitForQueryResult(t *testing.T, conn *mysql.Conn, database string, query s // waitForTabletThrottlingStatus waits for the tablet to return the provided HTTP code for // the provided app name in its self check. -func waitForTabletThrottlingStatus(t *testing.T, tablet *cluster.VttabletProcess, throttlerApp throttlerapp.Name, wantCode int64) { - var gotCode int64 +func waitForTabletThrottlingStatus(t *testing.T, tablet *cluster.VttabletProcess, throttlerApp throttlerapp.Name, wantCode int) { timer := time.NewTimer(defaultTimeout) defer timer.Stop() for { output, err := throttlerCheckSelf(tablet, throttlerApp) require.NoError(t, err) - gotCode, err = jsonparser.GetInt([]byte(output), "StatusCode") - require.NoError(t, err) + responseCode, err := jsonparser.GetInt([]byte(output), "ResponseCode") + require.NoError(t, err, "waitForTabletThrottlingStatus output: %v", output) + + var gotCode int + switch tabletmanagerdatapb.CheckThrottlerResponseCode(responseCode) { + case tabletmanagerdatapb.CheckThrottlerResponseCode_OK: + gotCode = http.StatusOK + case tabletmanagerdatapb.CheckThrottlerResponseCode_APP_DENIED: + gotCode = http.StatusExpectationFailed + case tabletmanagerdatapb.CheckThrottlerResponseCode_THRESHOLD_EXCEEDED: + gotCode = http.StatusTooManyRequests + case tabletmanagerdatapb.CheckThrottlerResponseCode_UNKNOWN_METRIC: + gotCode = http.StatusNotFound + case tabletmanagerdatapb.CheckThrottlerResponseCode_INTERNAL_ERROR: + gotCode = http.StatusInternalServerError + default: + gotCode = http.StatusInternalServerError + } + if wantCode == gotCode { // Wait for any cached check values to be cleared and the new // status value to be in effect everywhere before returning. diff --git a/go/vt/proto/tabletmanagerdata/tabletmanagerdata.pb.go b/go/vt/proto/tabletmanagerdata/tabletmanagerdata.pb.go index eb29cd462c4..8cc2a377490 100644 --- a/go/vt/proto/tabletmanagerdata/tabletmanagerdata.pb.go +++ b/go/vt/proto/tabletmanagerdata/tabletmanagerdata.pb.go @@ -7414,9 +7414,6 @@ type CheckThrottlerRequest struct { SkipRequestHeartbeats bool `protobuf:"varint,3,opt,name=skip_request_heartbeats,json=skipRequestHeartbeats,proto3" json:"skip_request_heartbeats,omitempty"` // OKIfNotExists asks the throttler to return OK even if the metric does not exist OkIfNotExists bool `protobuf:"varint,4,opt,name=ok_if_not_exists,json=okIfNotExists,proto3" json:"ok_if_not_exists,omitempty"` - // MultiMetricsEnabled is always set to "true" and is how a multi-metrics enabled replica - // throttler knows its being probed by a multi-metrics enabled primary vttablet. - MultiMetricsEnabled bool `protobuf:"varint,5,opt,name=multi_metrics_enabled,json=multiMetricsEnabled,proto3" json:"multi_metrics_enabled,omitempty"` } func (x *CheckThrottlerRequest) Reset() { @@ -7479,20 +7476,11 @@ func (x *CheckThrottlerRequest) GetOkIfNotExists() bool { return false } -func (x *CheckThrottlerRequest) GetMultiMetricsEnabled() bool { - if x != nil { - return x.MultiMetricsEnabled - } - return false -} - type CheckThrottlerResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // StatusCode is HTTP compliant response code (e.g. 200 for OK) - StatusCode int32 `protobuf:"varint,1,opt,name=status_code,json=statusCode,proto3" json:"status_code,omitempty"` // Value is the metric value collected by the tablet Value float64 `protobuf:"fixed64,2,opt,name=value,proto3" json:"value,omitempty"` // Threshold is the throttling threshold the table was comparing the value with @@ -7547,13 +7535,6 @@ func (*CheckThrottlerResponse) Descriptor() ([]byte, []int) { return file_tabletmanagerdata_proto_rawDescGZIP(), []int{139} } -func (x *CheckThrottlerResponse) GetStatusCode() int32 { - if x != nil { - return x.StatusCode - } - return 0 -} - func (x *CheckThrottlerResponse) GetValue() float64 { if x != nil { return x.Value @@ -8116,8 +8097,6 @@ type CheckThrottlerResponse_Metric struct { // Name of the metric Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - // StatusCode is HTTP compliant response code (e.g. 200 for OK) - StatusCode int32 `protobuf:"varint,2,opt,name=status_code,json=statusCode,proto3" json:"status_code,omitempty"` // Value is the metric value collected by the tablet Value float64 `protobuf:"fixed64,3,opt,name=value,proto3" json:"value,omitempty"` // Threshold is the throttling threshold the table was comparing the value with @@ -8171,13 +8150,6 @@ func (x *CheckThrottlerResponse_Metric) GetName() string { return "" } -func (x *CheckThrottlerResponse_Metric) GetStatusCode() int32 { - if x != nil { - return x.StatusCode - } - return 0 -} - func (x *CheckThrottlerResponse_Metric) GetValue() float64 { if x != nil { return x.Value @@ -8335,8 +8307,7 @@ type GetThrottlerStatusResponse_RecentApp struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - CheckedAt *vttime.Time `protobuf:"bytes,1,opt,name=checked_at,json=checkedAt,proto3" json:"checked_at,omitempty"` - StatusCode int32 `protobuf:"varint,2,opt,name=status_code,json=statusCode,proto3" json:"status_code,omitempty"` + CheckedAt *vttime.Time `protobuf:"bytes,1,opt,name=checked_at,json=checkedAt,proto3" json:"checked_at,omitempty"` // ResponseCode is the enum representation of the response ResponseCode CheckThrottlerResponseCode `protobuf:"varint,3,opt,name=response_code,json=responseCode,proto3,enum=tabletmanagerdata.CheckThrottlerResponseCode" json:"response_code,omitempty"` } @@ -8380,13 +8351,6 @@ func (x *GetThrottlerStatusResponse_RecentApp) GetCheckedAt() *vttime.Time { return nil } -func (x *GetThrottlerStatusResponse_RecentApp) GetStatusCode() int32 { - if x != nil { - return x.StatusCode - } - return 0 -} - func (x *GetThrottlerStatusResponse_RecentApp) GetResponseCode() CheckThrottlerResponseCode { if x != nil { return x.ResponseCode @@ -9335,7 +9299,7 @@ var file_tabletmanagerdata_proto_rawDesc = []byte{ 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x73, 0x22, 0x18, 0x0a, 0x16, 0x52, 0x65, 0x73, 0x65, 0x74, 0x53, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x73, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0xdd, 0x01, 0x0a, 0x15, 0x43, 0x68, 0x65, 0x63, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0xc6, 0x01, 0x0a, 0x15, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x54, 0x68, 0x72, 0x6f, 0x74, 0x74, 0x6c, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x19, 0x0a, 0x08, 0x61, 0x70, 0x70, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x70, 0x70, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, @@ -9346,62 +9310,58 @@ var file_tabletmanagerdata_proto_rawDesc = []byte{ 0x48, 0x65, 0x61, 0x72, 0x74, 0x62, 0x65, 0x61, 0x74, 0x73, 0x12, 0x27, 0x0a, 0x10, 0x6f, 0x6b, 0x5f, 0x69, 0x66, 0x5f, 0x6e, 0x6f, 0x74, 0x5f, 0x65, 0x78, 0x69, 0x73, 0x74, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0d, 0x6f, 0x6b, 0x49, 0x66, 0x4e, 0x6f, 0x74, 0x45, 0x78, 0x69, - 0x73, 0x74, 0x73, 0x12, 0x32, 0x0a, 0x15, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x5f, 0x6d, 0x65, 0x74, - 0x72, 0x69, 0x63, 0x73, 0x5f, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x18, 0x05, 0x20, 0x01, - 0x28, 0x08, 0x52, 0x13, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, - 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x22, 0x9f, 0x06, 0x0a, 0x16, 0x43, 0x68, 0x65, 0x63, - 0x6b, 0x54, 0x68, 0x72, 0x6f, 0x74, 0x74, 0x6c, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x5f, 0x63, 0x6f, 0x64, - 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x43, - 0x6f, 0x64, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x68, 0x72, - 0x65, 0x73, 0x68, 0x6f, 0x6c, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x01, 0x52, 0x09, 0x74, 0x68, - 0x72, 0x65, 0x73, 0x68, 0x6f, 0x6c, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, - 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x12, 0x18, 0x0a, - 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, - 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x29, 0x0a, 0x10, 0x72, 0x65, 0x63, 0x65, 0x6e, - 0x74, 0x6c, 0x79, 0x5f, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x65, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, - 0x08, 0x52, 0x0f, 0x72, 0x65, 0x63, 0x65, 0x6e, 0x74, 0x6c, 0x79, 0x43, 0x68, 0x65, 0x63, 0x6b, - 0x65, 0x64, 0x12, 0x50, 0x0a, 0x07, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x18, 0x07, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x36, 0x2e, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x74, 0x6d, 0x61, 0x6e, 0x61, - 0x67, 0x65, 0x72, 0x64, 0x61, 0x74, 0x61, 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x54, 0x68, 0x72, - 0x6f, 0x74, 0x74, 0x6c, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x4d, - 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x07, 0x6d, 0x65, 0x74, - 0x72, 0x69, 0x63, 0x73, 0x12, 0x19, 0x0a, 0x08, 0x61, 0x70, 0x70, 0x5f, 0x6e, 0x61, 0x6d, 0x65, - 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x70, 0x70, 0x4e, 0x61, 0x6d, 0x65, 0x12, - 0x18, 0x0a, 0x07, 0x73, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x07, 0x73, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x12, 0x52, 0x0a, 0x0d, 0x72, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0e, - 0x32, 0x2d, 0x2e, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x74, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, - 0x64, 0x61, 0x74, 0x61, 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x54, 0x68, 0x72, 0x6f, 0x74, 0x74, - 0x6c, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x52, - 0x0c, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x1a, 0x8b, 0x02, - 0x0a, 0x06, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1f, 0x0a, 0x0b, - 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x05, 0x52, 0x0a, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x14, 0x0a, - 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x01, 0x52, 0x05, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x68, 0x72, 0x65, 0x73, 0x68, 0x6f, 0x6c, 0x64, - 0x18, 0x04, 0x20, 0x01, 0x28, 0x01, 0x52, 0x09, 0x74, 0x68, 0x72, 0x65, 0x73, 0x68, 0x6f, 0x6c, - 0x64, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, - 0x67, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, - 0x65, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x05, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x12, 0x52, 0x0a, 0x0d, 0x72, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2d, - 0x2e, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x74, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x64, 0x61, - 0x74, 0x61, 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x54, 0x68, 0x72, 0x6f, 0x74, 0x74, 0x6c, 0x65, - 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x52, 0x0c, 0x72, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x1a, 0x6c, 0x0a, 0x0c, 0x4d, - 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, - 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x46, 0x0a, - 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x30, 0x2e, 0x74, - 0x61, 0x62, 0x6c, 0x65, 0x74, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x64, 0x61, 0x74, 0x61, - 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x54, 0x68, 0x72, 0x6f, 0x74, 0x74, 0x6c, 0x65, 0x72, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x52, 0x05, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x1b, 0x0a, 0x19, 0x47, 0x65, 0x74, + 0x73, 0x74, 0x73, 0x4a, 0x04, 0x08, 0x05, 0x10, 0x06, 0x52, 0x15, 0x6d, 0x75, 0x6c, 0x74, 0x69, + 0x5f, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x5f, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, + 0x22, 0xf6, 0x05, 0x0a, 0x16, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x54, 0x68, 0x72, 0x6f, 0x74, 0x74, + 0x6c, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x76, + 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, + 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x68, 0x72, 0x65, 0x73, 0x68, 0x6f, 0x6c, 0x64, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x01, 0x52, 0x09, 0x74, 0x68, 0x72, 0x65, 0x73, 0x68, 0x6f, 0x6c, 0x64, 0x12, + 0x14, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, + 0x65, 0x72, 0x72, 0x6f, 0x72, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, + 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, + 0x29, 0x0a, 0x10, 0x72, 0x65, 0x63, 0x65, 0x6e, 0x74, 0x6c, 0x79, 0x5f, 0x63, 0x68, 0x65, 0x63, + 0x6b, 0x65, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0f, 0x72, 0x65, 0x63, 0x65, 0x6e, + 0x74, 0x6c, 0x79, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x65, 0x64, 0x12, 0x50, 0x0a, 0x07, 0x6d, 0x65, + 0x74, 0x72, 0x69, 0x63, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x36, 0x2e, 0x74, 0x61, + 0x62, 0x6c, 0x65, 0x74, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x64, 0x61, 0x74, 0x61, 0x2e, + 0x43, 0x68, 0x65, 0x63, 0x6b, 0x54, 0x68, 0x72, 0x6f, 0x74, 0x74, 0x6c, 0x65, 0x72, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x45, 0x6e, + 0x74, 0x72, 0x79, 0x52, 0x07, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x12, 0x19, 0x0a, 0x08, + 0x61, 0x70, 0x70, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, + 0x61, 0x70, 0x70, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x75, 0x6d, 0x6d, 0x61, + 0x72, 0x79, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, 0x75, 0x6d, 0x6d, 0x61, 0x72, + 0x79, 0x12, 0x52, 0x0a, 0x0d, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x5f, 0x63, 0x6f, + 0x64, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2d, 0x2e, 0x74, 0x61, 0x62, 0x6c, 0x65, + 0x74, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x64, 0x61, 0x74, 0x61, 0x2e, 0x43, 0x68, 0x65, + 0x63, 0x6b, 0x54, 0x68, 0x72, 0x6f, 0x74, 0x74, 0x6c, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x52, 0x0c, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x43, 0x6f, 0x64, 0x65, 0x1a, 0xf0, 0x01, 0x0a, 0x06, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, + 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, + 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x68, + 0x72, 0x65, 0x73, 0x68, 0x6f, 0x6c, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x01, 0x52, 0x09, 0x74, + 0x68, 0x72, 0x65, 0x73, 0x68, 0x6f, 0x6c, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, + 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x12, 0x18, + 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x63, 0x6f, 0x70, + 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x12, 0x52, + 0x0a, 0x0d, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x18, + 0x08, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2d, 0x2e, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x74, 0x6d, 0x61, + 0x6e, 0x61, 0x67, 0x65, 0x72, 0x64, 0x61, 0x74, 0x61, 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x54, + 0x68, 0x72, 0x6f, 0x74, 0x74, 0x6c, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x43, 0x6f, 0x64, 0x65, 0x52, 0x0c, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x43, 0x6f, + 0x64, 0x65, 0x4a, 0x04, 0x08, 0x02, 0x10, 0x03, 0x1a, 0x6c, 0x0a, 0x0c, 0x4d, 0x65, 0x74, 0x72, + 0x69, 0x63, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x46, 0x0a, 0x05, 0x76, 0x61, + 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x30, 0x2e, 0x74, 0x61, 0x62, 0x6c, + 0x65, 0x74, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x64, 0x61, 0x74, 0x61, 0x2e, 0x43, 0x68, + 0x65, 0x63, 0x6b, 0x54, 0x68, 0x72, 0x6f, 0x74, 0x74, 0x6c, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x52, 0x05, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x4a, 0x04, 0x08, 0x01, 0x10, 0x02, 0x52, 0x0b, 0x73, 0x74, + 0x61, 0x74, 0x75, 0x73, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x22, 0x1b, 0x0a, 0x19, 0x47, 0x65, 0x74, 0x54, 0x68, 0x72, 0x6f, 0x74, 0x74, 0x6c, 0x65, 0x72, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0xb6, 0x10, 0x0a, 0x1a, 0x47, 0x65, 0x74, 0x54, 0x68, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x9b, 0x10, 0x0a, 0x1a, 0x47, 0x65, 0x74, 0x54, 0x68, 0x72, 0x6f, 0x74, 0x74, 0x6c, 0x65, 0x72, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x74, 0x5f, 0x61, 0x6c, 0x69, 0x61, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x74, 0x61, 0x62, @@ -9514,62 +9474,60 @@ var file_tabletmanagerdata_proto_rawDesc = []byte{ 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0xad, 0x01, 0x0a, 0x09, 0x52, 0x65, 0x63, 0x65, + 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x92, 0x01, 0x0a, 0x09, 0x52, 0x65, 0x63, 0x65, 0x6e, 0x74, 0x41, 0x70, 0x70, 0x12, 0x2b, 0x0a, 0x0a, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x76, 0x74, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x52, 0x09, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x65, 0x64, - 0x41, 0x74, 0x12, 0x1f, 0x0a, 0x0b, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x5f, 0x63, 0x6f, 0x64, - 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x43, - 0x6f, 0x64, 0x65, 0x12, 0x52, 0x0a, 0x0d, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x5f, - 0x63, 0x6f, 0x64, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2d, 0x2e, 0x74, 0x61, 0x62, - 0x6c, 0x65, 0x74, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x64, 0x61, 0x74, 0x61, 0x2e, 0x43, - 0x68, 0x65, 0x63, 0x6b, 0x54, 0x68, 0x72, 0x6f, 0x74, 0x74, 0x6c, 0x65, 0x72, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x52, 0x0c, 0x72, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x1a, 0x76, 0x0a, 0x0f, 0x52, 0x65, 0x63, 0x65, 0x6e, - 0x74, 0x41, 0x70, 0x70, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, - 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x4d, 0x0a, 0x05, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x37, 0x2e, 0x74, 0x61, - 0x62, 0x6c, 0x65, 0x74, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x64, 0x61, 0x74, 0x61, 0x2e, - 0x47, 0x65, 0x74, 0x54, 0x68, 0x72, 0x6f, 0x74, 0x74, 0x6c, 0x65, 0x72, 0x53, 0x74, 0x61, 0x74, - 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x52, 0x65, 0x63, 0x65, 0x6e, - 0x74, 0x41, 0x70, 0x70, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, - 0xaa, 0x01, 0x0a, 0x11, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x54, 0x61, 0x67, 0x73, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x42, 0x0a, 0x04, 0x74, 0x61, 0x67, 0x73, 0x18, 0x01, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x2e, 0x2e, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x74, 0x6d, 0x61, 0x6e, 0x61, - 0x67, 0x65, 0x72, 0x64, 0x61, 0x74, 0x61, 0x2e, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x54, 0x61, - 0x67, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x54, 0x61, 0x67, 0x73, 0x45, 0x6e, - 0x74, 0x72, 0x79, 0x52, 0x04, 0x74, 0x61, 0x67, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x65, 0x70, - 0x6c, 0x61, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x72, 0x65, 0x70, 0x6c, - 0x61, 0x63, 0x65, 0x1a, 0x37, 0x0a, 0x09, 0x54, 0x61, 0x67, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, - 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, - 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x92, 0x01, 0x0a, - 0x12, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x54, 0x61, 0x67, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x12, 0x43, 0x0a, 0x04, 0x74, 0x61, 0x67, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, - 0x0b, 0x32, 0x2f, 0x2e, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x74, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, - 0x72, 0x64, 0x61, 0x74, 0x61, 0x2e, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x54, 0x61, 0x67, 0x73, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x54, 0x61, 0x67, 0x73, 0x45, 0x6e, 0x74, - 0x72, 0x79, 0x52, 0x04, 0x74, 0x61, 0x67, 0x73, 0x1a, 0x37, 0x0a, 0x09, 0x54, 0x61, 0x67, 0x73, + 0x41, 0x74, 0x12, 0x52, 0x0a, 0x0d, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x5f, 0x63, + 0x6f, 0x64, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2d, 0x2e, 0x74, 0x61, 0x62, 0x6c, + 0x65, 0x74, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x64, 0x61, 0x74, 0x61, 0x2e, 0x43, 0x68, + 0x65, 0x63, 0x6b, 0x54, 0x68, 0x72, 0x6f, 0x74, 0x74, 0x6c, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x52, 0x0c, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x4a, 0x04, 0x08, 0x02, 0x10, 0x03, 0x1a, 0x76, 0x0a, 0x0f, + 0x52, 0x65, 0x63, 0x65, 0x6e, 0x74, 0x41, 0x70, 0x70, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, + 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, + 0x79, 0x12, 0x4d, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x37, 0x2e, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x74, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, + 0x64, 0x61, 0x74, 0x61, 0x2e, 0x47, 0x65, 0x74, 0x54, 0x68, 0x72, 0x6f, 0x74, 0x74, 0x6c, 0x65, + 0x72, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, + 0x52, 0x65, 0x63, 0x65, 0x6e, 0x74, 0x41, 0x70, 0x70, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x3a, 0x02, 0x38, 0x01, 0x22, 0xaa, 0x01, 0x0a, 0x11, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x54, + 0x61, 0x67, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x42, 0x0a, 0x04, 0x74, 0x61, + 0x67, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2e, 0x2e, 0x74, 0x61, 0x62, 0x6c, 0x65, + 0x74, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x64, 0x61, 0x74, 0x61, 0x2e, 0x43, 0x68, 0x61, + 0x6e, 0x67, 0x65, 0x54, 0x61, 0x67, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x54, + 0x61, 0x67, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x04, 0x74, 0x61, 0x67, 0x73, 0x12, 0x18, + 0x0a, 0x07, 0x72, 0x65, 0x70, 0x6c, 0x61, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, + 0x07, 0x72, 0x65, 0x70, 0x6c, 0x61, 0x63, 0x65, 0x1a, 0x37, 0x0a, 0x09, 0x54, 0x61, 0x67, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, - 0x01, 0x2a, 0x3e, 0x0a, 0x19, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x74, 0x53, 0x65, 0x6c, 0x65, 0x63, - 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x07, - 0x0a, 0x03, 0x41, 0x4e, 0x59, 0x10, 0x00, 0x12, 0x0b, 0x0a, 0x07, 0x49, 0x4e, 0x4f, 0x52, 0x44, - 0x45, 0x52, 0x10, 0x01, 0x12, 0x0b, 0x0a, 0x07, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, - 0x03, 0x2a, 0x83, 0x01, 0x0a, 0x1a, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x54, 0x68, 0x72, 0x6f, 0x74, - 0x74, 0x6c, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x43, 0x6f, 0x64, 0x65, - 0x12, 0x0d, 0x0a, 0x09, 0x55, 0x4e, 0x44, 0x45, 0x46, 0x49, 0x4e, 0x45, 0x44, 0x10, 0x00, 0x12, - 0x06, 0x0a, 0x02, 0x4f, 0x4b, 0x10, 0x01, 0x12, 0x16, 0x0a, 0x12, 0x54, 0x48, 0x52, 0x45, 0x53, - 0x48, 0x4f, 0x4c, 0x44, 0x5f, 0x45, 0x58, 0x43, 0x45, 0x45, 0x44, 0x45, 0x44, 0x10, 0x02, 0x12, - 0x0e, 0x0a, 0x0a, 0x41, 0x50, 0x50, 0x5f, 0x44, 0x45, 0x4e, 0x49, 0x45, 0x44, 0x10, 0x03, 0x12, - 0x12, 0x0a, 0x0e, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x5f, 0x4d, 0x45, 0x54, 0x52, 0x49, - 0x43, 0x10, 0x04, 0x12, 0x12, 0x0a, 0x0e, 0x49, 0x4e, 0x54, 0x45, 0x52, 0x4e, 0x41, 0x4c, 0x5f, - 0x45, 0x52, 0x52, 0x4f, 0x52, 0x10, 0x05, 0x42, 0x30, 0x5a, 0x2e, 0x76, 0x69, 0x74, 0x65, 0x73, - 0x73, 0x2e, 0x69, 0x6f, 0x2f, 0x76, 0x69, 0x74, 0x65, 0x73, 0x73, 0x2f, 0x67, 0x6f, 0x2f, 0x76, - 0x74, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x74, 0x6d, 0x61, - 0x6e, 0x61, 0x67, 0x65, 0x72, 0x64, 0x61, 0x74, 0x61, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x33, + 0x01, 0x22, 0x92, 0x01, 0x0a, 0x12, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x54, 0x61, 0x67, 0x73, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x43, 0x0a, 0x04, 0x74, 0x61, 0x67, 0x73, + 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2f, 0x2e, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x74, 0x6d, + 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x64, 0x61, 0x74, 0x61, 0x2e, 0x43, 0x68, 0x61, 0x6e, 0x67, + 0x65, 0x54, 0x61, 0x67, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x54, 0x61, + 0x67, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x04, 0x74, 0x61, 0x67, 0x73, 0x1a, 0x37, 0x0a, + 0x09, 0x54, 0x61, 0x67, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, + 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x2a, 0x3e, 0x0a, 0x19, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x74, + 0x53, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, + 0x6e, 0x63, 0x65, 0x12, 0x07, 0x0a, 0x03, 0x41, 0x4e, 0x59, 0x10, 0x00, 0x12, 0x0b, 0x0a, 0x07, + 0x49, 0x4e, 0x4f, 0x52, 0x44, 0x45, 0x52, 0x10, 0x01, 0x12, 0x0b, 0x0a, 0x07, 0x55, 0x4e, 0x4b, + 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x03, 0x2a, 0x83, 0x01, 0x0a, 0x1a, 0x43, 0x68, 0x65, 0x63, 0x6b, + 0x54, 0x68, 0x72, 0x6f, 0x74, 0x74, 0x6c, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x0d, 0x0a, 0x09, 0x55, 0x4e, 0x44, 0x45, 0x46, 0x49, 0x4e, + 0x45, 0x44, 0x10, 0x00, 0x12, 0x06, 0x0a, 0x02, 0x4f, 0x4b, 0x10, 0x01, 0x12, 0x16, 0x0a, 0x12, + 0x54, 0x48, 0x52, 0x45, 0x53, 0x48, 0x4f, 0x4c, 0x44, 0x5f, 0x45, 0x58, 0x43, 0x45, 0x45, 0x44, + 0x45, 0x44, 0x10, 0x02, 0x12, 0x0e, 0x0a, 0x0a, 0x41, 0x50, 0x50, 0x5f, 0x44, 0x45, 0x4e, 0x49, + 0x45, 0x44, 0x10, 0x03, 0x12, 0x12, 0x0a, 0x0e, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x5f, + 0x4d, 0x45, 0x54, 0x52, 0x49, 0x43, 0x10, 0x04, 0x12, 0x12, 0x0a, 0x0e, 0x49, 0x4e, 0x54, 0x45, + 0x52, 0x4e, 0x41, 0x4c, 0x5f, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x10, 0x05, 0x42, 0x30, 0x5a, 0x2e, + 0x76, 0x69, 0x74, 0x65, 0x73, 0x73, 0x2e, 0x69, 0x6f, 0x2f, 0x76, 0x69, 0x74, 0x65, 0x73, 0x73, + 0x2f, 0x67, 0x6f, 0x2f, 0x76, 0x74, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x74, 0x61, 0x62, + 0x6c, 0x65, 0x74, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x64, 0x61, 0x74, 0x61, 0x62, 0x06, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/go/vt/proto/tabletmanagerdata/tabletmanagerdata_vtproto.pb.go b/go/vt/proto/tabletmanagerdata/tabletmanagerdata_vtproto.pb.go index 3a327143ad8..bad400ca7fe 100644 --- a/go/vt/proto/tabletmanagerdata/tabletmanagerdata_vtproto.pb.go +++ b/go/vt/proto/tabletmanagerdata/tabletmanagerdata_vtproto.pb.go @@ -2744,7 +2744,6 @@ func (m *CheckThrottlerRequest) CloneVT() *CheckThrottlerRequest { r.Scope = m.Scope r.SkipRequestHeartbeats = m.SkipRequestHeartbeats r.OkIfNotExists = m.OkIfNotExists - r.MultiMetricsEnabled = m.MultiMetricsEnabled if len(m.unknownFields) > 0 { r.unknownFields = make([]byte, len(m.unknownFields)) copy(r.unknownFields, m.unknownFields) @@ -2762,7 +2761,6 @@ func (m *CheckThrottlerResponse_Metric) CloneVT() *CheckThrottlerResponse_Metric } r := new(CheckThrottlerResponse_Metric) r.Name = m.Name - r.StatusCode = m.StatusCode r.Value = m.Value r.Threshold = m.Threshold r.Error = m.Error @@ -2785,7 +2783,6 @@ func (m *CheckThrottlerResponse) CloneVT() *CheckThrottlerResponse { return (*CheckThrottlerResponse)(nil) } r := new(CheckThrottlerResponse) - r.StatusCode = m.StatusCode r.Value = m.Value r.Threshold = m.Threshold r.Error = m.Error @@ -2870,7 +2867,6 @@ func (m *GetThrottlerStatusResponse_RecentApp) CloneVT() *GetThrottlerStatusResp } r := new(GetThrottlerStatusResponse_RecentApp) r.CheckedAt = m.CheckedAt.CloneVT() - r.StatusCode = m.StatusCode r.ResponseCode = m.ResponseCode if len(m.unknownFields) > 0 { r.unknownFields = make([]byte, len(m.unknownFields)) @@ -9725,16 +9721,6 @@ func (m *CheckThrottlerRequest) MarshalToSizedBufferVT(dAtA []byte) (int, error) i -= len(m.unknownFields) copy(dAtA[i:], m.unknownFields) } - if m.MultiMetricsEnabled { - i-- - if m.MultiMetricsEnabled { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x28 - } if m.OkIfNotExists { i-- if m.OkIfNotExists { @@ -9840,11 +9826,6 @@ func (m *CheckThrottlerResponse_Metric) MarshalToSizedBufferVT(dAtA []byte) (int i-- dAtA[i] = 0x19 } - if m.StatusCode != 0 { - i = protohelpers.EncodeVarint(dAtA, i, uint64(m.StatusCode)) - i-- - dAtA[i] = 0x10 - } if len(m.Name) > 0 { i -= len(m.Name) copy(dAtA[i:], m.Name) @@ -9962,11 +9943,6 @@ func (m *CheckThrottlerResponse) MarshalToSizedBufferVT(dAtA []byte) (int, error i-- dAtA[i] = 0x11 } - if m.StatusCode != 0 { - i = protohelpers.EncodeVarint(dAtA, i, uint64(m.StatusCode)) - i-- - dAtA[i] = 0x8 - } return len(dAtA) - i, nil } @@ -10132,11 +10108,6 @@ func (m *GetThrottlerStatusResponse_RecentApp) MarshalToSizedBufferVT(dAtA []byt i-- dAtA[i] = 0x18 } - if m.StatusCode != 0 { - i = protohelpers.EncodeVarint(dAtA, i, uint64(m.StatusCode)) - i-- - dAtA[i] = 0x10 - } if m.CheckedAt != nil { size, err := m.CheckedAt.MarshalToSizedBufferVT(dAtA[:i]) if err != nil { @@ -12926,9 +12897,6 @@ func (m *CheckThrottlerRequest) SizeVT() (n int) { if m.OkIfNotExists { n += 2 } - if m.MultiMetricsEnabled { - n += 2 - } n += len(m.unknownFields) return n } @@ -12943,9 +12911,6 @@ func (m *CheckThrottlerResponse_Metric) SizeVT() (n int) { if l > 0 { n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) } - if m.StatusCode != 0 { - n += 1 + protohelpers.SizeOfVarint(uint64(m.StatusCode)) - } if m.Value != 0 { n += 9 } @@ -12977,9 +12942,6 @@ func (m *CheckThrottlerResponse) SizeVT() (n int) { } var l int _ = l - if m.StatusCode != 0 { - n += 1 + protohelpers.SizeOfVarint(uint64(m.StatusCode)) - } if m.Value != 0 { n += 9 } @@ -13079,9 +13041,6 @@ func (m *GetThrottlerStatusResponse_RecentApp) SizeVT() (n int) { l = m.CheckedAt.SizeVT() n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) } - if m.StatusCode != 0 { - n += 1 + protohelpers.SizeOfVarint(uint64(m.StatusCode)) - } if m.ResponseCode != 0 { n += 1 + protohelpers.SizeOfVarint(uint64(m.ResponseCode)) } @@ -28294,26 +28253,6 @@ func (m *CheckThrottlerRequest) UnmarshalVT(dAtA []byte) error { } } m.OkIfNotExists = bool(v != 0) - case 5: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MultiMetricsEnabled", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.MultiMetricsEnabled = bool(v != 0) default: iNdEx = preIndex skippy, err := protohelpers.Skip(dAtA[iNdEx:]) @@ -28397,25 +28336,6 @@ func (m *CheckThrottlerResponse_Metric) UnmarshalVT(dAtA []byte) error { } m.Name = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field StatusCode", wireType) - } - m.StatusCode = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.StatusCode |= int32(b&0x7F) << shift - if b < 0x80 { - break - } - } case 3: if wireType != 1 { return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) @@ -28604,25 +28524,6 @@ func (m *CheckThrottlerResponse) UnmarshalVT(dAtA []byte) error { return fmt.Errorf("proto: CheckThrottlerResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field StatusCode", wireType) - } - m.StatusCode = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.StatusCode |= int32(b&0x7F) << shift - if b < 0x80 { - break - } - } case 2: if wireType != 1 { return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) @@ -29279,25 +29180,6 @@ func (m *GetThrottlerStatusResponse_RecentApp) UnmarshalVT(dAtA []byte) error { return err } iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field StatusCode", wireType) - } - m.StatusCode = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.StatusCode |= int32(b&0x7F) << shift - if b < 0x80 { - break - } - } case 3: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field ResponseCode", wireType) diff --git a/go/vt/schemamanager/tablet_executor.go b/go/vt/schemamanager/tablet_executor.go index 68270e0babc..c6befa4e743 100644 --- a/go/vt/schemamanager/tablet_executor.go +++ b/go/vt/schemamanager/tablet_executor.go @@ -249,14 +249,12 @@ func (exec *TabletExecutor) executeAlterMigrationThrottle(ctx context.Context, a throttlerConfig.ThrottledApps = make(map[string]*topodatapb.ThrottledAppRule) } if req.ThrottledApp != nil && req.ThrottledApp.Name != "" { - // TODO(shlomi) in v22: replace the following line with the commented out block - throttlerConfig.ThrottledApps[req.ThrottledApp.Name] = req.ThrottledApp - // timeNow := time.Now() - // if protoutil.TimeFromProto(req.ThrottledApp.ExpiresAt).After(timeNow) { - // throttlerConfig.ThrottledApps[req.ThrottledApp.Name] = req.ThrottledApp - // } else { - // delete(throttlerConfig.ThrottledApps, req.ThrottledApp.Name) - // } + timeNow := time.Now() + if protoutil.TimeFromProto(req.ThrottledApp.ExpiresAt).After(timeNow) { + throttlerConfig.ThrottledApps[req.ThrottledApp.Name] = req.ThrottledApp + } else { + delete(throttlerConfig.ThrottledApps, req.ThrottledApp.Name) + } } return throttlerConfig diff --git a/go/vt/vtctl/grpcvtctldserver/server.go b/go/vt/vtctl/grpcvtctldserver/server.go index e280a410e02..d31bfae21c9 100644 --- a/go/vt/vtctl/grpcvtctldserver/server.go +++ b/go/vt/vtctl/grpcvtctldserver/server.go @@ -737,7 +737,6 @@ func (s *VtctldServer) CheckThrottler(ctx context.Context, req *vtctldatapb.Chec Scope: req.Scope, SkipRequestHeartbeats: req.SkipRequestHeartbeats, OkIfNotExists: req.OkIfNotExists, - MultiMetricsEnabled: true, } r, err := s.tmc.CheckThrottler(ctx, ti.Tablet, tmReq) if err != nil { @@ -2021,9 +2020,6 @@ func (s *VtctldServer) UpdateThrottlerConfig(ctx context.Context, req *vtctldata if req.Enable && req.Disable { return nil, fmt.Errorf("--enable and --disable are mutually exclusive") } - if req.CheckAsCheckSelf && req.CheckAsCheckShard { - return nil, fmt.Errorf("--check-as-check-self and --check-as-check-shard are mutually exclusive") - } if req.MetricName != "" && !base.KnownMetricNames.Contains(base.MetricName(req.MetricName)) { return nil, fmt.Errorf("unknown metric name: %s", req.MetricName) @@ -2089,21 +2085,13 @@ func (s *VtctldServer) UpdateThrottlerConfig(ctx context.Context, req *vtctldata if req.Disable { throttlerConfig.Enabled = false } - if req.CheckAsCheckSelf { - throttlerConfig.CheckAsCheckSelf = true - } - if req.CheckAsCheckShard { - throttlerConfig.CheckAsCheckSelf = false - } if req.ThrottledApp != nil && req.ThrottledApp.Name != "" { - // TODO(shlomi) in v22: replace the following line with the commented out block - throttlerConfig.ThrottledApps[req.ThrottledApp.Name] = req.ThrottledApp - // timeNow := time.Now() - // if protoutil.TimeFromProto(req.ThrottledApp.ExpiresAt).After(timeNow) { - // throttlerConfig.ThrottledApps[req.ThrottledApp.Name] = req.ThrottledApp - // } else { - // delete(throttlerConfig.ThrottledApps, req.ThrottledApp.Name) - // } + timeNow := time.Now() + if protoutil.TimeFromProto(req.ThrottledApp.ExpiresAt).After(timeNow) { + throttlerConfig.ThrottledApps[req.ThrottledApp.Name] = req.ThrottledApp + } else { + delete(throttlerConfig.ThrottledApps, req.ThrottledApp.Name) + } } return throttlerConfig } diff --git a/go/vt/vtctl/vtctl.go b/go/vt/vtctl/vtctl.go index 1a4735b1c82..d3803d14e1a 100644 --- a/go/vt/vtctl/vtctl.go +++ b/go/vt/vtctl/vtctl.go @@ -707,7 +707,7 @@ var commands = []commandGroup{ { name: "UpdateThrottlerConfig", method: commandUpdateThrottlerConfig, - params: "[--enable|--disable] [--threshold=] [--custom-query=] [--check-as-check-self|--check-as-check-shard] [--throttle-app|unthrottle-app=] [--throttle-app-ratio=] [--throttle-app-duration=] [--throttle-app-exempt] ", + params: "[--enable|--disable] [--threshold=] [--custom-query=] [--throttle-app|unthrottle-app=] [--throttle-app-ratio=] [--throttle-app-duration=] [--throttle-app-exempt] ", help: "Update the table throttler configuration for all cells and tablets of a given keyspace", }, { @@ -3600,8 +3600,6 @@ func commandUpdateThrottlerConfig(ctx context.Context, wr *wrangler.Wrangler, su disable := subFlags.Bool("disable", false, "Disable the throttler") threshold := subFlags.Float64("threshold", 0, "threshold for the either default check (replication lag seconds) or custom check") customQuery := subFlags.String("custom-query", "", "custom throttler check query") - checkAsCheckSelf := subFlags.Bool("check-as-check-self", false, "/throttler/check requests behave as is /throttler/check-self was called") - checkAsCheckShard := subFlags.Bool("check-as-check-shard", false, "use standard behavior for /throttler/check requests") unthrottledApp := subFlags.String("unthrottle-app", "", "an app name to unthrottle") throttledApp := subFlags.String("throttle-app", "", "an app name to throttle") throttledAppRatio := subFlags.Float64("throttle-app-ratio", throttle.DefaultThrottleRatio, "ratio to throttle app (app specififed in --throttled-app)") @@ -3617,9 +3615,6 @@ func commandUpdateThrottlerConfig(ctx context.Context, wr *wrangler.Wrangler, su if *enable && *disable { return fmt.Errorf("--enable and --disable are mutually exclusive") } - if *checkAsCheckSelf && *checkAsCheckShard { - return fmt.Errorf("--check-as-check-self and --check-as-check-shard are mutually exclusive") - } if *throttledApp != "" && *unthrottledApp != "" { return fmt.Errorf("--throttle-app and --unthrottle-app are mutually exclusive") @@ -3637,14 +3632,12 @@ func commandUpdateThrottlerConfig(ctx context.Context, wr *wrangler.Wrangler, su keyspace := subFlags.Arg(0) req := &vtctldatapb.UpdateThrottlerConfigRequest{ - Keyspace: keyspace, - Enable: *enable, - Disable: *disable, - CustomQuery: *customQuery, - CustomQuerySet: customQuerySet, - Threshold: *threshold, - CheckAsCheckSelf: *checkAsCheckSelf, - CheckAsCheckShard: *checkAsCheckShard, + Keyspace: keyspace, + Enable: *enable, + Disable: *disable, + CustomQuery: *customQuery, + CustomQuerySet: customQuerySet, + Threshold: *threshold, } if *throttledApp != "" { req.ThrottledApp = &topodatapb.ThrottledAppRule{ diff --git a/go/vt/vtgate/vcursor_impl.go b/go/vt/vtgate/vcursor_impl.go index e9b1d3d7712..b916f171e05 100644 --- a/go/vt/vtgate/vcursor_impl.go +++ b/go/vt/vtgate/vcursor_impl.go @@ -30,6 +30,7 @@ import ( "vitess.io/vitess/go/mysql/collations" "vitess.io/vitess/go/mysql/config" "vitess.io/vitess/go/mysql/sqlerror" + "vitess.io/vitess/go/protoutil" "vitess.io/vitess/go/sqltypes" "vitess.io/vitess/go/vt/callerid" "vitess.io/vitess/go/vt/discovery" @@ -1343,14 +1344,12 @@ func (vc *vcursorImpl) ThrottleApp(ctx context.Context, throttledAppRule *topoda throttlerConfig.ThrottledApps = make(map[string]*topodatapb.ThrottledAppRule) } if req.ThrottledApp != nil && req.ThrottledApp.Name != "" { - // TODO(shlomi) in v22: replace the following line with the commented out block - throttlerConfig.ThrottledApps[req.ThrottledApp.Name] = req.ThrottledApp - // timeNow := time.Now() - // if protoutil.TimeFromProto(req.ThrottledApp.ExpiresAt).After(timeNow) { - // throttlerConfig.ThrottledApps[req.ThrottledApp.Name] = req.ThrottledApp - // } else { - // delete(throttlerConfig.ThrottledApps, req.ThrottledApp.Name) - // } + timeNow := time.Now() + if protoutil.TimeFromProto(req.ThrottledApp.ExpiresAt).After(timeNow) { + throttlerConfig.ThrottledApps[req.ThrottledApp.Name] = req.ThrottledApp + } else { + delete(throttlerConfig.ThrottledApps, req.ThrottledApp.Name) + } } return throttlerConfig } diff --git a/go/vt/vttablet/grpctmclient/client_test.go b/go/vt/vttablet/grpctmclient/client_test.go index 2a5ae3ff6d0..9c3638461ba 100644 --- a/go/vt/vttablet/grpctmclient/client_test.go +++ b/go/vt/vttablet/grpctmclient/client_test.go @@ -76,7 +76,7 @@ func TestDialDedicatedPool(t *testing.T) { ctx, cancel := context.WithTimeout(ctx, time.Second) defer cancel() - req := &tabletmanagerdatapb.CheckThrottlerRequest{MultiMetricsEnabled: true} + req := &tabletmanagerdatapb.CheckThrottlerRequest{} _, err := client.CheckThrottler(ctx, tablet, req) assert.Error(t, err) }) @@ -141,7 +141,7 @@ func TestDialPool(t *testing.T) { ctx, cancel := context.WithTimeout(ctx, time.Second) defer cancel() - req := &tabletmanagerdatapb.CheckThrottlerRequest{MultiMetricsEnabled: true} + req := &tabletmanagerdatapb.CheckThrottlerRequest{} _, err := client.CheckThrottler(ctx, tablet, req) assert.Error(t, err) }) diff --git a/go/vt/vttablet/tabletmanager/rpc_throttler.go b/go/vt/vttablet/tabletmanager/rpc_throttler.go index 1617a5b275b..734ae0172ed 100644 --- a/go/vt/vttablet/tabletmanager/rpc_throttler.go +++ b/go/vt/vttablet/tabletmanager/rpc_throttler.go @@ -47,15 +47,13 @@ func (tm *TabletManager) CheckThrottler(ctx context.Context, req *tabletmanagerd Scope: base.Scope(req.Scope), SkipRequestHeartbeats: req.SkipRequestHeartbeats, OKIfNotExists: req.OkIfNotExists, - MultiMetricsEnabled: req.MultiMetricsEnabled, } checkResult := tm.QueryServiceControl.CheckThrottler(ctx, req.AppName, flags) if checkResult == nil { return nil, vterrors.Errorf(vtrpc.Code_INTERNAL, "nil checkResult") } resp := &tabletmanagerdatapb.CheckThrottlerResponse{ - ResponseCode: throttle.ResponseCodeFromStatus(checkResult.ResponseCode, checkResult.StatusCode), - StatusCode: int32(checkResult.StatusCode), + ResponseCode: checkResult.ResponseCode, Value: checkResult.Value, Threshold: checkResult.Threshold, Message: checkResult.Message, @@ -68,8 +66,7 @@ func (tm *TabletManager) CheckThrottler(ctx context.Context, req *tabletmanagerd resp.Metrics[name] = &tabletmanagerdatapb.CheckThrottlerResponse_Metric{ Name: name, Scope: metric.Scope, - StatusCode: int32(metric.StatusCode), - ResponseCode: throttle.ResponseCodeFromStatus(metric.ResponseCode, metric.StatusCode), + ResponseCode: metric.ResponseCode, Value: metric.Value, Threshold: metric.Threshold, Message: metric.Message, @@ -79,8 +76,7 @@ func (tm *TabletManager) CheckThrottler(ctx context.Context, req *tabletmanagerd // For backwards compatibility, when the checked tablet is of lower version, it does not return a // matrics map, but only the one metric. resp.Metrics[base.DefaultMetricName.String()] = &tabletmanagerdatapb.CheckThrottlerResponse_Metric{ - StatusCode: int32(checkResult.StatusCode), - ResponseCode: throttle.ResponseCodeFromStatus(checkResult.ResponseCode, checkResult.StatusCode), + ResponseCode: checkResult.ResponseCode, Value: checkResult.Value, Threshold: checkResult.Threshold, Message: checkResult.Message, @@ -145,7 +141,6 @@ func (tm *TabletManager) GetThrottlerStatus(ctx context.Context, req *tabletmana for _, recentApp := range status.RecentApps { resp.RecentApps[recentApp.AppName] = &tabletmanagerdatapb.GetThrottlerStatusResponse_RecentApp{ CheckedAt: protoutil.TimeToProto(recentApp.CheckedAt), - StatusCode: int32(recentApp.StatusCode), ResponseCode: recentApp.ResponseCode, } } diff --git a/go/vt/vttablet/tabletserver/tabletserver.go b/go/vt/vttablet/tabletserver/tabletserver.go index 847de25eb02..ac52a92a9f4 100644 --- a/go/vt/vttablet/tabletserver/tabletserver.go +++ b/go/vt/vttablet/tabletserver/tabletserver.go @@ -1911,19 +1911,32 @@ func (tsv *TabletServer) registerThrottlerCheckHandlers() { flags := &throttle.CheckFlags{ Scope: scope, SkipRequestHeartbeats: (r.URL.Query().Get("s") == "true"), - MultiMetricsEnabled: true, } metricNames := tsv.lagThrottler.MetricNames(r.URL.Query()["m"]) checkResult := tsv.lagThrottler.Check(ctx, appName, metricNames, flags) if checkResult.ResponseCode == tabletmanagerdatapb.CheckThrottlerResponseCode_UNKNOWN_METRIC && flags.OKIfNotExists { - checkResult.StatusCode = http.StatusOK // 200 checkResult.ResponseCode = tabletmanagerdatapb.CheckThrottlerResponseCode_OK } if r.Method == http.MethodGet { w.Header().Set("Content-Type", "application/json") } - w.WriteHeader(checkResult.StatusCode) + var httpStatusCode int + switch checkResult.ResponseCode { + case tabletmanagerdatapb.CheckThrottlerResponseCode_OK: + httpStatusCode = http.StatusOK + case tabletmanagerdatapb.CheckThrottlerResponseCode_APP_DENIED: + httpStatusCode = http.StatusExpectationFailed + case tabletmanagerdatapb.CheckThrottlerResponseCode_THRESHOLD_EXCEEDED: + httpStatusCode = http.StatusTooManyRequests + case tabletmanagerdatapb.CheckThrottlerResponseCode_UNKNOWN_METRIC: + httpStatusCode = http.StatusNotFound + case tabletmanagerdatapb.CheckThrottlerResponseCode_INTERNAL_ERROR: + httpStatusCode = http.StatusInternalServerError + default: + httpStatusCode = http.StatusInternalServerError + } + w.WriteHeader(httpStatusCode) if r.Method == http.MethodGet { json.NewEncoder(w).Encode(checkResult) } diff --git a/go/vt/vttablet/tabletserver/throttle/base/recent_app.go b/go/vt/vttablet/tabletserver/throttle/base/recent_app.go index 7ae2bf789af..b8756ffee5b 100644 --- a/go/vt/vttablet/tabletserver/throttle/base/recent_app.go +++ b/go/vt/vttablet/tabletserver/throttle/base/recent_app.go @@ -50,16 +50,14 @@ import ( type RecentApp struct { AppName string CheckedAt time.Time - StatusCode int ResponseCode tabletmanagerdatapb.CheckThrottlerResponseCode } // NewRecentApp creates a RecentApp -func NewRecentApp(appName string, statusCode int, responseCode tabletmanagerdatapb.CheckThrottlerResponseCode) *RecentApp { +func NewRecentApp(appName string, responseCode tabletmanagerdatapb.CheckThrottlerResponseCode) *RecentApp { result := &RecentApp{ AppName: appName, CheckedAt: time.Now(), - StatusCode: statusCode, ResponseCode: responseCode, } return result diff --git a/go/vt/vttablet/tabletserver/throttle/base/self_metric_loadavg.go b/go/vt/vttablet/tabletserver/throttle/base/self_metric_loadavg.go index 40a2878421a..dbd9aa69f19 100644 --- a/go/vt/vttablet/tabletserver/throttle/base/self_metric_loadavg.go +++ b/go/vt/vttablet/tabletserver/throttle/base/self_metric_loadavg.go @@ -27,13 +27,6 @@ import ( "vitess.io/vitess/go/vt/vttablet/tabletserver/connpool" ) -var ( - loadavgOnlyAvailableOnLinuxMetric = &ThrottleMetric{ - Scope: SelfScope, - Err: fmt.Errorf("loadavg metric is only available on Linux"), - } -) - var _ SelfMetric = registerSelfMetric(&LoadAvgSelfMetric{}) type LoadAvgSelfMetric struct { @@ -56,12 +49,12 @@ func (m *LoadAvgSelfMetric) RequiresConn() bool { } func (m *LoadAvgSelfMetric) Read(ctx context.Context, throttler ThrottlerMetricsPublisher, conn *connpool.Conn) *ThrottleMetric { - if runtime.GOOS != "linux" { - return loadavgOnlyAvailableOnLinuxMetric - } metric := &ThrottleMetric{ Scope: SelfScope, } + if runtime.GOOS != "linux" { + return metric + } { content, err := os.ReadFile("/proc/loadavg") if err != nil { diff --git a/go/vt/vttablet/tabletserver/throttle/check.go b/go/vt/vttablet/tabletserver/throttle/check.go index ccdfcb2ce23..4b78410b170 100644 --- a/go/vt/vttablet/tabletserver/throttle/check.go +++ b/go/vt/vttablet/tabletserver/throttle/check.go @@ -44,7 +44,6 @@ package throttle import ( "context" "fmt" - "net/http" "time" "vitess.io/vitess/go/stats" @@ -71,13 +70,10 @@ type CheckFlags struct { OverrideThreshold float64 OKIfNotExists bool SkipRequestHeartbeats bool - MultiMetricsEnabled bool } // selfCheckFlags have no special hints -var selfCheckFlags = &CheckFlags{ - MultiMetricsEnabled: true, -} +var selfCheckFlags = &CheckFlags{} // ThrottlerCheck provides methods for an app checking on metrics type ThrottlerCheck struct { @@ -102,42 +98,34 @@ func (check *ThrottlerCheck) checkAppMetricResult(ctx context.Context, appName s } value, err := metricResult.Get() if appName == "" { - return NewCheckResult(tabletmanagerdatapb.CheckThrottlerResponseCode_APP_DENIED, http.StatusExpectationFailed, value, threshold, "", fmt.Errorf("no app indicated")) + return NewCheckResult(tabletmanagerdatapb.CheckThrottlerResponseCode_APP_DENIED, value, threshold, "", fmt.Errorf("no app indicated")) } - var statusCode int var responseCode tabletmanagerdatapb.CheckThrottlerResponseCode - switch { case err == base.ErrAppDenied: // app specifically not allowed to get metrics - statusCode = http.StatusExpectationFailed // 417 responseCode = tabletmanagerdatapb.CheckThrottlerResponseCode_APP_DENIED case err == base.ErrNoSuchMetric: // not collected yet, or metric does not exist - statusCode = http.StatusNotFound // 404 responseCode = tabletmanagerdatapb.CheckThrottlerResponseCode_UNKNOWN_METRIC case err != nil: // any error - statusCode = http.StatusInternalServerError // 500 responseCode = tabletmanagerdatapb.CheckThrottlerResponseCode_INTERNAL_ERROR case value > threshold: // casual throttling - statusCode = http.StatusTooManyRequests // 429 responseCode = tabletmanagerdatapb.CheckThrottlerResponseCode_THRESHOLD_EXCEEDED err = base.ErrThresholdExceeded default: // all good! - statusCode = http.StatusOK // 200 responseCode = tabletmanagerdatapb.CheckThrottlerResponseCode_OK } - return NewCheckResult(responseCode, statusCode, value, threshold, matchedApp, err) + return NewCheckResult(responseCode, value, threshold, matchedApp, err) } // Check is the core function that runs when a user wants to check a metric func (check *ThrottlerCheck) Check(ctx context.Context, appName string, scope base.Scope, metricNames base.MetricNames, flags *CheckFlags) (checkResult *CheckResult) { checkResult = &CheckResult{ - StatusCode: http.StatusOK, ResponseCode: tabletmanagerdatapb.CheckThrottlerResponseCode_OK, Metrics: make(map[string]*MetricResult), } @@ -146,7 +134,6 @@ func (check *ThrottlerCheck) Check(ctx context.Context, appName string, scope ba } metricNames = metricNames.Unique() applyMetricToCheckResult := func(metricName base.MetricName, metric *MetricResult) { - checkResult.StatusCode = metric.StatusCode checkResult.ResponseCode = metric.ResponseCode checkResult.Value = metric.Value checkResult.Threshold = metric.Threshold @@ -198,7 +185,6 @@ func (check *ThrottlerCheck) Check(ctx context.Context, appName string, scope ba checkResult.RecentlyChecked = true } metric := &MetricResult{ - StatusCode: metricCheckResult.StatusCode, ResponseCode: metricCheckResult.ResponseCode, Value: metricCheckResult.Value, Threshold: metricCheckResult.Threshold, @@ -208,11 +194,8 @@ func (check *ThrottlerCheck) Check(ctx context.Context, appName string, scope ba Scope: metricScope.String(), // This reports back the actual scope used for the check } checkResult.Metrics[metricName.String()] = metric - if flags.MultiMetricsEnabled && !metricCheckResult.IsOK() && metricName != base.DefaultMetricName { + if !metricCheckResult.IsOK() && metricName != base.DefaultMetricName { // If we're checking multiple metrics, and one of them fails, we should return any of the failing metric. - // For backwards compatibility, if flags.MultiMetricsEnabled is not set, we do not report back failing - // metrics, because a v20 primary would not know how to deal with it, and is not expecting any of those - // metrics. // The only metric we ever report back is the default metric, see below. applyMetricToCheckResult(metricName, metric) } @@ -233,7 +216,7 @@ func (check *ThrottlerCheck) Check(ctx context.Context, appName string, scope ba statsThrottlerCheckAnyError.Add(1) } }(checkResult) - go check.throttler.markRecentApp(appName, checkResult.StatusCode, checkResult.ResponseCode) + go check.throttler.markRecentApp(appName, checkResult.ResponseCode) return checkResult } diff --git a/go/vt/vttablet/tabletserver/throttle/check_result.go b/go/vt/vttablet/tabletserver/throttle/check_result.go index 34532b7ce37..b26bf87e3b3 100644 --- a/go/vt/vttablet/tabletserver/throttle/check_result.go +++ b/go/vt/vttablet/tabletserver/throttle/check_result.go @@ -43,38 +43,13 @@ package throttle import ( "fmt" - "net/http" tabletmanagerdatapb "vitess.io/vitess/go/vt/proto/tabletmanagerdata" "vitess.io/vitess/go/vt/vttablet/tabletserver/throttle/base" ) -// ResponseCodeFromStatus returns a ResponseCode based on either given response code or HTTP status code. -// It is used to handle the transition period from v20 to v21 where v20 only returns HTTP status code. -// In v22 and beyond, the HTTP status code will be removed, and so will this function. -func ResponseCodeFromStatus(responseCode tabletmanagerdatapb.CheckThrottlerResponseCode, statusCode int) tabletmanagerdatapb.CheckThrottlerResponseCode { - if responseCode != tabletmanagerdatapb.CheckThrottlerResponseCode_UNDEFINED { - return responseCode - } - switch statusCode { - case http.StatusOK: - return tabletmanagerdatapb.CheckThrottlerResponseCode_OK - case http.StatusExpectationFailed: - return tabletmanagerdatapb.CheckThrottlerResponseCode_APP_DENIED - case http.StatusTooManyRequests: - return tabletmanagerdatapb.CheckThrottlerResponseCode_THRESHOLD_EXCEEDED - case http.StatusNotFound: - return tabletmanagerdatapb.CheckThrottlerResponseCode_UNKNOWN_METRIC - case http.StatusInternalServerError: - return tabletmanagerdatapb.CheckThrottlerResponseCode_INTERNAL_ERROR - default: - return tabletmanagerdatapb.CheckThrottlerResponseCode_UNDEFINED - } -} - type MetricResult struct { ResponseCode tabletmanagerdatapb.CheckThrottlerResponseCode `json:"ResponseCode"` - StatusCode int `json:"StatusCode"` Scope string `json:"Scope"` Value float64 `json:"Value"` Threshold float64 `json:"Threshold"` @@ -84,16 +59,12 @@ type MetricResult struct { } func (m *MetricResult) IsOK() bool { - if m.ResponseCode != tabletmanagerdatapb.CheckThrottlerResponseCode_UNDEFINED { - return m.ResponseCode == tabletmanagerdatapb.CheckThrottlerResponseCode_OK - } - return m.StatusCode == http.StatusOK + return m.ResponseCode == tabletmanagerdatapb.CheckThrottlerResponseCode_OK } // CheckResult is the result for an app inquiring on a metric. It also exports as JSON via the API type CheckResult struct { ResponseCode tabletmanagerdatapb.CheckThrottlerResponseCode `json:"ResponseCode"` - StatusCode int `json:"StatusCode"` Value float64 `json:"Value"` Threshold float64 `json:"Threshold"` Error error `json:"-"` @@ -106,10 +77,9 @@ type CheckResult struct { } // NewCheckResult returns a CheckResult -func NewCheckResult(responseCode tabletmanagerdatapb.CheckThrottlerResponseCode, statusCode int, value float64, threshold float64, appName string, err error) *CheckResult { +func NewCheckResult(responseCode tabletmanagerdatapb.CheckThrottlerResponseCode, value float64, threshold float64, appName string, err error) *CheckResult { result := &CheckResult{ ResponseCode: responseCode, - StatusCode: statusCode, Value: value, Threshold: threshold, AppName: appName, @@ -122,15 +92,12 @@ func NewCheckResult(responseCode tabletmanagerdatapb.CheckThrottlerResponseCode, } func (c *CheckResult) IsOK() bool { - if c.ResponseCode != tabletmanagerdatapb.CheckThrottlerResponseCode_UNDEFINED { - return c.ResponseCode == tabletmanagerdatapb.CheckThrottlerResponseCode_OK - } - return c.StatusCode == http.StatusOK + return c.ResponseCode == tabletmanagerdatapb.CheckThrottlerResponseCode_OK } // Summary returns a human-readable summary of the check result func (c *CheckResult) Summary() string { - switch ResponseCodeFromStatus(c.ResponseCode, c.StatusCode) { + switch c.ResponseCode { case tabletmanagerdatapb.CheckThrottlerResponseCode_OK: return fmt.Sprintf("%s is granted access", c.AppName) case tabletmanagerdatapb.CheckThrottlerResponseCode_APP_DENIED: @@ -149,11 +116,11 @@ func (c *CheckResult) Summary() string { } // NewErrorCheckResult returns a check result that indicates an error -func NewErrorCheckResult(responseCode tabletmanagerdatapb.CheckThrottlerResponseCode, statusCode int, err error) *CheckResult { - return NewCheckResult(responseCode, statusCode, 0, 0, "", err) +func NewErrorCheckResult(responseCode tabletmanagerdatapb.CheckThrottlerResponseCode, err error) *CheckResult { + return NewCheckResult(responseCode, 0, 0, "", err) } // NoSuchMetricCheckResult is a result returns when a metric is unknown -var NoSuchMetricCheckResult = NewErrorCheckResult(tabletmanagerdatapb.CheckThrottlerResponseCode_UNKNOWN_METRIC, http.StatusNotFound, base.ErrNoSuchMetric) +var NoSuchMetricCheckResult = NewErrorCheckResult(tabletmanagerdatapb.CheckThrottlerResponseCode_UNKNOWN_METRIC, base.ErrNoSuchMetric) -var okMetricCheckResult = NewCheckResult(tabletmanagerdatapb.CheckThrottlerResponseCode_OK, http.StatusOK, 0, 0, "", nil) +var okMetricCheckResult = NewCheckResult(tabletmanagerdatapb.CheckThrottlerResponseCode_OK, 0, 0, "", nil) diff --git a/go/vt/vttablet/tabletserver/throttle/check_result_test.go b/go/vt/vttablet/tabletserver/throttle/check_result_test.go index fdb0ee600ba..6a550666360 100644 --- a/go/vt/vttablet/tabletserver/throttle/check_result_test.go +++ b/go/vt/vttablet/tabletserver/throttle/check_result_test.go @@ -17,7 +17,6 @@ limitations under the License. package throttle import ( - "net/http" "testing" "github.com/stretchr/testify/assert" @@ -25,56 +24,6 @@ import ( tabletmanagerdatapb "vitess.io/vitess/go/vt/proto/tabletmanagerdata" ) -func TestReponseCodeFromStatus(t *testing.T) { - tcases := []struct { - responseCode tabletmanagerdatapb.CheckThrottlerResponseCode - statusCode int - expect tabletmanagerdatapb.CheckThrottlerResponseCode - }{ - { - tabletmanagerdatapb.CheckThrottlerResponseCode_UNDEFINED, - http.StatusOK, - tabletmanagerdatapb.CheckThrottlerResponseCode_OK, - }, - { - tabletmanagerdatapb.CheckThrottlerResponseCode_UNDEFINED, - http.StatusExpectationFailed, - tabletmanagerdatapb.CheckThrottlerResponseCode_APP_DENIED, - }, - { - tabletmanagerdatapb.CheckThrottlerResponseCode_UNDEFINED, - http.StatusNotFound, - tabletmanagerdatapb.CheckThrottlerResponseCode_UNKNOWN_METRIC, - }, - { - tabletmanagerdatapb.CheckThrottlerResponseCode_UNDEFINED, - http.StatusInternalServerError, - tabletmanagerdatapb.CheckThrottlerResponseCode_INTERNAL_ERROR, - }, - { - tabletmanagerdatapb.CheckThrottlerResponseCode_UNDEFINED, - http.StatusTooManyRequests, - tabletmanagerdatapb.CheckThrottlerResponseCode_THRESHOLD_EXCEEDED, - }, - { - tabletmanagerdatapb.CheckThrottlerResponseCode_THRESHOLD_EXCEEDED, - http.StatusTooManyRequests, - tabletmanagerdatapb.CheckThrottlerResponseCode_THRESHOLD_EXCEEDED, - }, - { - tabletmanagerdatapb.CheckThrottlerResponseCode_THRESHOLD_EXCEEDED, - http.StatusOK, - tabletmanagerdatapb.CheckThrottlerResponseCode_THRESHOLD_EXCEEDED, - }, - } - for _, tcase := range tcases { - t.Run("", func(t *testing.T) { - result := ResponseCodeFromStatus(tcase.responseCode, tcase.statusCode) - assert.Equal(t, tcase.expect, result) - }) - } -} - func TestCheckResultSummary(t *testing.T) { tcases := []struct { checkResult *CheckResult @@ -84,31 +33,6 @@ func TestCheckResultSummary(t *testing.T) { checkResult: &CheckResult{}, summary: "", }, - { - checkResult: &CheckResult{ - StatusCode: http.StatusOK, - AppName: "test", - }, - summary: "test is granted access", - }, - { - checkResult: &CheckResult{ - StatusCode: http.StatusTooManyRequests, - AppName: "test", - MetricName: "bugginess", - Threshold: 100, - Value: 200, - Scope: "self", - }, - summary: "test is denied access due to self/bugginess metric value 200 exceeding threshold 100", - }, - { - checkResult: &CheckResult{ - StatusCode: http.StatusExpectationFailed, - AppName: "test", - }, - summary: "test is explicitly denied access", - }, { checkResult: &CheckResult{ ResponseCode: tabletmanagerdatapb.CheckThrottlerResponseCode_OK, diff --git a/go/vt/vttablet/tabletserver/throttle/client.go b/go/vt/vttablet/tabletserver/throttle/client.go index 8549fb099b6..f0f45341a16 100644 --- a/go/vt/vttablet/tabletserver/throttle/client.go +++ b/go/vt/vttablet/tabletserver/throttle/client.go @@ -70,8 +70,7 @@ func NewBackgroundClient(throttler *Throttler, appName throttlerapp.Name, scope throttler: throttler, appName: appName, flags: CheckFlags{ - Scope: scope, - MultiMetricsEnabled: true, + Scope: scope, }, lastSuccessfulThrottle: make(map[string]int64), } diff --git a/go/vt/vttablet/tabletserver/throttle/throttler.go b/go/vt/vttablet/tabletserver/throttle/throttler.go index af7f59abb7e..70d7ad7ab62 100644 --- a/go/vt/vttablet/tabletserver/throttle/throttler.go +++ b/go/vt/vttablet/tabletserver/throttle/throttler.go @@ -47,7 +47,6 @@ import ( "fmt" "math" "math/rand/v2" - "net/http" "strings" "sync" "sync/atomic" @@ -175,7 +174,6 @@ type Throttler struct { customMetricsQuery atomic.Value MetricsThreshold atomic.Uint64 - checkAsCheckSelf atomic.Bool metricThresholds *cache.Cache aggregatedMetrics *cache.Cache @@ -428,7 +426,6 @@ func (throttler *Throttler) applyThrottlerConfig(ctx context.Context, throttlerC // require per-metric threshold. throttler.StoreMetricsThreshold(throttlerConfig.Threshold) } - throttler.checkAsCheckSelf.Store(throttlerConfig.CheckAsCheckSelf) { // Throttled apps/rules for _, appRule := range throttlerConfig.ThrottledApps { @@ -898,7 +895,7 @@ func (throttler *Throttler) generateTabletProbeFunction(scope base.Scope, tmClie } metrics := make(base.ThrottleMetrics) - req := &tabletmanagerdatapb.CheckThrottlerRequest{MultiMetricsEnabled: true} // We leave AppName empty; it will default to VitessName anyway, and we can save some proto space + req := &tabletmanagerdatapb.CheckThrottlerRequest{} // We leave AppName empty; it will default to VitessName anyway, and we can save some proto space resp, gRPCErr := tmClient.CheckThrottler(ctx, probe.Tablet, req) if gRPCErr != nil { return metricsWithError(fmt.Errorf("gRPC error accessing tablet %v. Err=%v", probe.Alias, gRPCErr)) @@ -907,9 +904,6 @@ func (throttler *Throttler) generateTabletProbeFunction(scope base.Scope, tmClie if resp.ResponseCode == tabletmanagerdatapb.CheckThrottlerResponseCode_INTERNAL_ERROR { throttleMetric.Err = fmt.Errorf("response code: %d", resp.ResponseCode) } - if resp.StatusCode == http.StatusInternalServerError { - throttleMetric.Err = fmt.Errorf("status code: %d", resp.StatusCode) - } if resp.RecentlyChecked { // We have just probed a tablet, and it reported back that someone just recently "check"ed it. // We therefore renew the heartbeats lease. @@ -1388,8 +1382,8 @@ func (throttler *Throttler) ThrottledAppsMap() (result map[string](*base.AppThro } // markRecentApp takes note that an app has just asked about throttling, making it "recent" -func (throttler *Throttler) markRecentApp(appName string, statusCode int, responseCode tabletmanagerdatapb.CheckThrottlerResponseCode) { - recentApp := base.NewRecentApp(appName, statusCode, responseCode) +func (throttler *Throttler) markRecentApp(appName string, responseCode tabletmanagerdatapb.CheckThrottlerResponseCode) { + recentApp := base.NewRecentApp(appName, responseCode) throttler.recentApps.Set(appName, recentApp, cache.DefaultExpiration) } @@ -1526,9 +1520,6 @@ func (throttler *Throttler) Check(ctx context.Context, appName string, metricNam if flags != nil { scope = flags.Scope } - if scope == base.ShardScope && throttler.checkAsCheckSelf.Load() { - scope = base.SelfScope - } return throttler.checkScope(ctx, appName, scope, metricNames, flags) } diff --git a/go/vt/vttablet/tabletserver/throttle/throttler_test.go b/go/vt/vttablet/tabletserver/throttle/throttler_test.go index fd7921899da..3061b25b405 100644 --- a/go/vt/vttablet/tabletserver/throttle/throttler_test.go +++ b/go/vt/vttablet/tabletserver/throttle/throttler_test.go @@ -20,7 +20,6 @@ import ( "context" "fmt" "math" - "net/http" "sync" "sync/atomic" "testing" @@ -74,22 +73,18 @@ var ( } replicaMetrics = map[string]*MetricResult{ base.LagMetricName.String(): { - StatusCode: http.StatusOK, ResponseCode: tabletmanagerdatapb.CheckThrottlerResponseCode_OK, Value: 0.9, }, base.ThreadsRunningMetricName.String(): { - StatusCode: http.StatusOK, ResponseCode: tabletmanagerdatapb.CheckThrottlerResponseCode_OK, Value: 13, }, base.CustomMetricName.String(): { - StatusCode: http.StatusOK, ResponseCode: tabletmanagerdatapb.CheckThrottlerResponseCode_OK, Value: 14, }, base.LoadAvgMetricName.String(): { - StatusCode: http.StatusOK, ResponseCode: tabletmanagerdatapb.CheckThrottlerResponseCode_OK, Value: 5.1, }, @@ -105,7 +100,6 @@ const ( type fakeTMClient struct { tmclient.TabletManagerClient appNames []string - v20 atomic.Bool // help validate v20 backwards compatibility mu sync.Mutex } @@ -115,18 +109,16 @@ func (c *fakeTMClient) Close() { func (c *fakeTMClient) CheckThrottler(ctx context.Context, tablet *topodatapb.Tablet, request *tabletmanagerdatapb.CheckThrottlerRequest) (*tabletmanagerdatapb.CheckThrottlerResponse, error) { resp := &tabletmanagerdatapb.CheckThrottlerResponse{ - StatusCode: http.StatusOK, + ResponseCode: tabletmanagerdatapb.CheckThrottlerResponseCode_OK, Value: 0.339, Threshold: 1, RecentlyChecked: false, } - if !c.v20.Load() { - resp.ResponseCode = tabletmanagerdatapb.CheckThrottlerResponseCode_OK + { resp.Metrics = make(map[string]*tabletmanagerdatapb.CheckThrottlerResponse_Metric) for name, metric := range replicaMetrics { resp.Metrics[name] = &tabletmanagerdatapb.CheckThrottlerResponse_Metric{ Name: name, - StatusCode: int32(metric.StatusCode), ResponseCode: metric.ResponseCode, Value: metric.Value, Threshold: metric.Threshold, @@ -134,6 +126,7 @@ func (c *fakeTMClient) CheckThrottler(ctx context.Context, tablet *topodatapb.Ta } } } + c.mu.Lock() defer c.mu.Unlock() c.appNames = append(c.appNames, request.AppName) @@ -422,13 +415,11 @@ func TestApplyThrottlerConfigMetricThresholds(t *testing.T) { flags := &CheckFlags{ Scope: base.SelfScope, SkipRequestHeartbeats: true, - MultiMetricsEnabled: true, } t.Run("check before apply", func(t *testing.T) { checkResult := throttler.Check(ctx, testAppName.String(), nil, flags) require.NotNil(t, checkResult) assert.EqualValues(t, 0.3, checkResult.Value) // self lag value - assert.EqualValues(t, http.StatusOK, checkResult.StatusCode) assert.EqualValues(t, tabletmanagerdatapb.CheckThrottlerResponseCode_OK, checkResult.ResponseCode) assert.Len(t, checkResult.Metrics, 1) assert.Contains(t, checkResult.Summary(), testAppName.String()+" is granted access") @@ -452,7 +443,6 @@ func TestApplyThrottlerConfigMetricThresholds(t *testing.T) { checkResult := throttler.Check(ctx, testAppName.String(), nil, flags) require.NotNil(t, checkResult) assert.EqualValues(t, 0.3, checkResult.Value, "unexpected result: %+v", checkResult) // self lag value - assert.NotEqualValues(t, http.StatusOK, checkResult.StatusCode, "unexpected result: %+v", checkResult) assert.NotEqualValues(t, tabletmanagerdatapb.CheckThrottlerResponseCode_OK, checkResult.ResponseCode, "unexpected result: %+v", checkResult) assert.Len(t, checkResult.Metrics, 1) assert.Contains(t, checkResult.Summary(), testAppName.String()+" is denied access due to self/lag metric value") @@ -477,7 +467,6 @@ func TestApplyThrottlerConfigMetricThresholds(t *testing.T) { checkResult := throttler.Check(ctx, testAppName.String(), nil, flags) require.NotNil(t, checkResult) assert.EqualValues(t, 0.3, checkResult.Value, "unexpected result: %+v", checkResult) // self lag value - assert.EqualValues(t, http.StatusOK, checkResult.StatusCode, "unexpected result: %+v", checkResult) assert.EqualValues(t, tabletmanagerdatapb.CheckThrottlerResponseCode_OK, checkResult.ResponseCode, "unexpected result: %+v", checkResult) assert.Len(t, checkResult.Metrics, 1) assert.Contains(t, checkResult.Summary(), testAppName.String()+" is granted access") @@ -524,7 +513,6 @@ func TestApplyThrottlerConfigAppCheckedMetrics(t *testing.T) { } flags := &CheckFlags{ SkipRequestHeartbeats: true, - MultiMetricsEnabled: true, } throttlerConfig := &topodatapb.ThrottlerConfig{ Enabled: true, @@ -536,7 +524,6 @@ func TestApplyThrottlerConfigAppCheckedMetrics(t *testing.T) { checkResult := throttler.Check(ctx, testAppName.String(), nil, flags) require.NotNil(t, checkResult) assert.EqualValues(t, 0.9, checkResult.Value) // shard lag value - assert.NotEqualValues(t, http.StatusOK, checkResult.StatusCode) assert.NotEqualValues(t, tabletmanagerdatapb.CheckThrottlerResponseCode_OK, checkResult.ResponseCode) assert.Len(t, checkResult.Metrics, 1) assert.Contains(t, checkResult.Summary(), testAppName.String()+" is denied access due to shard/lag metric value") @@ -552,7 +539,6 @@ func TestApplyThrottlerConfigAppCheckedMetrics(t *testing.T) { checkResult := throttler.Check(ctx, testAppName.String(), nil, flags) require.NotNil(t, checkResult) assert.EqualValues(t, 0.9, checkResult.Value) // self lag value - assert.EqualValues(t, http.StatusOK, checkResult.StatusCode) assert.EqualValues(t, tabletmanagerdatapb.CheckThrottlerResponseCode_OK, checkResult.ResponseCode) assert.Len(t, checkResult.Metrics, 1) assert.Contains(t, checkResult.Summary(), testAppName.String()+" is granted access") @@ -568,7 +554,6 @@ func TestApplyThrottlerConfigAppCheckedMetrics(t *testing.T) { checkResult := throttler.Check(ctx, testAppName.String(), nil, flags) require.NotNil(t, checkResult) assert.EqualValues(t, 0.9, checkResult.Value) // shard lag value - assert.EqualValues(t, http.StatusOK, checkResult.StatusCode) assert.EqualValues(t, tabletmanagerdatapb.CheckThrottlerResponseCode_OK, checkResult.ResponseCode) assert.Len(t, checkResult.Metrics, 1) assert.Contains(t, checkResult.Summary(), testAppName.String()+" is granted access") @@ -588,7 +573,6 @@ func TestApplyThrottlerConfigAppCheckedMetrics(t *testing.T) { checkResult := throttler.Check(ctx, testAppName.String(), nil, flags) require.NotNil(t, checkResult) assert.EqualValues(t, 2.718, checkResult.Value) // self loadavg value - assert.NotEqualValues(t, http.StatusOK, checkResult.StatusCode, "unexpected result: %+v", checkResult) assert.NotEqualValues(t, tabletmanagerdatapb.CheckThrottlerResponseCode_OK, checkResult.ResponseCode, "unexpected result: %+v", checkResult) assert.Len(t, checkResult.Metrics, 1) assert.Contains(t, checkResult.Summary(), testAppName.String()+" is denied access due to self/loadavg metric value") @@ -608,7 +592,6 @@ func TestApplyThrottlerConfigAppCheckedMetrics(t *testing.T) { checkResult := throttler.Check(ctx, testAppName.String(), nil, flags) require.NotNil(t, checkResult) assert.EqualValues(t, 5.1, checkResult.Value) // shard loadavg value - assert.NotEqualValues(t, http.StatusOK, checkResult.StatusCode, "unexpected result: %+v", checkResult) assert.NotEqualValues(t, tabletmanagerdatapb.CheckThrottlerResponseCode_OK, checkResult.ResponseCode, "unexpected result: %+v", checkResult) assert.Len(t, checkResult.Metrics, 1) assert.Contains(t, checkResult.Summary(), testAppName.String()+" is denied access due to shard/loadavg metric value") @@ -627,7 +610,6 @@ func TestApplyThrottlerConfigAppCheckedMetrics(t *testing.T) { checkResult := throttler.Check(ctx, testAppName.String(), nil, flags) require.NotNil(t, checkResult) assert.EqualValues(t, 2.718, checkResult.Value) // self loadavg value - assert.NotEqualValues(t, http.StatusOK, checkResult.StatusCode, "unexpected result: %+v", checkResult) assert.NotEqualValues(t, tabletmanagerdatapb.CheckThrottlerResponseCode_OK, checkResult.ResponseCode, "unexpected result: %+v", checkResult) assert.Equal(t, 2, len(checkResult.Metrics)) assert.Contains(t, checkResult.Summary(), testAppName.String()+" is denied access due to self/loadavg metric value") @@ -646,7 +628,6 @@ func TestApplyThrottlerConfigAppCheckedMetrics(t *testing.T) { checkResult := throttler.Check(ctx, testAppName.String(), nil, flags) require.NotNil(t, checkResult) assert.EqualValues(t, 5.1, checkResult.Value) // shard loadavg value - assert.NotEqualValues(t, http.StatusOK, checkResult.StatusCode, "unexpected result: %+v", checkResult) assert.NotEqualValues(t, tabletmanagerdatapb.CheckThrottlerResponseCode_OK, checkResult.ResponseCode, "unexpected result: %+v", checkResult) assert.Equal(t, 2, len(checkResult.Metrics)) assert.Contains(t, checkResult.Summary(), testAppName.String()+" is denied access due to shard/loadavg metric value") @@ -661,7 +642,6 @@ func TestApplyThrottlerConfigAppCheckedMetrics(t *testing.T) { checkResult := throttler.Check(ctx, testAppName.String(), nil, flags) require.NotNil(t, checkResult) assert.EqualValues(t, 0.9, checkResult.Value) // shard lag value - assert.EqualValues(t, http.StatusOK, checkResult.StatusCode, "unexpected result: %+v", checkResult) assert.EqualValues(t, tabletmanagerdatapb.CheckThrottlerResponseCode_OK, checkResult.ResponseCode, "unexpected result: %+v", checkResult) assert.Equal(t, 1, len(checkResult.Metrics), "unexpected metrics: %+v", checkResult.Metrics) assert.Contains(t, checkResult.Summary(), testAppName.String()+" is granted access") @@ -680,7 +660,6 @@ func TestApplyThrottlerConfigAppCheckedMetrics(t *testing.T) { checkResult := throttler.Check(ctx, testAppName.String(), nil, flags) require.NotNil(t, checkResult) assert.EqualValues(t, 0.9, checkResult.Value) // shard lag value - assert.EqualValues(t, http.StatusOK, checkResult.StatusCode, "unexpected result: %+v", checkResult) assert.EqualValues(t, tabletmanagerdatapb.CheckThrottlerResponseCode_OK, checkResult.ResponseCode, "unexpected result: %+v", checkResult) assert.Equal(t, 2, len(checkResult.Metrics)) assert.Contains(t, checkResult.Summary(), testAppName.String()+" is granted access") @@ -699,7 +678,6 @@ func TestApplyThrottlerConfigAppCheckedMetrics(t *testing.T) { checkResult := throttler.Check(ctx, throttlerapp.AllName.String(), nil, flags) require.NotNil(t, checkResult) assert.EqualValues(t, 2.718, checkResult.Value) // loadavg self value exceeds threshold - assert.NotEqualValues(t, http.StatusOK, checkResult.StatusCode, "unexpected result: %+v", checkResult) assert.NotEqualValues(t, tabletmanagerdatapb.CheckThrottlerResponseCode_OK, checkResult.ResponseCode, "unexpected result: %+v", checkResult) assert.Equal(t, 2, len(checkResult.Metrics)) assert.Contains(t, checkResult.Summary(), throttlerapp.AllName.String()+" is denied access due to self/loadavg metric value") @@ -715,7 +693,6 @@ func TestApplyThrottlerConfigAppCheckedMetrics(t *testing.T) { checkResult := throttler.Check(ctx, testAppName.String(), nil, flags) require.NotNil(t, checkResult) assert.EqualValues(t, 0.9, checkResult.Value) // shard lag value - assert.EqualValues(t, http.StatusOK, checkResult.StatusCode, "unexpected result: %+v", checkResult) assert.EqualValues(t, tabletmanagerdatapb.CheckThrottlerResponseCode_OK, checkResult.ResponseCode, "unexpected result: %+v", checkResult) assert.Equal(t, 2, len(checkResult.Metrics)) assert.Contains(t, checkResult.Summary(), testAppName.String()+" is granted access") @@ -730,7 +707,6 @@ func TestApplyThrottlerConfigAppCheckedMetrics(t *testing.T) { checkResult := throttler.Check(ctx, throttlerapp.OnlineDDLName.String(), nil, flags) require.NotNil(t, checkResult) assert.EqualValues(t, 2.718, checkResult.Value) // loadavg self value exceeds threshold - assert.NotEqualValues(t, http.StatusOK, checkResult.StatusCode, "unexpected result: %+v", checkResult) assert.NotEqualValues(t, tabletmanagerdatapb.CheckThrottlerResponseCode_OK, checkResult.ResponseCode, "unexpected result: %+v", checkResult) assert.Equal(t, 2, len(checkResult.Metrics)) assert.Contains(t, checkResult.Summary(), throttlerapp.AllName.String()+" is denied access due to self/loadavg metric value") @@ -742,7 +718,6 @@ func TestApplyThrottlerConfigAppCheckedMetrics(t *testing.T) { checkResult := throttler.Check(ctx, "vreplication:online-ddl:12345", nil, flags) require.NotNil(t, checkResult) assert.EqualValues(t, 2.718, checkResult.Value) // loadavg self value exceeds threshold - assert.NotEqualValues(t, http.StatusOK, checkResult.StatusCode, "unexpected result: %+v", checkResult) assert.NotEqualValues(t, tabletmanagerdatapb.CheckThrottlerResponseCode_OK, checkResult.ResponseCode, "unexpected result: %+v", checkResult) assert.Equal(t, 2, len(checkResult.Metrics)) assert.Contains(t, checkResult.Summary(), throttlerapp.AllName.String()+" is denied access due to self/loadavg metric value") @@ -753,7 +728,6 @@ func TestApplyThrottlerConfigAppCheckedMetrics(t *testing.T) { checkResult := throttler.Check(ctx, "vreplication:online-ddl:test", nil, flags) require.NotNil(t, checkResult) assert.EqualValues(t, 0.9, checkResult.Value) // shard lag value - assert.EqualValues(t, http.StatusOK, checkResult.StatusCode, "unexpected result: %+v", checkResult) assert.EqualValues(t, tabletmanagerdatapb.CheckThrottlerResponseCode_OK, checkResult.ResponseCode, "unexpected result: %+v", checkResult) assert.Equal(t, 2, len(checkResult.Metrics)) assert.Contains(t, checkResult.Summary(), testAppName.String()+" is granted access") @@ -769,7 +743,6 @@ func TestApplyThrottlerConfigAppCheckedMetrics(t *testing.T) { checkResult := throttler.Check(ctx, throttlerapp.AllName.String(), nil, flags) require.NotNil(t, checkResult) assert.EqualValues(t, 0.9, checkResult.Value) // shard lag value - assert.EqualValues(t, http.StatusOK, checkResult.StatusCode, "unexpected result: %+v", checkResult) assert.EqualValues(t, tabletmanagerdatapb.CheckThrottlerResponseCode_OK, checkResult.ResponseCode, "unexpected result: %+v", checkResult) assert.Len(t, checkResult.Metrics, 1) assert.Contains(t, checkResult.Summary(), throttlerapp.AllName.String()+" is granted access") @@ -785,7 +758,6 @@ func TestApplyThrottlerConfigAppCheckedMetrics(t *testing.T) { checkResult := throttler.Check(ctx, testAppName.String(), nil, flags) require.NotNil(t, checkResult) assert.EqualValues(t, 0.9, checkResult.Value) // shard lag value - assert.EqualValues(t, http.StatusOK, checkResult.StatusCode, "unexpected result: %+v", checkResult) assert.EqualValues(t, tabletmanagerdatapb.CheckThrottlerResponseCode_OK, checkResult.ResponseCode, "unexpected result: %+v", checkResult) assert.Equal(t, 2, len(checkResult.Metrics)) assert.Contains(t, checkResult.Summary(), testAppName.String()+" is granted access") @@ -800,7 +772,6 @@ func TestApplyThrottlerConfigAppCheckedMetrics(t *testing.T) { checkResult := throttler.Check(ctx, throttlerapp.OnlineDDLName.String(), nil, flags) require.NotNil(t, checkResult) assert.EqualValues(t, 0.9, checkResult.Value) // shard lag value - assert.EqualValues(t, http.StatusOK, checkResult.StatusCode, "unexpected result: %+v", checkResult) assert.EqualValues(t, tabletmanagerdatapb.CheckThrottlerResponseCode_OK, checkResult.ResponseCode, "unexpected result: %+v", checkResult) assert.Len(t, checkResult.Metrics, 1) assert.Contains(t, checkResult.Summary(), throttlerapp.OnlineDDLName.String()+" is granted access") @@ -818,7 +789,6 @@ func TestApplyThrottlerConfigAppCheckedMetrics(t *testing.T) { checkResult := throttler.Check(ctx, testAppName.String(), nil, flags) require.NotNil(t, checkResult) assert.EqualValues(t, 0.9, checkResult.Value) // shard lag value - assert.EqualValues(t, http.StatusOK, checkResult.StatusCode) assert.EqualValues(t, tabletmanagerdatapb.CheckThrottlerResponseCode_OK, checkResult.ResponseCode) assert.Len(t, checkResult.Metrics, 1) assert.Contains(t, checkResult.Summary(), testAppName.String()+" is granted access") @@ -1560,89 +1530,6 @@ func TestProbesWhileOperating(t *testing.T) { }) } -// TestProbesWithV20Replicas is similar to TestProbesWhileOperating, but assumes a v20 replica, which does not report any of the named metrics. -func TestProbesWithV20Replicas(t *testing.T) { - ctx := context.Background() // for development, replace with ctx := utils.LeakCheckContext(t) - ctx, cancel := context.WithCancel(ctx) - defer cancel() - - throttler := newTestThrottler() - - tmClient, ok := throttler.overrideTmClient.(*fakeTMClient) - require.True(t, ok) - assert.Empty(t, tmClient.AppNames()) - tmClient.v20.Store(true) - - t.Run("aggregated initial", func(t *testing.T) { - assert.Equal(t, 0, throttler.aggregatedMetrics.ItemCount()) - }) - - runThrottler(t, ctx, throttler, time.Minute, func(t *testing.T, ctx context.Context) { - defer cancel() // early termination - t.Run("aggregated", func(t *testing.T) { - aggr := throttler.aggregatedMetricsSnapshot() - assert.Equalf(t, 2*len(base.KnownMetricNames), len(aggr), "aggregated: %+v", aggr) // "self" and "shard", per known metric - assert.Equal(t, 2*len(base.KnownMetricNames), throttler.aggregatedMetrics.ItemCount()) // flushed upon Disable() - for aggregatedMetricName, metricResult := range aggr { - assert.NotEmpty(t, aggregatedMetricName) - scope, metricName, err := base.DisaggregateMetricName(aggregatedMetricName) - assert.NotEmpty(t, metricName) - require.NoError(t, err) - - val, metricResultErr := metricResult.Get() - expectMetricNotCollectedYet := false - switch base.Scope(scope) { - case base.SelfScope: - switch metricName { - case base.DefaultMetricName: - assert.Equalf(t, float64(0.3), val, "scope=%v, metricName=%v", scope, metricName) // same value as "lag" - case base.LagMetricName: - assert.Equalf(t, float64(0.3), val, "scope=%v, metricName=%v", scope, metricName) - case base.ThreadsRunningMetricName: - assert.Equalf(t, float64(26), val, "scope=%v, metricName=%v", scope, metricName) - case base.CustomMetricName: - assert.Equalf(t, float64(17), val, "scope=%v, metricName=%v", scope, metricName) - case base.LoadAvgMetricName: - assert.Equalf(t, float64(2.718), val, "scope=%v, metricName=%v", scope, metricName) - } - case base.ShardScope: - // Replicas will nto report named metrics, since they now assume v20 behavior. They will only - // produce the single v20 metric (which we call "default", though they don't advertise it under the name "base.DefaultMetricName") - switch metricName { - case base.DefaultMetricName: - assert.Equalf(t, float64(0.339), val, "scope=%v, metricName=%v", scope, metricName) // same value as "lag" - case base.LagMetricName: - assert.Equalf(t, float64(0.339), val, "scope=%v, metricName=%v", scope, metricName) // - default: - assert.Zero(t, val, "scope=%v, metricName=%v", scope, metricName) - expectMetricNotCollectedYet = true - } - default: - assert.Failf(t, "unknown scope", "scope=%v", scope) - } - if expectMetricNotCollectedYet { - assert.ErrorIs(t, metricResultErr, base.ErrNoResultYet) - } else { - assert.NoErrorf(t, metricResultErr, "aggregatedMetricName: %v", aggregatedMetricName) - } - } - assert.NotEmpty(t, tmClient.AppNames()) - // The throttler here emulates a PRIMARY tablet, and therefore should probe the replicas using - // the "vitess" app name. - uniqueNames := map[string]int{} - for _, appName := range tmClient.AppNames() { - uniqueNames[appName]++ - } - // PRIMARY throttler probes replicas with empty app name, which is then - // interpreted as "vitess" name. - _, ok := uniqueNames[""] - assert.Truef(t, ok, "%+v", uniqueNames) - // And that's the only app we expect to see. - assert.Equalf(t, 1, len(uniqueNames), "%+v", uniqueNames) - }) - }) -} - // TestProbesPostDisable runs the throttler for some time, and then investigates the internal throttler maps and values. func TestProbesPostDisable(t *testing.T) { ctx := context.Background() // for development, replace with ctx := utils.LeakCheckContext(t) @@ -1697,8 +1584,7 @@ func TestDormant(t *testing.T) { assert.True(t, throttler.isDormant()) assert.EqualValues(t, 1, heartbeatWriter.Requests()) // once upon Enable() flags := &CheckFlags{ - Scope: base.SelfScope, - MultiMetricsEnabled: true, + Scope: base.SelfScope, } throttler.Check(ctx, throttlerapp.VitessName.String(), nil, flags) go func() { @@ -1797,14 +1683,12 @@ func TestChecks(t *testing.T) { validateAppNames(t) t.Run("checks, self scope", func(t *testing.T) { flags := &CheckFlags{ - Scope: base.SelfScope, - MultiMetricsEnabled: true, + Scope: base.SelfScope, } t.Run("implicit names", func(t *testing.T) { checkResult := throttler.Check(ctx, testAppName.String(), nil, flags) require.NotNil(t, checkResult) assert.EqualValues(t, 0.3, checkResult.Value) // self lag value - assert.EqualValues(t, http.StatusOK, checkResult.StatusCode) assert.EqualValues(t, tabletmanagerdatapb.CheckThrottlerResponseCode_OK, checkResult.ResponseCode) assert.Equal(t, testAppName.String(), checkResult.AppName) assert.Len(t, checkResult.Metrics, 1) @@ -1813,11 +1697,6 @@ func TestChecks(t *testing.T) { checkResult := throttler.Check(ctx, testAppName.String(), base.KnownMetricNames, flags) require.NotNil(t, checkResult) assert.EqualValues(t, 0.3, checkResult.Value, "unexpected result: %+v", checkResult) // self lag value - if !assert.EqualValues(t, http.StatusOK, checkResult.StatusCode, "unexpected result: %+v", checkResult) { - for k, v := range checkResult.Metrics { - t.Logf("%s: %+v", k, v) - } - } if !assert.EqualValues(t, tabletmanagerdatapb.CheckThrottlerResponseCode_OK, checkResult.ResponseCode, "unexpected result: %+v", checkResult) { for k, v := range checkResult.Metrics { t.Logf("%s: %+v", k, v) @@ -1840,7 +1719,6 @@ func TestChecks(t *testing.T) { // "vitess" app always checks all known metrics. flags := &CheckFlags{ // scope not important for this test - MultiMetricsEnabled: true, } t.Run("implicit names, always all known", func(t *testing.T) { checkResult := throttler.Check(ctx, throttlerapp.VitessName.String(), nil, flags) @@ -1863,14 +1741,12 @@ func TestChecks(t *testing.T) { t.Run("checks, shard scope", func(t *testing.T) { flags := &CheckFlags{ - Scope: base.ShardScope, - MultiMetricsEnabled: true, + Scope: base.ShardScope, } t.Run("implicit names", func(t *testing.T) { checkResult := throttler.Check(ctx, testAppName.String(), nil, flags) require.NotNil(t, checkResult) assert.EqualValues(t, 0.9, checkResult.Value) // shard lag value - assert.NotEqualValues(t, http.StatusOK, checkResult.StatusCode) assert.NotEqualValues(t, tabletmanagerdatapb.CheckThrottlerResponseCode_OK, checkResult.ResponseCode) assert.ErrorIs(t, checkResult.Error, base.ErrThresholdExceeded) assert.Equal(t, testAppName.String(), checkResult.AppName) @@ -1880,7 +1756,6 @@ func TestChecks(t *testing.T) { checkResult := throttler.Check(ctx, testAppName.String(), base.KnownMetricNames, flags) require.NotNil(t, checkResult) assert.EqualValues(t, 0.9, checkResult.Value) // shard lag value - assert.NotEqualValues(t, http.StatusOK, checkResult.StatusCode) assert.NotEqualValues(t, tabletmanagerdatapb.CheckThrottlerResponseCode_OK, checkResult.ResponseCode) assert.ErrorIs(t, checkResult.Error, base.ErrThresholdExceeded) assert.Equal(t, testAppName.String(), checkResult.AppName) @@ -1898,13 +1773,11 @@ func TestChecks(t *testing.T) { t.Run("checks, undefined scope", func(t *testing.T) { flags := &CheckFlags{ // Leaving scope undefined, so that each metrics picks its own scope - MultiMetricsEnabled: true, } t.Run("implicit names", func(t *testing.T) { checkResult := throttler.Check(ctx, testAppName.String(), nil, flags) require.NotNil(t, checkResult) assert.EqualValues(t, 0.9, checkResult.Value) // shard lag value - assert.NotEqualValues(t, http.StatusOK, checkResult.StatusCode) assert.NotEqualValues(t, tabletmanagerdatapb.CheckThrottlerResponseCode_OK, checkResult.ResponseCode) assert.ErrorIs(t, checkResult.Error, base.ErrThresholdExceeded) assert.Len(t, checkResult.Metrics, 1) @@ -1913,7 +1786,6 @@ func TestChecks(t *testing.T) { checkResult := throttler.Check(ctx, testAppName.String(), base.KnownMetricNames, flags) require.NotNil(t, checkResult) assert.EqualValues(t, 0.9, checkResult.Value) // shard lag value - assert.NotEqualValues(t, http.StatusOK, checkResult.StatusCode) assert.NotEqualValues(t, tabletmanagerdatapb.CheckThrottlerResponseCode_OK, checkResult.ResponseCode) assert.ErrorIs(t, checkResult.Error, base.ErrThresholdExceeded) assert.Equal(t, len(base.KnownMetricNames), len(checkResult.Metrics)) @@ -1930,8 +1802,7 @@ func TestChecks(t *testing.T) { }) t.Run("checks, defined scope masks explicit scope metrics", func(t *testing.T) { flags := &CheckFlags{ - Scope: base.ShardScope, - MultiMetricsEnabled: true, + Scope: base.ShardScope, } t.Run("explicit names", func(t *testing.T) { metricNames := base.MetricNames{ @@ -1945,7 +1816,6 @@ func TestChecks(t *testing.T) { require.NotNil(t, checkResult) assert.EqualValues(t, 0.9, checkResult.Value) // shard lag value - assert.NotEqualValues(t, http.StatusOK, checkResult.StatusCode) assert.NotEqualValues(t, tabletmanagerdatapb.CheckThrottlerResponseCode_OK, checkResult.ResponseCode) assert.ErrorIs(t, checkResult.Error, base.ErrThresholdExceeded) assert.Equal(t, len(metricNames), len(checkResult.Metrics)) @@ -1962,7 +1832,6 @@ func TestChecks(t *testing.T) { t.Run("checks, undefined scope and explicit scope metrics", func(t *testing.T) { flags := &CheckFlags{ // Leaving scope undefined - MultiMetricsEnabled: true, } t.Run("explicit names", func(t *testing.T) { metricNames := base.MetricNames{ @@ -1974,7 +1843,6 @@ func TestChecks(t *testing.T) { checkResult := throttler.Check(ctx, testAppName.String(), metricNames, flags) require.NotNil(t, checkResult) assert.EqualValues(t, 0.3, checkResult.Value) // explicitly set self lag value - assert.EqualValues(t, http.StatusOK, checkResult.StatusCode) assert.EqualValues(t, tabletmanagerdatapb.CheckThrottlerResponseCode_OK, checkResult.ResponseCode) assert.Equal(t, len(metricNames), len(checkResult.Metrics)) @@ -2011,8 +1879,7 @@ func TestReplica(t *testing.T) { runThrottler(t, ctx, throttler, time.Minute, func(t *testing.T, ctx context.Context) { assert.Empty(t, tmClient.AppNames()) flags := &CheckFlags{ - Scope: base.SelfScope, - MultiMetricsEnabled: true, + Scope: base.SelfScope, } { checkResult := throttler.Check(ctx, throttlerapp.VitessName.String(), nil, flags) @@ -2037,7 +1904,6 @@ func TestReplica(t *testing.T) { checkResult := throttler.Check(ctx, throttlerapp.OnlineDDLName.String(), nil, flags) require.NotNil(t, checkResult) assert.EqualValues(t, 0.3, checkResult.Value) // self lag value - assert.EqualValues(t, http.StatusOK, checkResult.StatusCode) assert.EqualValues(t, tabletmanagerdatapb.CheckThrottlerResponseCode_OK, checkResult.ResponseCode) assert.Len(t, checkResult.Metrics, 1) select { @@ -2055,7 +1921,6 @@ func TestReplica(t *testing.T) { checkResult := throttler.Check(ctx, throttlerapp.OnlineDDLName.String(), nil, flags) require.NotNil(t, checkResult) assert.EqualValues(t, 0.3, checkResult.Value) // self lag value - assert.EqualValues(t, http.StatusOK, checkResult.StatusCode) assert.EqualValues(t, tabletmanagerdatapb.CheckThrottlerResponseCode_OK, checkResult.ResponseCode) assert.Len(t, checkResult.Metrics, 1) assert.True(t, checkResult.RecentlyChecked) @@ -2063,7 +1928,6 @@ func TestReplica(t *testing.T) { { recentApp, ok := throttler.recentAppsSnapshot()[throttlerapp.OnlineDDLName.String()] require.True(t, ok) - assert.EqualValues(t, http.StatusOK, recentApp.StatusCode) assert.EqualValues(t, tabletmanagerdatapb.CheckThrottlerResponseCode_OK, recentApp.ResponseCode) } } @@ -2094,29 +1958,9 @@ func TestReplica(t *testing.T) { require.NotNil(t, checkResult) // loadavg value exceeds threshold. This will show up in the check result as an error. assert.EqualValues(t, 2.718, checkResult.Value, "unexpected result: %+v", checkResult) // self lag value - assert.NotEqualValues(t, http.StatusOK, checkResult.StatusCode, "unexpected result: %+v", checkResult) assert.NotEqualValues(t, tabletmanagerdatapb.CheckThrottlerResponseCode_OK, checkResult.ResponseCode, "unexpected result: %+v", checkResult) assert.Equal(t, len(base.KnownMetricNames), len(checkResult.Metrics)) }) - t.Run("validate v20 non-multi-metric results", func(t *testing.T) { - flags := &CheckFlags{ - Scope: base.SelfScope, - MultiMetricsEnabled: false, - } - checkResult := throttler.Check(ctx, throttlerapp.VitessName.String(), nil, flags) - require.NotNil(t, checkResult) - // loadavg value exceeds threshold. But since "MultiMetricsEnabled: false", the - // throttler, acting as a replica, assumes it's being probed by a v20 primary, and - // therefore does not report any of the multi-metric errors back. It only ever - // reports the default metric. - assert.EqualValues(t, 0.3, checkResult.Value) // self lag value - assert.EqualValues(t, http.StatusOK, checkResult.StatusCode) - assert.EqualValues(t, tabletmanagerdatapb.CheckThrottlerResponseCode_OK, checkResult.ResponseCode) - assert.EqualValues(t, 0.75, checkResult.Threshold) - // The replica will still report the multi-metrics, and that's fine. As long - // as it does not reflect any of their values in the checkResult.Value/StatusCode/Threshold/Error/Message. - assert.Equal(t, len(base.KnownMetricNames), len(checkResult.Metrics)) - }) }) t.Run("metrics", func(t *testing.T) { diff --git a/proto/tabletmanagerdata.proto b/proto/tabletmanagerdata.proto index bb20e712e7f..1fcf57e0698 100644 --- a/proto/tabletmanagerdata.proto +++ b/proto/tabletmanagerdata.proto @@ -816,9 +816,8 @@ message CheckThrottlerRequest { bool skip_request_heartbeats = 3; // OKIfNotExists asks the throttler to return OK even if the metric does not exist bool ok_if_not_exists = 4; - // MultiMetricsEnabled is always set to "true" and is how a multi-metrics enabled replica - // throttler knows its being probed by a multi-metrics enabled primary vttablet. - bool multi_metrics_enabled = 5; + reserved 5; // used to be multi_metrics_enabled, introduced in v21 for backwards compatibility, and removed in v22 + reserved "multi_metrics_enabled"; } enum CheckThrottlerResponseCode { @@ -831,8 +830,8 @@ enum CheckThrottlerResponseCode { } message CheckThrottlerResponse { - // StatusCode is HTTP compliant response code (e.g. 200 for OK) - int32 status_code = 1; + reserved 1; // was `status_code`, HTTP compliant, deprecated + reserved "status_code"; // Value is the metric value collected by the tablet double value = 2; // Threshold is the throttling threshold the table was comparing the value with @@ -848,8 +847,7 @@ message CheckThrottlerResponse { message Metric { // Name of the metric string name = 1; - // StatusCode is HTTP compliant response code (e.g. 200 for OK) - int32 status_code = 2; + reserved 2; // was `status_code`, HTTP compliant, deprecated // Value is the metric value collected by the tablet double value = 3; // Threshold is the throttling threshold the table was comparing the value with @@ -932,7 +930,7 @@ message GetThrottlerStatusResponse { message RecentApp { vttime.Time checked_at = 1; - int32 status_code = 2; + reserved 2; // was HTTP `status_code`, deprecated // ResponseCode is the enum representation of the response CheckThrottlerResponseCode response_code = 3; } diff --git a/web/vtadmin/src/proto/vtadmin.d.ts b/web/vtadmin/src/proto/vtadmin.d.ts index 9e11f5f37d9..040edbe837c 100644 --- a/web/vtadmin/src/proto/vtadmin.d.ts +++ b/web/vtadmin/src/proto/vtadmin.d.ts @@ -34800,9 +34800,6 @@ export namespace tabletmanagerdata { /** CheckThrottlerRequest ok_if_not_exists */ ok_if_not_exists?: (boolean|null); - - /** CheckThrottlerRequest multi_metrics_enabled */ - multi_metrics_enabled?: (boolean|null); } /** Represents a CheckThrottlerRequest. */ @@ -34826,9 +34823,6 @@ export namespace tabletmanagerdata { /** CheckThrottlerRequest ok_if_not_exists. */ public ok_if_not_exists: boolean; - /** CheckThrottlerRequest multi_metrics_enabled. */ - public multi_metrics_enabled: boolean; - /** * Creates a new CheckThrottlerRequest instance using the specified properties. * @param [properties] Properties to set @@ -34920,9 +34914,6 @@ export namespace tabletmanagerdata { /** Properties of a CheckThrottlerResponse. */ interface ICheckThrottlerResponse { - /** CheckThrottlerResponse status_code */ - status_code?: (number|null); - /** CheckThrottlerResponse value */ value?: (number|null); @@ -34960,9 +34951,6 @@ export namespace tabletmanagerdata { */ constructor(properties?: tabletmanagerdata.ICheckThrottlerResponse); - /** CheckThrottlerResponse status_code. */ - public status_code: number; - /** CheckThrottlerResponse value. */ public value: number; @@ -35076,9 +35064,6 @@ export namespace tabletmanagerdata { /** Metric name */ name?: (string|null); - /** Metric status_code */ - status_code?: (number|null); - /** Metric value */ value?: (number|null); @@ -35110,9 +35095,6 @@ export namespace tabletmanagerdata { /** Metric name. */ public name: string; - /** Metric status_code. */ - public status_code: number; - /** Metric value. */ public value: number; @@ -35714,9 +35696,6 @@ export namespace tabletmanagerdata { /** RecentApp checked_at */ checked_at?: (vttime.ITime|null); - /** RecentApp status_code */ - status_code?: (number|null); - /** RecentApp response_code */ response_code?: (tabletmanagerdata.CheckThrottlerResponseCode|null); } @@ -35733,9 +35712,6 @@ export namespace tabletmanagerdata { /** RecentApp checked_at. */ public checked_at?: (vttime.ITime|null); - /** RecentApp status_code. */ - public status_code: number; - /** RecentApp response_code. */ public response_code: tabletmanagerdata.CheckThrottlerResponseCode; diff --git a/web/vtadmin/src/proto/vtadmin.js b/web/vtadmin/src/proto/vtadmin.js index d0ce20ccfc2..8ef76e9e481 100644 --- a/web/vtadmin/src/proto/vtadmin.js +++ b/web/vtadmin/src/proto/vtadmin.js @@ -80747,7 +80747,6 @@ export const tabletmanagerdata = $root.tabletmanagerdata = (() => { * @property {string|null} [scope] CheckThrottlerRequest scope * @property {boolean|null} [skip_request_heartbeats] CheckThrottlerRequest skip_request_heartbeats * @property {boolean|null} [ok_if_not_exists] CheckThrottlerRequest ok_if_not_exists - * @property {boolean|null} [multi_metrics_enabled] CheckThrottlerRequest multi_metrics_enabled */ /** @@ -80797,14 +80796,6 @@ export const tabletmanagerdata = $root.tabletmanagerdata = (() => { */ CheckThrottlerRequest.prototype.ok_if_not_exists = false; - /** - * CheckThrottlerRequest multi_metrics_enabled. - * @member {boolean} multi_metrics_enabled - * @memberof tabletmanagerdata.CheckThrottlerRequest - * @instance - */ - CheckThrottlerRequest.prototype.multi_metrics_enabled = false; - /** * Creates a new CheckThrottlerRequest instance using the specified properties. * @function create @@ -80837,8 +80828,6 @@ export const tabletmanagerdata = $root.tabletmanagerdata = (() => { writer.uint32(/* id 3, wireType 0 =*/24).bool(message.skip_request_heartbeats); if (message.ok_if_not_exists != null && Object.hasOwnProperty.call(message, "ok_if_not_exists")) writer.uint32(/* id 4, wireType 0 =*/32).bool(message.ok_if_not_exists); - if (message.multi_metrics_enabled != null && Object.hasOwnProperty.call(message, "multi_metrics_enabled")) - writer.uint32(/* id 5, wireType 0 =*/40).bool(message.multi_metrics_enabled); return writer; }; @@ -80889,10 +80878,6 @@ export const tabletmanagerdata = $root.tabletmanagerdata = (() => { message.ok_if_not_exists = reader.bool(); break; } - case 5: { - message.multi_metrics_enabled = reader.bool(); - break; - } default: reader.skipType(tag & 7); break; @@ -80940,9 +80925,6 @@ export const tabletmanagerdata = $root.tabletmanagerdata = (() => { if (message.ok_if_not_exists != null && message.hasOwnProperty("ok_if_not_exists")) if (typeof message.ok_if_not_exists !== "boolean") return "ok_if_not_exists: boolean expected"; - if (message.multi_metrics_enabled != null && message.hasOwnProperty("multi_metrics_enabled")) - if (typeof message.multi_metrics_enabled !== "boolean") - return "multi_metrics_enabled: boolean expected"; return null; }; @@ -80966,8 +80948,6 @@ export const tabletmanagerdata = $root.tabletmanagerdata = (() => { message.skip_request_heartbeats = Boolean(object.skip_request_heartbeats); if (object.ok_if_not_exists != null) message.ok_if_not_exists = Boolean(object.ok_if_not_exists); - if (object.multi_metrics_enabled != null) - message.multi_metrics_enabled = Boolean(object.multi_metrics_enabled); return message; }; @@ -80989,7 +80969,6 @@ export const tabletmanagerdata = $root.tabletmanagerdata = (() => { object.scope = ""; object.skip_request_heartbeats = false; object.ok_if_not_exists = false; - object.multi_metrics_enabled = false; } if (message.app_name != null && message.hasOwnProperty("app_name")) object.app_name = message.app_name; @@ -80999,8 +80978,6 @@ export const tabletmanagerdata = $root.tabletmanagerdata = (() => { object.skip_request_heartbeats = message.skip_request_heartbeats; if (message.ok_if_not_exists != null && message.hasOwnProperty("ok_if_not_exists")) object.ok_if_not_exists = message.ok_if_not_exists; - if (message.multi_metrics_enabled != null && message.hasOwnProperty("multi_metrics_enabled")) - object.multi_metrics_enabled = message.multi_metrics_enabled; return object; }; @@ -81061,7 +81038,6 @@ export const tabletmanagerdata = $root.tabletmanagerdata = (() => { * Properties of a CheckThrottlerResponse. * @memberof tabletmanagerdata * @interface ICheckThrottlerResponse - * @property {number|null} [status_code] CheckThrottlerResponse status_code * @property {number|null} [value] CheckThrottlerResponse value * @property {number|null} [threshold] CheckThrottlerResponse threshold * @property {string|null} [error] CheckThrottlerResponse error @@ -81089,14 +81065,6 @@ export const tabletmanagerdata = $root.tabletmanagerdata = (() => { this[keys[i]] = properties[keys[i]]; } - /** - * CheckThrottlerResponse status_code. - * @member {number} status_code - * @memberof tabletmanagerdata.CheckThrottlerResponse - * @instance - */ - CheckThrottlerResponse.prototype.status_code = 0; - /** * CheckThrottlerResponse value. * @member {number} value @@ -81193,8 +81161,6 @@ export const tabletmanagerdata = $root.tabletmanagerdata = (() => { CheckThrottlerResponse.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.status_code != null && Object.hasOwnProperty.call(message, "status_code")) - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.status_code); if (message.value != null && Object.hasOwnProperty.call(message, "value")) writer.uint32(/* id 2, wireType 1 =*/17).double(message.value); if (message.threshold != null && Object.hasOwnProperty.call(message, "threshold")) @@ -81250,10 +81216,6 @@ export const tabletmanagerdata = $root.tabletmanagerdata = (() => { while (reader.pos < end) { let tag = reader.uint32(); switch (tag >>> 3) { - case 1: { - message.status_code = reader.int32(); - break; - } case 2: { message.value = reader.double(); break; @@ -81344,9 +81306,6 @@ export const tabletmanagerdata = $root.tabletmanagerdata = (() => { CheckThrottlerResponse.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.status_code != null && message.hasOwnProperty("status_code")) - if (!$util.isInteger(message.status_code)) - return "status_code: integer expected"; if (message.value != null && message.hasOwnProperty("value")) if (typeof message.value !== "number") return "value: number expected"; @@ -81405,8 +81364,6 @@ export const tabletmanagerdata = $root.tabletmanagerdata = (() => { if (object instanceof $root.tabletmanagerdata.CheckThrottlerResponse) return object; let message = new $root.tabletmanagerdata.CheckThrottlerResponse(); - if (object.status_code != null) - message.status_code = object.status_code | 0; if (object.value != null) message.value = Number(object.value); if (object.threshold != null) @@ -81482,7 +81439,6 @@ export const tabletmanagerdata = $root.tabletmanagerdata = (() => { if (options.objects || options.defaults) object.metrics = {}; if (options.defaults) { - object.status_code = 0; object.value = 0; object.threshold = 0; object.error = ""; @@ -81492,8 +81448,6 @@ export const tabletmanagerdata = $root.tabletmanagerdata = (() => { object.summary = ""; object.response_code = options.enums === String ? "UNDEFINED" : 0; } - if (message.status_code != null && message.hasOwnProperty("status_code")) - object.status_code = message.status_code; if (message.value != null && message.hasOwnProperty("value")) object.value = options.json && !isFinite(message.value) ? String(message.value) : message.value; if (message.threshold != null && message.hasOwnProperty("threshold")) @@ -81552,7 +81506,6 @@ export const tabletmanagerdata = $root.tabletmanagerdata = (() => { * @memberof tabletmanagerdata.CheckThrottlerResponse * @interface IMetric * @property {string|null} [name] Metric name - * @property {number|null} [status_code] Metric status_code * @property {number|null} [value] Metric value * @property {number|null} [threshold] Metric threshold * @property {string|null} [error] Metric error @@ -81584,14 +81537,6 @@ export const tabletmanagerdata = $root.tabletmanagerdata = (() => { */ Metric.prototype.name = ""; - /** - * Metric status_code. - * @member {number} status_code - * @memberof tabletmanagerdata.CheckThrottlerResponse.Metric - * @instance - */ - Metric.prototype.status_code = 0; - /** * Metric value. * @member {number} value @@ -81666,8 +81611,6 @@ export const tabletmanagerdata = $root.tabletmanagerdata = (() => { writer = $Writer.create(); if (message.name != null && Object.hasOwnProperty.call(message, "name")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - if (message.status_code != null && Object.hasOwnProperty.call(message, "status_code")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.status_code); if (message.value != null && Object.hasOwnProperty.call(message, "value")) writer.uint32(/* id 3, wireType 1 =*/25).double(message.value); if (message.threshold != null && Object.hasOwnProperty.call(message, "threshold")) @@ -81718,10 +81661,6 @@ export const tabletmanagerdata = $root.tabletmanagerdata = (() => { message.name = reader.string(); break; } - case 2: { - message.status_code = reader.int32(); - break; - } case 3: { message.value = reader.double(); break; @@ -81784,9 +81723,6 @@ export const tabletmanagerdata = $root.tabletmanagerdata = (() => { if (message.name != null && message.hasOwnProperty("name")) if (!$util.isString(message.name)) return "name: string expected"; - if (message.status_code != null && message.hasOwnProperty("status_code")) - if (!$util.isInteger(message.status_code)) - return "status_code: integer expected"; if (message.value != null && message.hasOwnProperty("value")) if (typeof message.value !== "number") return "value: number expected"; @@ -81831,8 +81767,6 @@ export const tabletmanagerdata = $root.tabletmanagerdata = (() => { let message = new $root.tabletmanagerdata.CheckThrottlerResponse.Metric(); if (object.name != null) message.name = String(object.name); - if (object.status_code != null) - message.status_code = object.status_code | 0; if (object.value != null) message.value = Number(object.value); if (object.threshold != null) @@ -81893,7 +81827,6 @@ export const tabletmanagerdata = $root.tabletmanagerdata = (() => { let object = {}; if (options.defaults) { object.name = ""; - object.status_code = 0; object.value = 0; object.threshold = 0; object.error = ""; @@ -81903,8 +81836,6 @@ export const tabletmanagerdata = $root.tabletmanagerdata = (() => { } if (message.name != null && message.hasOwnProperty("name")) object.name = message.name; - if (message.status_code != null && message.hasOwnProperty("status_code")) - object.status_code = message.status_code; if (message.value != null && message.hasOwnProperty("value")) object.value = options.json && !isFinite(message.value) ? String(message.value) : message.value; if (message.threshold != null && message.hasOwnProperty("threshold")) @@ -83434,7 +83365,6 @@ export const tabletmanagerdata = $root.tabletmanagerdata = (() => { * @memberof tabletmanagerdata.GetThrottlerStatusResponse * @interface IRecentApp * @property {vttime.ITime|null} [checked_at] RecentApp checked_at - * @property {number|null} [status_code] RecentApp status_code * @property {tabletmanagerdata.CheckThrottlerResponseCode|null} [response_code] RecentApp response_code */ @@ -83461,14 +83391,6 @@ export const tabletmanagerdata = $root.tabletmanagerdata = (() => { */ RecentApp.prototype.checked_at = null; - /** - * RecentApp status_code. - * @member {number} status_code - * @memberof tabletmanagerdata.GetThrottlerStatusResponse.RecentApp - * @instance - */ - RecentApp.prototype.status_code = 0; - /** * RecentApp response_code. * @member {tabletmanagerdata.CheckThrottlerResponseCode} response_code @@ -83503,8 +83425,6 @@ export const tabletmanagerdata = $root.tabletmanagerdata = (() => { writer = $Writer.create(); if (message.checked_at != null && Object.hasOwnProperty.call(message, "checked_at")) $root.vttime.Time.encode(message.checked_at, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.status_code != null && Object.hasOwnProperty.call(message, "status_code")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.status_code); if (message.response_code != null && Object.hasOwnProperty.call(message, "response_code")) writer.uint32(/* id 3, wireType 0 =*/24).int32(message.response_code); return writer; @@ -83545,10 +83465,6 @@ export const tabletmanagerdata = $root.tabletmanagerdata = (() => { message.checked_at = $root.vttime.Time.decode(reader, reader.uint32()); break; } - case 2: { - message.status_code = reader.int32(); - break; - } case 3: { message.response_code = reader.int32(); break; @@ -83593,9 +83509,6 @@ export const tabletmanagerdata = $root.tabletmanagerdata = (() => { if (error) return "checked_at." + error; } - if (message.status_code != null && message.hasOwnProperty("status_code")) - if (!$util.isInteger(message.status_code)) - return "status_code: integer expected"; if (message.response_code != null && message.hasOwnProperty("response_code")) switch (message.response_code) { default: @@ -83628,8 +83541,6 @@ export const tabletmanagerdata = $root.tabletmanagerdata = (() => { throw TypeError(".tabletmanagerdata.GetThrottlerStatusResponse.RecentApp.checked_at: object expected"); message.checked_at = $root.vttime.Time.fromObject(object.checked_at); } - if (object.status_code != null) - message.status_code = object.status_code | 0; switch (object.response_code) { default: if (typeof object.response_code === "number") { @@ -83680,13 +83591,10 @@ export const tabletmanagerdata = $root.tabletmanagerdata = (() => { let object = {}; if (options.defaults) { object.checked_at = null; - object.status_code = 0; object.response_code = options.enums === String ? "UNDEFINED" : 0; } if (message.checked_at != null && message.hasOwnProperty("checked_at")) object.checked_at = $root.vttime.Time.toObject(message.checked_at, options); - if (message.status_code != null && message.hasOwnProperty("status_code")) - object.status_code = message.status_code; if (message.response_code != null && message.hasOwnProperty("response_code")) object.response_code = options.enums === String ? $root.tabletmanagerdata.CheckThrottlerResponseCode[message.response_code] === undefined ? message.response_code : $root.tabletmanagerdata.CheckThrottlerResponseCode[message.response_code] : message.response_code; return object;