Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

chore: deprecate anomaly (#15816)

Danny Xu25e8240a1a45
diff --git a/README.md b/README.md
index ecb4b732a5..32b16750a7 100644
--- a/README.md
+++ b/README.md
@@ -101,8 +101,8 @@
</p>
| | |
-| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------ |
-| <b>Centralize Change, Query and Admin Tasks</b><br />A single place to perform different tasks on different databases, thus enforce policy and monitor activity accordingly. <br /><br /><b>RBAC</b><br />[Two-level RBAC model](https://www.bytebase.com/docs/concepts/roles-and-permissions) mapping to the organization wide privileges and application team privileges respectively.<br /><br /><b>Anomaly Center and Audit Logging</b><br /> Capture all database [anomalies](https://www.bytebase.com/docs/administration/anomaly-center), user actions and system events and present them in a holistic view. | <img src="https://raw.githubusercontent.com/bytebase/bytebase/main/docs/assets/anomaly-center.webp" /> |
+| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| <b>Centralize Change, Query and Admin Tasks</b><br />A single place to perform different tasks on different databases, thus enforce policy and monitor activity accordingly. <br /><br /><b>RBAC</b><br />[Two-level RBAC model](https://www.bytebase.com/docs/concepts/roles-and-permissions) mapping to the organization wide privileges and application team privileges respectively.<br /><br /><b>Drift Detection and Audit Logging</b><br /> Capture all database schema drifts, user actions and system events and present them in a holistic view. |
<br />
diff --git a/backend/api/lsp/utils_test.go b/backend/api/lsp/utils_test.go
index 4d137cf2af..9e9e7d6275 100644
--- a/backend/api/lsp/utils_test.go
+++ b/backend/api/lsp/utils_test.go
@@ -103,7 +103,7 @@ func TestGetSQLStatementRangesUTF16Position(t *testing.T) {
-SELECT * FROM public.anomaly;`),
+SELECT * FROM public.workday;`),
ranges: []lsp.Range{
{Start: lsp.Position{Line: 0, Character: 0}, End: lsp.Position{Line: 1, Character: 0}},
{Start: lsp.Position{Line: 4, Character: 0}, End: lsp.Position{Line: 4, Character: 30}},
diff --git a/backend/api/v1/anomaly_service.go b/backend/api/v1/anomaly_service.go
deleted file mode 100644
index 0b524c9ae4..0000000000
--- a/backend/api/v1/anomaly_service.go
+++ /dev/null
@@ -1,151 +0,0 @@
-package v1
-
-import (
- "context"
-
- "github.com/pkg/errors"
- "google.golang.org/grpc/codes"
- "google.golang.org/grpc/status"
- "google.golang.org/protobuf/types/known/timestamppb"
-
- "github.com/bytebase/bytebase/backend/base"
- "github.com/bytebase/bytebase/backend/common"
- "github.com/bytebase/bytebase/backend/store"
- v1pb "github.com/bytebase/bytebase/proto/generated-go/v1"
-)
-
-const (
- typeFilterKey = "type"
- resourceFilterKey = "resource"
-)
-
-var typesMap = map[string]base.AnomalyType{
- "DATABASE_CONNECTION": base.AnomalyDatabaseConnection,
- "DATABASE_SCHEMA_DRIFT": base.AnomalyDatabaseSchemaDrift,
-}
-
-// AnomalyService implements the anomaly service.
-type AnomalyService struct {
- v1pb.UnimplementedAnomalyServiceServer
- store *store.Store
-}
-
-// NewAnomalyService creates a new anomaly service.
-func NewAnomalyService(store *store.Store) *AnomalyService {
- return &AnomalyService{store: store}
-}
-
-// SearchAnomalies implements the SearchAnomalies RPC.
-func (s *AnomalyService) SearchAnomalies(ctx context.Context, request *v1pb.SearchAnomaliesRequest) (*v1pb.
- SearchAnomaliesResponse, error,
-) {
- projectID, err := common.GetProjectID(request.Parent)
- if err != nil {
- return nil, status.Error(codes.InvalidArgument, err.Error())
- }
- find := &store.ListAnomalyMessage{
- ProjectID: projectID,
- }
- if request.Filter != "" {
- // We only support filter by type and resource now.
- types, err := getEBNFTokens(request.Filter, typeFilterKey)
- if err != nil {
- return nil, status.Error(codes.InvalidArgument, err.Error())
- }
- for _, tp := range types {
- if v, ok := typesMap[tp]; ok {
- find.Types = append(find.Types, v)
- } else {
- return nil, status.Errorf(codes.InvalidArgument, "invalid type filter %q", tp)
- }
- }
- resources, err := getEBNFTokens(request.Filter, resourceFilterKey)
- if err != nil {
- return nil, status.Error(codes.InvalidArgument, err.Error())
- }
- if len(resources) > 1 {
- return nil, status.Errorf(codes.InvalidArgument, "only one resource can be specified")
- } else if len(resources) == 1 {
- insID, dbName, err := common.GetInstanceDatabaseID(resources[0])
- if err != nil {
- return nil, status.Errorf(codes.InvalidArgument, `invalid resource filter "%s": %v`, resources[0], err.Error())
- }
- instance, err := s.store.GetInstanceV2(ctx, &store.FindInstanceMessage{ResourceID: &insID})
- if err != nil {
- return nil, errors.Wrapf(err, "failed to get instance %s", insID)
- }
- if instance == nil {
- return nil, status.Errorf(codes.NotFound, "instance %q not found", insID)
- }
- database, err := s.store.GetDatabaseV2(ctx, &store.FindDatabaseMessage{
- InstanceID: &insID,
- DatabaseName: &dbName,
- IsCaseSensitive: store.IsObjectCaseSensitive(instance),
- })
- if err != nil {
- return nil, status.Error(codes.Internal, err.Error())
- }
- if database == nil {
- return nil, status.Errorf(codes.NotFound, "cannot found the database %s", resources[0])
- }
- find.InstanceID = &insID
- find.DatabaseName = &database.DatabaseName
- }
- }
-
- anomalies, err := s.store.ListAnomalyV2(ctx, find)
- if err != nil {
- return nil, status.Error(codes.Internal, err.Error())
- }
-
- var response v1pb.SearchAnomaliesResponse
- for _, anomaly := range anomalies {
- pbAnomaly, err := s.convertToAnomaly(ctx, anomaly)
- if err != nil {
- return nil, status.Error(codes.Internal, err.Error())
- }
- response.Anomalies = append(response.Anomalies, pbAnomaly)
- }
- return &response, nil
-}
-
-func (s *AnomalyService) convertToAnomaly(ctx context.Context, anomaly *store.AnomalyMessage) (*v1pb.Anomaly, error) {
- pbAnomaly := &v1pb.Anomaly{
- CreateTime: timestamppb.New(anomaly.UpdatedAt),
- }
-
- database, err := s.store.GetDatabaseV2(ctx, &store.FindDatabaseMessage{
- InstanceID: &anomaly.InstanceID,
- DatabaseName: &anomaly.DatabaseName,
- ShowDeleted: true,
- })
- if err != nil {
- return nil, errors.Wrapf(err, "failed to find database %s", anomaly.DatabaseName)
- }
- if database == nil {
- return nil, errors.Errorf("cannot found database %s", anomaly.DatabaseName)
- }
- pbAnomaly.Resource = common.FormatDatabase(database.InstanceID, database.DatabaseName)
- pbAnomaly.Type = convertAnomalyType(anomaly.Type)
- pbAnomaly.Severity = getSeverityFromAnomalyType(pbAnomaly.Type)
- return pbAnomaly, nil
-}
-
-func convertAnomalyType(tp base.AnomalyType) v1pb.Anomaly_AnomalyType {
- switch tp {
- case base.AnomalyDatabaseConnection:
- return v1pb.Anomaly_DATABASE_CONNECTION
- case base.AnomalyDatabaseSchemaDrift:
- return v1pb.Anomaly_DATABASE_SCHEMA_DRIFT
- default:
- return v1pb.Anomaly_ANOMALY_TYPE_UNSPECIFIED
- }
-}
-
-func getSeverityFromAnomalyType(tp v1pb.Anomaly_AnomalyType) v1pb.Anomaly_AnomalySeverity {
- switch tp {
- case v1pb.Anomaly_DATABASE_CONNECTION, v1pb.Anomaly_DATABASE_SCHEMA_DRIFT:
- return v1pb.Anomaly_CRITICAL
- }
- return v1pb.Anomaly_ANOMALY_SEVERITY_UNSPECIFIED
-}
diff --git a/backend/api/v1/database_service.go b/backend/api/v1/database_service.go
index e54a68fb36..1d12943b5d 100644
--- a/backend/api/v1/database_service.go
+++ b/backend/api/v1/database_service.go
@@ -458,6 +458,25 @@ func (s *DatabaseService) UpdateDatabase(ctx context.Context, request *v1pb.Upda
unsetEnvironment := ""
patch.EnvironmentID = &unsetEnvironment
}
+ case "drifted":
+ // Create a new base schema.
+ syncHistory, err := s.schemaSyncer.SyncDatabaseSchemaToHistory(ctx, databaseMessage)
+ if err != nil {
+ return nil, errors.Wrapf(err, "failed to sync database metadata and schema")
+ }
+ if _, err := s.store.CreateChangelog(ctx, &store.ChangelogMessage{
+ InstanceID: databaseMessage.InstanceID,
+ DatabaseName: databaseMessage.DatabaseName,
+ Status: store.ChangelogStatusDone,
+ // TODO(d): Revisit the previous sync history UID.
+ PrevSyncHistoryUID: &syncHistory,
+ SyncHistoryUID: &syncHistory,
+ Payload: &storepb.ChangelogPayload{
+ Type: storepb.ChangelogPayload_BASELINE,
+ }}); err != nil {
+ return nil, errors.Wrapf(err, "failed to create changelog")
+ }
+ patch.Metadata.Drifted = false
}
}
diff --git a/backend/base/anomaly.go b/backend/base/anomaly.go
deleted file mode 100644
index a3a43d8e85..0000000000
--- a/backend/base/anomaly.go
+++ /dev/null
@@ -1,11 +0,0 @@
-package base
-
-// AnomalyType is the type of a task.
-type AnomalyType string
-
-const (
- // AnomalyDatabaseConnection is the anomaly type for database connections.
- AnomalyDatabaseConnection AnomalyType = "bb.anomaly.database.connection"
- // AnomalyDatabaseSchemaDrift is the anomaly type for database schema drifts.
- AnomalyDatabaseSchemaDrift AnomalyType = "bb.anomaly.database.schema.drift"
-)
diff --git a/backend/migrator/migration/3.6/0000##deprecate_anomaly.sql b/backend/migrator/migration/3.6/0000##deprecate_anomaly.sql
new file mode 100644
index 0000000000..5909830c23
--- /dev/null
+++ b/backend/migrator/migration/3.6/0000##deprecate_anomaly.sql
@@ -0,0 +1 @@
+DROP TABLE IF EXISTS anomaly;
\ No newline at end of file
diff --git a/backend/migrator/migration/LATEST.sql b/backend/migrator/migration/LATEST.sql
index b345887fe5..48eb00ca8c 100644
--- a/backend/migrator/migration/LATEST.sql
+++ b/backend/migrator/migration/LATEST.sql
@@ -391,24 +391,6 @@ CREATE INDEX idx_query_history_creator_id_created_at_project_id ON query_history
ALTER SEQUENCE query_history_id_seq RESTART WITH 101;
--- Anomaly
--- anomaly stores various anomalies found by the scanner.
--- For now, anomaly can be associated with a particular instance or database.
-CREATE TABLE anomaly (
- id serial PRIMARY KEY,
- updated_at timestamptz NOT NULL DEFAULT now(),
- project text NOT NULL,
- instance text NOT NULL,
- db_name text NOT NULL,
- type text NOT NULL CHECK (type LIKE 'bb.anomaly.%'),
- payload jsonb NOT NULL DEFAULT '{}',
- CONSTRAINT anomaly_instance_db_name_fkey FOREIGN KEY(instance, db_name) REFERENCES db(instance, name)
-);
-
-CREATE UNIQUE INDEX idx_anomaly_unique_project_instance_dn_name_type ON anomaly(project, instance, db_name, type);
-
-ALTER SEQUENCE anomaly_id_seq RESTART WITH 101;
-
-- worksheet table stores worksheets in SQL Editor.
CREATE TABLE worksheet (
id serial PRIMARY KEY,
diff --git a/backend/migrator/migrator_test.go b/backend/migrator/migrator_test.go
index f622c0cf65..8a23be9226 100644
--- a/backend/migrator/migrator_test.go
+++ b/backend/migrator/migrator_test.go
@@ -12,7 +12,7 @@ import (
func TestLatestVersion(t *testing.T) {
files, err := getSortedVersionedFiles()
require.NoError(t, err)
- require.Equal(t, semver.MustParse("3.5.17"), *files[len(files)-1].version)
+ require.Equal(t, semver.MustParse("3.6.0"), *files[len(files)-1].version)
}
func TestGetVersionFromPath(t *testing.T) {
diff --git a/backend/runner/schemasync/syncer.go b/backend/runner/schemasync/syncer.go
index 361197d174..d6ff95b074 100644
--- a/backend/runner/schemasync/syncer.go
+++ b/backend/runner/schemasync/syncer.go
@@ -356,11 +356,9 @@ func (s *Syncer) SyncDatabaseSchemaToHistory(ctx context.Context, database *stor
}
driver, err := s.dbFactory.GetAdminDatabaseDriver(ctx, instance, database, db.ConnectionContext{})
if err != nil {
- s.upsertDatabaseConnectionAnomaly(ctx, database, err)
return 0, err
}
defer driver.Close(ctx)
- s.upsertDatabaseConnectionAnomaly(ctx, database, nil)
// Sync database schema
deadlineCtx, cancelFunc := context.WithDeadline(ctx, time.Now().Add(syncTimeout))
defer cancelFunc()
@@ -460,11 +458,9 @@ func (s *Syncer) SyncDatabaseSchema(ctx context.Context, database *store.Databas
}
driver, err := s.dbFactory.GetAdminDatabaseDriver(ctx, instance, database, db.ConnectionContext{})
if err != nil {
- s.upsertDatabaseConnectionAnomaly(ctx, database, err)
return err
}
defer driver.Close(ctx)
- s.upsertDatabaseConnectionAnomaly(ctx, database, nil)
// Sync database schema
deadlineCtx, cancelFunc := context.WithDeadline(ctx, time.Now().Add(syncTimeout))
defer cancelFunc()
@@ -550,7 +546,7 @@ func (s *Syncer) SyncDatabaseSchema(ctx context.Context, database *store.Databas
func (s *Syncer) getSchemaDrifted(ctx context.Context, instance *store.InstanceMessage, database *store.DatabaseMessage, rawDump string) (bool, error) {
// Redis and MongoDB are schemaless.
- if disableSchemaDriftAnomalyCheck(instance.Metadata.GetEngine()) {
+ if disableSchemaDriftCheck(instance.Metadata.GetEngine()) {
return false, nil
}
limit := 1
@@ -614,37 +610,6 @@ func (s *Syncer) hasBackupSchema(ctx context.Context, instance *store.InstanceMe
return false
}
-func (s *Syncer) upsertDatabaseConnectionAnomaly(ctx context.Context, database *store.DatabaseMessage, connErr error) {
- if connErr != nil {
- if _, err := s.store.UpsertActiveAnomalyV2(ctx, &store.AnomalyMessage{
- ProjectID: database.ProjectID,
- InstanceID: database.InstanceID,
- DatabaseName: database.DatabaseName,
- Type: base.AnomalyDatabaseConnection,
- }); err != nil {
- slog.Error("Failed to create anomaly",
- slog.String("instance", database.InstanceID),
- slog.String("database", database.DatabaseName),
- slog.String("type", string(base.AnomalyDatabaseConnection)),
- log.BBError(err))
- }
- return
- }
-
- err := s.store.DeleteAnomalyV2(ctx, &store.DeleteAnomalyMessage{
- InstanceID: database.InstanceID,
- DatabaseName: database.DatabaseName,
- Type: base.AnomalyDatabaseConnection,
- })
- if err != nil && common.ErrorCode(err) != common.NotFound {
- slog.Error("Failed to close anomaly",
- slog.String("instance", database.InstanceID),
- slog.String("database", database.DatabaseName),
- slog.String("type", string(base.AnomalyDatabaseConnection)),
- log.BBError(err))
- }
-}
-
func setClassificationAndUserCommentFromComment(dbSchema *storepb.DatabaseSchemaMetadata, databaseConfig *model.DatabaseConfig, classificationConfig *storepb.DataClassificationSetting_DataClassificationConfig) {
for _, schema := range dbSchema.Schemas {
schemaConfig := databaseConfig.CreateOrGetSchemaConfig(schema.Name)
@@ -715,7 +680,7 @@ func getOrDefaultLastSyncTime(t *timestamppb.Timestamp) time.Time {
return time.Unix(0, 0)
}
-func disableSchemaDriftAnomalyCheck(dbTp storepb.Engine) bool {
+func disableSchemaDriftCheck(dbTp storepb.Engine) bool {
m := map[storepb.Engine]struct{}{
storepb.Engine_MONGODB: {},
storepb.Engine_REDIS: {},
diff --git a/backend/server/grpc_routes.go b/backend/server/grpc_routes.go
index 0d612262dd..c0060c8801 100644
--- a/backend/server/grpc_routes.go
+++ b/backend/server/grpc_routes.go
@@ -68,7 +68,6 @@ func configureGrpcRouters(
v1pb.RegisterWorkspaceServiceServer(grpcServer, apiv1.NewWorkspaceService(stores, iamManager))
v1pb.RegisterIdentityProviderServiceServer(grpcServer, apiv1.NewIdentityProviderService(stores, licenseService))
v1pb.RegisterSettingServiceServer(grpcServer, apiv1.NewSettingService(stores, profile, licenseService, stateCfg))
- v1pb.RegisterAnomalyServiceServer(grpcServer, apiv1.NewAnomalyService(stores))
sqlService := apiv1.NewSQLService(stores, sheetManager, schemaSyncer, dbFactory, licenseService, profile, iamManager)
v1pb.RegisterSQLServiceServer(grpcServer, sqlService)
v1pb.RegisterRiskServiceServer(grpcServer, apiv1.NewRiskService(stores, licenseService))
@@ -109,9 +108,6 @@ func configureGrpcRouters(
if err := v1pb.RegisterUserServiceHandler(ctx, mux, grpcConn); err != nil {
return err
}
- if err := v1pb.RegisterAnomalyServiceHandler(ctx, mux, grpcConn); err != nil {
- return err
- }
if err := v1pb.RegisterAuditLogServiceHandler(ctx, mux, grpcConn); err != nil {
return err
}
diff --git a/backend/store/anomaly.go b/backend/store/anomaly.go
deleted file mode 100644
index 1c57eeb84f..0000000000
--- a/backend/store/anomaly.go
+++ /dev/null
@@ -1,176 +0,0 @@
-package store
-
-import (
- "context"
- "database/sql"
- "fmt"
- "strings"
- "time"
-
- "github.com/pkg/errors"
-
- "github.com/bytebase/bytebase/backend/base"
-)
-
-// AnomalyMessage is the message of the anomaly.
-type AnomalyMessage struct {
- ProjectID string
- InstanceID string
- DatabaseName string
- // Type is the type of the anomaly.
- Type base.AnomalyType
- // Output only fields.
- //
- // UID is the unique identifier of the anomaly.
- UID int
- // UpdatedAt is the timestamp when the anomaly is updated.
- UpdatedAt time.Time
-}
-
-// ListAnomalyMessage is the message to list anomalies.
-type ListAnomalyMessage struct {
- ProjectID string
- InstanceID *string
- DatabaseName *string
- Types []base.AnomalyType
-}
-
-// DeleteAnomalyMessage is the message to delete an anomaly.
-type DeleteAnomalyMessage struct {
- InstanceID string
- DatabaseName string
- Type base.AnomalyType
-}
-
-// UpsertActiveAnomalyV2 upserts an instance of anomaly.
-func (s *Store) UpsertActiveAnomalyV2(ctx context.Context, upsert *AnomalyMessage) (*AnomalyMessage, error) {
- tx, err := s.db.BeginTx(ctx, nil)
- if err != nil {
- return nil, err
- }
- defer tx.Rollback()
-
- upsert.UpdatedAt = time.Now()
- query := `
- INSERT INTO anomaly (
- updated_at,
- project,
- instance,
- db_name,
- type
- )
- VALUES ($1, $2, $3, $4, $5)
- ON CONFLICT (project, instance, db_name, type) DO UPDATE SET
- updated_at = EXCLUDED.updated_at
-`
- if _, err := tx.ExecContext(ctx, query,
- upsert.UpdatedAt,
- upsert.ProjectID,
- upsert.InstanceID,
- upsert.DatabaseName,
- upsert.Type,
- ); err != nil {
- return nil, err
- }
- if err := tx.Commit(); err != nil {
- return nil, err
- }
-
- return upsert, nil
-}
-
-// ListAnomalyV2 lists anomalies, only return the normal ones.
-func (s *Store) ListAnomalyV2(ctx context.Context, list *ListAnomalyMessage) ([]*AnomalyMessage, error) {
- // Build where clause
- txn, err := s.db.BeginTx(ctx, &sql.TxOptions{ReadOnly: true})
- if err != nil {
- return nil, errors.Wrapf(err, "failed to begin transaction")
- }
- defer txn.Rollback()
-
- anomalies, err := s.listAnomalyImplV2(ctx, txn, list)
- if err != nil {
- return nil, err
- }
-
- if err := txn.Commit(); err != nil {
- return nil, errors.Wrapf(err, "failed to commit transaction")
- }
-
- return anomalies, nil
-}
-
-// DeleteAnomalyV2 deletes an anomaly.
-func (s *Store) DeleteAnomalyV2(ctx context.Context, d *DeleteAnomalyMessage) error {
- tx, err := s.db.BeginTx(ctx, nil)
- if err != nil {
- return err
- }
- defer tx.Rollback()
-
- if _, err := tx.ExecContext(ctx,
- `DELETE FROM anomaly WHERE instance = $1 AND db_name = $2 AND type = $3`,
- d.InstanceID,
- d.DatabaseName,
- d.Type,
- ); err != nil {
- return err
- }
-
- return tx.Commit()
-}
-
-func (*Store) listAnomalyImplV2(ctx context.Context, txn *sql.Tx, list *ListAnomalyMessage) ([]*AnomalyMessage, error) {
- where, args := []string{"TRUE"}, []any{}
- where, args = append(where, fmt.Sprintf("project = $%d", len(args)+1)), append(args, list.ProjectID)
- if v := list.InstanceID; v != nil {
- where, args = append(where, fmt.Sprintf("instance = $%d", len(args)+1)), append(args, *v)
- }
- if v := list.DatabaseName; v != nil {
- where, args = append(where, fmt.Sprintf("db_name = $%d", len(args)+1)), append(args, *v)
- }
- if len(list.Types) > 0 {
- var sub []string
- for _, v := range list.Types {
- sub, args = append(sub, fmt.Sprintf("$%d", len(args)+1)), append(args, v)
- }
- where = append(where, fmt.Sprintf("type IN (%s)", strings.Join(sub, `,`)))
- }
-
- query := fmt.Sprintf(`
- SELECT
- id,
- updated_at,
- instance,
- db_name,
- type
- FROM anomaly
- WHERE %s
- `, strings.Join(where, " AND "))
-
- rows, err := txn.QueryContext(ctx, query, args...)
- if err != nil {
- return nil, err
- }
- defer rows.Close()
-
- var anomalies []*AnomalyMessage
- for rows.Next() {
- var anomaly AnomalyMessage
- if err := rows.Scan(
- &anomaly.UID,
- &anomaly.UpdatedAt,
- &anomaly.InstanceID,
- &anomaly.DatabaseName,
- &anomaly.Type,
- ); err != nil {
- return nil, err
- }
- anomalies = append(anomalies, &anomaly)
- }
- if err := rows.Err(); err != nil {
- return nil, err
- }
-
- return anomalies, nil
-}
diff --git a/docs/assets/anomaly-center.webp b/docs/assets/anomaly-center.webp
deleted file mode 100644
index 0f0d6588a0..0000000000
Binary files a/docs/assets/anomaly-center.webp and /dev/null differ
diff --git a/frontend/public/help/routeMapList.json b/frontend/public/help/routeMapList.json
index 1a0fcbe20c..13cf451d42 100644
--- a/frontend/public/help/routeMapList.json
+++ b/frontend/public/help/routeMapList.json
@@ -31,10 +31,6 @@
"routeName": "error.404",
"helpName": ""
},
- {
- "routeName": "workspace.anomaly-center",
- "helpName": ""
- },
{
"routeName": "workspace.archive",
"helpName": ""
diff --git a/frontend/src/components/Database/DatabaseOverviewPanel.vue b/frontend/src/components/Database/DatabaseOverviewPanel.vue
index 8e4bc55264..ad39222f4f 100644
--- a/frontend/src/components/Database/DatabaseOverviewPanel.vue
+++ b/frontend/src/components/Database/DatabaseOverviewPanel.vue
@@ -159,7 +159,6 @@ import ViewDataTable from "@/components/ViewDataTable.vue";
import { SQL_EDITOR_SETTING_DATABASES_MODULE } from "@/router/sqlEditor";
import { useDBSchemaV1Store } from "@/store";
import type { ComposedDatabase } from "@/types";
-import type { Anomaly } from "@/types/proto/v1/anomaly_service";
import { Engine } from "@/types/proto/v1/common";
import {
hasSchemaProperty,
@@ -179,7 +178,6 @@ interface LocalState {
const props = defineProps<{
database: ComposedDatabase;
- anomalyList: Anomaly[];
}>();
const { t } = useI18n();
diff --git a/frontend/src/grpcweb/index.ts b/frontend/src/grpcweb/index.ts
index de33b08fca..75808bb03b 100644
--- a/frontend/src/grpcweb/index.ts
+++ b/frontend/src/grpcweb/index.ts
@@ -1,20 +1,11 @@
-import { errorDetailsClientMiddleware } from "nice-grpc-error-details";
-import {
- createChannel,
- createClientFactory,
- FetchTransport,
- WebsocketTransport,
-} from "nice-grpc-web";
import { ActuatorServiceDefinition } from "@/types/proto/v1/actuator_service";
-import { AnomalyServiceDefinition } from "@/types/proto/v1/anomaly_service";
import { AuditLogServiceDefinition } from "@/types/proto/v1/audit_log_service";
import { AuthServiceDefinition } from "@/types/proto/v1/auth_service";
-import { UserServiceDefinition } from "@/types/proto/v1/user_service";
import { CelServiceDefinition } from "@/types/proto/v1/cel_service";
import { ChangelistServiceDefinition } from "@/types/proto/v1/changelist_service";
+import { DatabaseCatalogServiceDefinition } from "@/types/proto/v1/database_catalog_service";
import { DatabaseGroupServiceDefinition } from "@/types/proto/v1/database_group_service";
import { DatabaseServiceDefinition } from "@/types/proto/v1/database_service";
-import { DatabaseCatalogServiceDefinition } from "@/types/proto/v1/database_catalog_service";
import { EnvironmentServiceDefinition } from "@/types/proto/v1/environment_service";
import { GroupServiceDefinition } from "@/types/proto/v1/group_service";
import { IdentityProviderServiceDefinition } from "@/types/proto/v1/idp_service";
@@ -33,8 +24,16 @@ import { SettingServiceDefinition } from "@/types/proto/v1/setting_service";
import { SheetServiceDefinition } from "@/types/proto/v1/sheet_service";
import { SQLServiceDefinition } from "@/types/proto/v1/sql_service";
import { SubscriptionServiceDefinition } from "@/types/proto/v1/subscription_service";
+import { UserServiceDefinition } from "@/types/proto/v1/user_service";
import { WorksheetServiceDefinition } from "@/types/proto/v1/worksheet_service";
import { WorkspaceServiceDefinition } from "@/types/proto/v1/workspace_service";
+import { errorDetailsClientMiddleware } from "nice-grpc-error-details";
+import {
+ createChannel,
+ createClientFactory,
+ FetchTransport,
+ WebsocketTransport,
+} from "nice-grpc-web";
import {
authInterceptorMiddleware,
errorNotificationMiddleware,
@@ -187,11 +186,6 @@ export const actuatorServiceClient = clientFactory.create(
channel
);
-export const anomalyServiceClient = clientFactory.create(
- AnomalyServiceDefinition,
- channel
-);
-
export const changelistServiceClient = clientFactory.create(
ChangelistServiceDefinition,
channel
diff --git a/frontend/src/grpcweb/methods.ts b/frontend/src/grpcweb/methods.ts
index a100025e72..75788e71ed 100644
--- a/frontend/src/grpcweb/methods.ts
+++ b/frontend/src/grpcweb/methods.ts
@@ -1,5 +1,4 @@
import { ActuatorServiceDefinition } from "@/types/proto/v1/actuator_service";
-import { AnomalyServiceDefinition } from "@/types/proto/v1/anomaly_service";
import { AuditLogServiceDefinition } from "@/types/proto/v1/audit_log_service";
import { AuthServiceDefinition } from "@/types/proto/v1/auth_service";
import { CelServiceDefinition } from "@/types/proto/v1/cel_service";
@@ -37,7 +36,6 @@ const AUDIT_TAG_CODE = "800024";
// Format: /bytebase.v1.ServiceName/MethodName
export const ALL_METHODS_WITH_AUDIT = [
ActuatorServiceDefinition,
- AnomalyServiceDefinition,
AuditLogServiceDefinition,
AuthServiceDefinition,
CelServiceDefinition,
diff --git a/frontend/src/store/modules/v1/anomaly.ts b/frontend/src/store/modules/v1/anomaly.ts
deleted file mode 100644
index 97de915db7..0000000000
--- a/frontend/src/store/modules/v1/anomaly.ts
+++ /dev/null
@@ -1,26 +0,0 @@
-import { defineStore } from "pinia";
-import { anomalyServiceClient } from "@/grpcweb";
-import type { FindAnomalyMessage } from "@/types";
-
-const buildFilter = (find: FindAnomalyMessage): string => {
- const filter: string[] = [];
- if (find.database) {
- filter.push(`resource = "${find.database}".`);
- }
- if (find.type) {
- filter.push(`type = "${find.type}".`);
- }
- return filter.join(" && ");
-};
-
-export const useAnomalyV1Store = defineStore("anomaly_v1", {
- actions: {
- async fetchAnomalyList(project: string, find: FindAnomalyMessage) {
- const resp = await anomalyServiceClient.searchAnomalies({
- parent: project,
- filter: buildFilter(find),
- });
- return resp.anomalies;
- },
- },
-});
diff --git a/frontend/src/store/modules/v1/index.ts b/frontend/src/store/modules/v1/index.ts
index e6d2199841..5169b5b807 100644
--- a/frontend/src/store/modules/v1/index.ts
+++ b/frontend/src/store/modules/v1/index.ts
@@ -1,30 +1,30 @@
-export * from "./environment";
+export * from "./actuator";
+export * from "./auditLog";
+export * from "./changelist";
+export * from "./changelog";
+export * from "./common";
export * from "./database";
-export * from "./project";
-export * from "./projectIamPolicy";
-export * from "./projectWebhook";
+export * from "./databaseCatalog";
export * from "./databaseSecret";
-export * from "./sheet";
-export * from "./worksheet";
-export * from "./localSheet";
-export * from "./policy";
-export * from "./setting";
+export * from "./dbSchema";
+export * from "./environment";
+export * from "./experimental-issue";
+export * from "./group";
export * from "./instance";
+export * from "./instanceResource";
export * from "./issue";
-export * from "./experimental-issue";
-export * from "./subscription";
-export * from "./actuator";
-export * from "./sql";
-export * from "./dbSchema";
-export * from "./databaseCatalog";
-export * from "./anomaly";
-export * from "./changelist";
export * from "./issueComment";
-export * from "./auditLog";
-export * from "./group";
+export * from "./localSheet";
export * from "./permission";
-export * from "./workspace";
-export * from "./instanceResource";
+export * from "./policy";
+export * from "./project";
+export * from "./projectIamPolicy";
+export * from "./projectWebhook";
+export * from "./setting";
+export * from "./sheet";
+export * from "./sql";
export * from "./storage";
-export * from "./changelog";
-export * from "./common";
+export * from "./subscription";
+export * from "./worksheet";
+export * from "./workspace";
+
diff --git a/frontend/src/types/anomaly.ts b/frontend/src/types/anomaly.ts
deleted file mode 100644
index 57faad1a7b..0000000000
--- a/frontend/src/types/anomaly.ts
+++ /dev/null
@@ -1,6 +0,0 @@
-import type { Anomaly_AnomalyType } from "@/types/proto/v1/anomaly_service";
-
-export interface FindAnomalyMessage {
- database?: string;
- type?: Anomaly_AnomalyType;
-}
diff --git a/frontend/src/types/index.ts b/frontend/src/types/index.ts
index a3eb39a25c..548c982a77 100644
--- a/frontend/src/types/index.ts
+++ b/frontend/src/types/index.ts
@@ -1,34 +1,34 @@
export * from "./actuator";
-export * from "./anomaly";
+export * from "./appProfile";
export * from "./auditLog";
+export * from "./changelog";
export * from "./common";
export * from "./const";
export * from "./dataSource";
+export * from "./dbGroup";
export * from "./error";
export * from "./help";
+export * from "./iam";
export * from "./id";
export * from "./issue";
+export * from "./member";
+export * from "./misc";
export * from "./notification";
export * from "./oauth";
export * from "./plan";
-export * from "./member";
-export * from "./store";
-export * from "./sqlEditor";
+export * from "./release";
+export * from "./review";
+export * from "./risk";
+export * from "./rollout";
+export * from "./semanticTypes";
+export * from "./setting";
export * from "./sheet";
+export * from "./sqlEditor";
export * from "./sqlReview";
+export * from "./store";
export * from "./utils";
-export * from "./risk";
export * from "./workspaceApprovalSetting";
-export * from "./review";
-export * from "./dbGroup";
-export * from "./setting";
-export * from "./changelog";
-export * from "./semanticTypes";
-export * from "./iam";
-export * from "./misc";
-export * from "./appProfile";
-export * from "./release";
-export * from "./rollout";
-export * from "./v1";
export * from "./timestamp";
+export * from "./v1";
+
diff --git a/frontend/src/types/proto/store/anomaly.ts b/frontend/src/types/proto/store/anomaly.ts
deleted file mode 100644
index 1099f94ba7..0000000000
--- a/frontend/src/types/proto/store/anomaly.ts
+++ /dev/null
@@ -1,196 +0,0 @@
-// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
-// versions:
-// protoc-gen-ts_proto v2.3.0
-// protoc unknown
-// source: store/anomaly.proto
-
-/* eslint-disable */
-import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
-import Long from "long";
-
-export const protobufPackage = "bytebase.store";
-
-export interface AnomalyConnectionPayload {
- /** Connection failure detail */
- detail: string;
-}
-
-export interface AnomalyDatabaseSchemaDriftPayload {
- /** The schema version corresponds to the expected schema */
- version: string;
- /** The expected latest schema stored in the migration history table */
- expect: string;
- /** The actual schema dumped from the database */
- actual: string;
-}
-
-function createBaseAnomalyConnectionPayload(): AnomalyConnectionPayload {
- return { detail: "" };
-}
-
-export const AnomalyConnectionPayload: MessageFns<AnomalyConnectionPayload> = {
- encode(message: AnomalyConnectionPayload, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
- if (message.detail !== "") {
- writer.uint32(10).string(message.detail);
- }
- return writer;
- },
-
- decode(input: BinaryReader | Uint8Array, length?: number): AnomalyConnectionPayload {
- const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
- let end = length === undefined ? reader.len : reader.pos + length;
- const message = createBaseAnomalyConnectionPayload();
- while (reader.pos < end) {
- const tag = reader.uint32();
- switch (tag >>> 3) {
- case 1: {
- if (tag !== 10) {
- break;
- }
-
- message.detail = reader.string();
- continue;
- }
- }
- if ((tag & 7) === 4 || tag === 0) {
- break;
- }
- reader.skip(tag & 7);
- }
- return message;
- },
-
- fromJSON(object: any): AnomalyConnectionPayload {
- return { detail: isSet(object.detail) ? globalThis.String(object.detail) : "" };
- },
-
- toJSON(message: AnomalyConnectionPayload): unknown {
- const obj: any = {};
- if (message.detail !== "") {
- obj.detail = message.detail;
- }
- return obj;
- },
-
- create(base?: DeepPartial<AnomalyConnectionPayload>): AnomalyConnectionPayload {
- return AnomalyConnectionPayload.fromPartial(base ?? {});
- },
- fromPartial(object: DeepPartial<AnomalyConnectionPayload>): AnomalyConnectionPayload {
- const message = createBaseAnomalyConnectionPayload();
- message.detail = object.detail ?? "";
- return message;
- },
-};
-
-function createBaseAnomalyDatabaseSchemaDriftPayload(): AnomalyDatabaseSchemaDriftPayload {
- return { version: "", expect: "", actual: "" };
-}
-
-export const AnomalyDatabaseSchemaDriftPayload: MessageFns<AnomalyDatabaseSchemaDriftPayload> = {
- encode(message: AnomalyDatabaseSchemaDriftPayload, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
- if (message.version !== "") {
- writer.uint32(10).string(message.version);
- }
- if (message.expect !== "") {
- writer.uint32(18).string(message.expect);
- }
- if (message.actual !== "") {
- writer.uint32(26).string(message.actual);
- }
- return writer;
- },
-
- decode(input: BinaryReader | Uint8Array, length?: number): AnomalyDatabaseSchemaDriftPayload {
- const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
- let end = length === undefined ? reader.len : reader.pos + length;
- const message = createBaseAnomalyDatabaseSchemaDriftPayload();
- while (reader.pos < end) {
- const tag = reader.uint32();
- switch (tag >>> 3) {
- case 1: {
- if (tag !== 10) {
- break;
- }
-
- message.version = reader.string();
- continue;
- }
- case 2: {
- if (tag !== 18) {
- break;
- }
-
- message.expect = reader.string();
- continue;
- }
- case 3: {
- if (tag !== 26) {
- break;
- }
-
- message.actual = reader.string();
- continue;
- }
- }
- if ((tag & 7) === 4 || tag === 0) {
- break;
- }
- reader.skip(tag & 7);
- }
- return message;
- },
-
- fromJSON(object: any): AnomalyDatabaseSchemaDriftPayload {
- return {
- version: isSet(object.version) ? globalThis.String(object.version) : "",
- expect: isSet(object.expect) ? globalThis.String(object.expect) : "",
- actual: isSet(object.actual) ? globalThis.String(object.actual) : "",
- };
- },
-
- toJSON(message: AnomalyDatabaseSchemaDriftPayload): unknown {
- const obj: any = {};
- if (message.version !== "") {
- obj.version = message.version;
- }
- if (message.expect !== "") {
- obj.expect = message.expect;
- }
- if (message.actual !== "") {
- obj.actual = message.actual;
- }
- return obj;
- },
-
- create(base?: DeepPartial<AnomalyDatabaseSchemaDriftPayload>): AnomalyDatabaseSchemaDriftPayload {
- return AnomalyDatabaseSchemaDriftPayload.fromPartial(base ?? {});
- },
- fromPartial(object: DeepPartial<AnomalyDatabaseSchemaDriftPayload>): AnomalyDatabaseSchemaDriftPayload {
- const message = createBaseAnomalyDatabaseSchemaDriftPayload();
- message.version = object.version ?? "";
- message.expect = object.expect ?? "";
- message.actual = object.actual ?? "";
- return message;
- },
-};
-
-type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
-
-export type DeepPartial<T> = T extends Builtin ? T
- : T extends Long ? string | number | Long : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
- : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
- : T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }
- : Partial<T>;
-
-function isSet(value: any): boolean {
- return value !== null && value !== undefined;
-}
-
-export interface MessageFns<T> {
- encode(message: T, writer?: BinaryWriter): BinaryWriter;
- decode(input: BinaryReader | Uint8Array, length?: number): T;
- fromJSON(object: any): T;
- toJSON(message: T): unknown;
- create(base?: DeepPartial<T>): T;
- fromPartial(object: DeepPartial<T>): T;
-}
diff --git a/frontend/src/types/proto/v1/anomaly_service.ts b/frontend/src/types/proto/v1/anomaly_service.ts
deleted file mode 100644
index 7de560e561..0000000000
--- a/frontend/src/types/proto/v1/anomaly_service.ts
+++ /dev/null
@@ -1,622 +0,0 @@
-// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
-// versions:
-// protoc-gen-ts_proto v2.3.0
-// protoc unknown
-// source: v1/anomaly_service.proto
-
-/* eslint-disable */
-import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
-import Long from "long";
-import { Timestamp } from "../google/protobuf/timestamp";
-
-export const protobufPackage = "bytebase.v1";
-
-export interface SearchAnomaliesRequest {
- /**
- * The parent resource whose anomalies are to be listed.
- * Format: projects/{project}
- */
- parent: string;
- /**
- * filter is the filter to apply on the search anomaly request,
- * follow the [ebnf](https://en.wikipedia.org/wiki/Extended_Backus%E2%80%93Naur_form) syntax.
- * Only support filter by resource and type for now.
- * For example:
- * Search the anomalies of a specific resource: 'resource="instances/{instance}/databases/{database}".'
- * Search the specified types of anomalies: 'type="MIGRATION_SCHEMA".'
- */
- filter: string;
- /**
- * Not used.
- * The maximum number of anomalies to return. The service may return fewer than
- * this value.
- * If unspecified, at most 10 anomalies will be returned.
- * The maximum value is 1000; values above 1000 will be coerced to 1000.
- */
- pageSize: number;
- /**
- * Not used.
- * A page token, received from a previous `SearchAnomalies` call.
- * Provide this to retrieve the subsequent page.
- *
- * When paginating, all other parameters provided to `SearchAnomalies` must match
- * the call that provided the page token.
- */
- pageToken: string;
-}
-
-export interface SearchAnomaliesResponse {
- /** anomalies is the list of anomalies. */
- anomalies: Anomaly[];
- /**
- * Not used. A token, which can be sent as `page_token` to retrieve the next page.
- * If this field is omitted, there are no subsequent pages.
- */
- nextPageToken: string;
-}
-
-export interface Anomaly {
- /**
- * The resource that is the target of the operation.
- * Format:
- * - Database: instances/{instance}/databases/{database}
- */
- resource: string;
- /** type is the type of the anomaly. */
- type: Anomaly_AnomalyType;
- /** severity is the severity of the anomaly. */
- severity: Anomaly_AnomalySeverity;
- createTime: Timestamp | undefined;
-}
-
-/** AnomalyType is the type of the anomaly. */
-export enum Anomaly_AnomalyType {
- /** ANOMALY_TYPE_UNSPECIFIED - Unspecified anomaly type. */
- ANOMALY_TYPE_UNSPECIFIED = "ANOMALY_TYPE_UNSPECIFIED",
- /**
- * DATABASE_CONNECTION - Database level anomaly.
- *
- * DATABASE_CONNECTION is the anomaly type for database connection, e.g. the database had been deleted.
- */
- DATABASE_CONNECTION = "DATABASE_CONNECTION",
- /**
- * DATABASE_SCHEMA_DRIFT - DATABASE_SCHEMA_DRIFT is the anomaly type for database schema drift,
- * e.g. the database schema had been changed without bytebase migration.
- */
- DATABASE_SCHEMA_DRIFT = "DATABASE_SCHEMA_DRIFT",
- UNRECOGNIZED = "UNRECOGNIZED",
-}
-
-export function anomaly_AnomalyTypeFromJSON(object: any): Anomaly_AnomalyType {
- switch (object) {
- case 0:
- case "ANOMALY_TYPE_UNSPECIFIED":
- return Anomaly_AnomalyType.ANOMALY_TYPE_UNSPECIFIED;
- case 5:
- case "DATABASE_CONNECTION":
- return Anomaly_AnomalyType.DATABASE_CONNECTION;
- case 6:
- case "DATABASE_SCHEMA_DRIFT":
- return Anomaly_AnomalyType.DATABASE_SCHEMA_DRIFT;
- case -1:
- case "UNRECOGNIZED":
- default:
- return Anomaly_AnomalyType.UNRECOGNIZED;
- }
-}
-
-export function anomaly_AnomalyTypeToJSON(object: Anomaly_AnomalyType): string {
- switch (object) {
- case Anomaly_AnomalyType.ANOMALY_TYPE_UNSPECIFIED:
- return "ANOMALY_TYPE_UNSPECIFIED";
- case Anomaly_AnomalyType.DATABASE_CONNECTION:
- return "DATABASE_CONNECTION";
- case Anomaly_AnomalyType.DATABASE_SCHEMA_DRIFT:
- return "DATABASE_SCHEMA_DRIFT";
- case Anomaly_AnomalyType.UNRECOGNIZED:
- default:
- return "UNRECOGNIZED";
- }
-}
-
-export function anomaly_AnomalyTypeToNumber(object: Anomaly_AnomalyType): number {
- switch (object) {
- case Anomaly_AnomalyType.ANOMALY_TYPE_UNSPECIFIED:
- return 0;
- case Anomaly_AnomalyType.DATABASE_CONNECTION:
- return 5;
- case Anomaly_AnomalyType.DATABASE_SCHEMA_DRIFT:
- return 6;
- case Anomaly_AnomalyType.UNRECOGNIZED:
- default:
- return -1;
- }
-}
-
-/** AnomalySeverity is the severity of the anomaly. */
-export enum Anomaly_AnomalySeverity {
- /** ANOMALY_SEVERITY_UNSPECIFIED - Unspecified anomaly severity. */
- ANOMALY_SEVERITY_UNSPECIFIED = "ANOMALY_SEVERITY_UNSPECIFIED",
- /** MEDIUM - MEDIUM is the info level anomaly severity. */
- MEDIUM = "MEDIUM",
- /** HIGH - HIGH is the warning level anomaly severity. */
- HIGH = "HIGH",
- /** CRITICAL - CRITICAL is the critical level anomaly severity. */
- CRITICAL = "CRITICAL",
- UNRECOGNIZED = "UNRECOGNIZED",
-}
-
-export function anomaly_AnomalySeverityFromJSON(object: any): Anomaly_AnomalySeverity {
- switch (object) {
- case 0:
- case "ANOMALY_SEVERITY_UNSPECIFIED":
- return Anomaly_AnomalySeverity.ANOMALY_SEVERITY_UNSPECIFIED;
- case 1:
- case "MEDIUM":
- return Anomaly_AnomalySeverity.MEDIUM;
- case 2:
- case "HIGH":
- return Anomaly_AnomalySeverity.HIGH;
- case 3:
- case "CRITICAL":
- return Anomaly_AnomalySeverity.CRITICAL;
- case -1:
- case "UNRECOGNIZED":
- default:
- return Anomaly_AnomalySeverity.UNRECOGNIZED;
- }
-}
-
-export function anomaly_AnomalySeverityToJSON(object: Anomaly_AnomalySeverity): string {
- switch (object) {
- case Anomaly_AnomalySeverity.ANOMALY_SEVERITY_UNSPECIFIED:
- return "ANOMALY_SEVERITY_UNSPECIFIED";
- case Anomaly_AnomalySeverity.MEDIUM:
- return "MEDIUM";
- case Anomaly_AnomalySeverity.HIGH:
- return "HIGH";
- case Anomaly_AnomalySeverity.CRITICAL:
- return "CRITICAL";
- case Anomaly_AnomalySeverity.UNRECOGNIZED:
- default:
- return "UNRECOGNIZED";
- }
-}
-
-export function anomaly_AnomalySeverityToNumber(object: Anomaly_AnomalySeverity): number {
- switch (object) {
- case Anomaly_AnomalySeverity.ANOMALY_SEVERITY_UNSPECIFIED:
- return 0;
- case Anomaly_AnomalySeverity.MEDIUM:
- return 1;
- case Anomaly_AnomalySeverity.HIGH:
- return 2;
- case Anomaly_AnomalySeverity.CRITICAL:
- return 3;
- case Anomaly_AnomalySeverity.UNRECOGNIZED:
- default:
- return -1;
- }
-}
-
-function createBaseSearchAnomaliesRequest(): SearchAnomaliesRequest {
- return { parent: "", filter: "", pageSize: 0, pageToken: "" };
-}
-
-export const SearchAnomaliesRequest: MessageFns<SearchAnomaliesRequest> = {
- encode(message: SearchAnomaliesRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
- if (message.parent !== "") {
- writer.uint32(10).string(message.parent);
- }
- if (message.filter !== "") {
- writer.uint32(18).string(message.filter);
- }
- if (message.pageSize !== 0) {
- writer.uint32(24).int32(message.pageSize);
- }
- if (message.pageToken !== "") {
- writer.uint32(34).string(message.pageToken);
- }
- return writer;
- },
-
- decode(input: BinaryReader | Uint8Array, length?: number): SearchAnomaliesRequest {
- const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
- let end = length === undefined ? reader.len : reader.pos + length;
- const message = createBaseSearchAnomaliesRequest();
- while (reader.pos < end) {
- const tag = reader.uint32();
- switch (tag >>> 3) {
- case 1: {
- if (tag !== 10) {
- break;
- }
-
- message.parent = reader.string();
- continue;
- }
- case 2: {
- if (tag !== 18) {
- break;
- }
-
- message.filter = reader.string();
- continue;
- }
- case 3: {
- if (tag !== 24) {
- break;
- }
-
- message.pageSize = reader.int32();
- continue;
- }
- case 4: {
- if (tag !== 34) {
- break;
- }
-
- message.pageToken = reader.string();
- continue;
- }
- }
- if ((tag & 7) === 4 || tag === 0) {
- break;
- }
- reader.skip(tag & 7);
- }
- return message;
- },
-
- fromJSON(object: any): SearchAnomaliesRequest {
- return {
- parent: isSet(object.parent) ? globalThis.String(object.parent) : "",
- filter: isSet(object.filter) ? globalThis.String(object.filter) : "",
- pageSize: isSet(object.pageSize) ? globalThis.Number(object.pageSize) : 0,
- pageToken: isSet(object.pageToken) ? globalThis.String(object.pageToken) : "",
- };
- },
-
- toJSON(message: SearchAnomaliesRequest): unknown {
- const obj: any = {};
- if (message.parent !== "") {
- obj.parent = message.parent;
- }
- if (message.filter !== "") {
- obj.filter = message.filter;
- }
- if (message.pageSize !== 0) {
- obj.pageSize = Math.round(message.pageSize);
- }
- if (message.pageToken !== "") {
- obj.pageToken = message.pageToken;
- }
- return obj;
- },
-
- create(base?: DeepPartial<SearchAnomaliesRequest>): SearchAnomaliesRequest {
- return SearchAnomaliesRequest.fromPartial(base ?? {});
- },
- fromPartial(object: DeepPartial<SearchAnomaliesRequest>): SearchAnomaliesRequest {
- const message = createBaseSearchAnomaliesRequest();
- message.parent = object.parent ?? "";
- message.filter = object.filter ?? "";
- message.pageSize = object.pageSize ?? 0;
- message.pageToken = object.pageToken ?? "";
- return message;
- },
-};
-
-function createBaseSearchAnomaliesResponse(): SearchAnomaliesResponse {
- return { anomalies: [], nextPageToken: "" };
-}
-
-export const SearchAnomaliesResponse: MessageFns<SearchAnomaliesResponse> = {
- encode(message: SearchAnomaliesResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
- for (const v of message.anomalies) {
- Anomaly.encode(v!, writer.uint32(10).fork()).join();
- }
- if (message.nextPageToken !== "") {
- writer.uint32(18).string(message.nextPageToken);
- }
- return writer;
- },
-
- decode(input: BinaryReader | Uint8Array, length?: number): SearchAnomaliesResponse {
- const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
- let end = length === undefined ? reader.len : reader.pos + length;
- const message = createBaseSearchAnomaliesResponse();
- while (reader.pos < end) {
- const tag = reader.uint32();
- switch (tag >>> 3) {
- case 1: {
- if (tag !== 10) {
- break;
- }
-
- message.anomalies.push(Anomaly.decode(reader, reader.uint32()));
- continue;
- }
- case 2: {
- if (tag !== 18) {
- break;
- }
-
- message.nextPageToken = reader.string();
- continue;
- }
- }
- if ((tag & 7) === 4 || tag === 0) {
- break;
- }
- reader.skip(tag & 7);
- }
- return message;
- },
-
- fromJSON(object: any): SearchAnomaliesResponse {
- return {
- anomalies: globalThis.Array.isArray(object?.anomalies)
- ? object.anomalies.map((e: any) => Anomaly.fromJSON(e))
- : [],
- nextPageToken: isSet(object.nextPageToken) ? globalThis.String(object.nextPageToken) : "",
- };
- },
-
- toJSON(message: SearchAnomaliesResponse): unknown {
- const obj: any = {};
- if (message.anomalies?.length) {
- obj.anomalies = message.anomalies.map((e) => Anomaly.toJSON(e));
- }
- if (message.nextPageToken !== "") {
- obj.nextPageToken = message.nextPageToken;
- }
- return obj;
- },
-
- create(base?: DeepPartial<SearchAnomaliesResponse>): SearchAnomaliesResponse {
- return SearchAnomaliesResponse.fromPartial(base ?? {});
- },
- fromPartial(object: DeepPartial<SearchAnomaliesResponse>): SearchAnomaliesResponse {
- const message = createBaseSearchAnomaliesResponse();
- message.anomalies = object.anomalies?.map((e) => Anomaly.fromPartial(e)) || [];
- message.nextPageToken = object.nextPageToken ?? "";
- return message;
- },
-};
-
-function createBaseAnomaly(): Anomaly {
- return {
- resource: "",
- type: Anomaly_AnomalyType.ANOMALY_TYPE_UNSPECIFIED,
- severity: Anomaly_AnomalySeverity.ANOMALY_SEVERITY_UNSPECIFIED,
- createTime: undefined,
- };
-}
-
-export const Anomaly: MessageFns<Anomaly> = {
- encode(message: Anomaly, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
- if (message.resource !== "") {
- writer.uint32(10).string(message.resource);
- }
- if (message.type !== Anomaly_AnomalyType.ANOMALY_TYPE_UNSPECIFIED) {
- writer.uint32(16).int32(anomaly_AnomalyTypeToNumber(message.type));
- }
- if (message.severity !== Anomaly_AnomalySeverity.ANOMALY_SEVERITY_UNSPECIFIED) {
- writer.uint32(24).int32(anomaly_AnomalySeverityToNumber(message.severity));
- }
- if (message.createTime !== undefined) {
- Timestamp.encode(message.createTime, writer.uint32(74).fork()).join();
- }
- return writer;
- },
-
- decode(input: BinaryReader | Uint8Array, length?: number): Anomaly {
- const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
- let end = length === undefined ? reader.len : reader.pos + length;
- const message = createBaseAnomaly();
- while (reader.pos < end) {
- const tag = reader.uint32();
- switch (tag >>> 3) {
- case 1: {
- if (tag !== 10) {
- break;
- }
-
- message.resource = reader.string();
- continue;
- }
- case 2: {
- if (tag !== 16) {
- break;
- }
-
- message.type = anomaly_AnomalyTypeFromJSON(reader.int32());
- continue;
- }
- case 3: {
- if (tag !== 24) {
- break;
- }
-
- message.severity = anomaly_AnomalySeverityFromJSON(reader.int32());
- continue;
- }
- case 9: {
- if (tag !== 74) {
- break;
- }
-
- message.createTime = Timestamp.decode(reader, reader.uint32());
- continue;
- }
- }
- if ((tag & 7) === 4 || tag === 0) {
- break;
- }
- reader.skip(tag & 7);
- }
- return message;
- },
-
- fromJSON(object: any): Anomaly {
- return {
- resource: isSet(object.resource) ? globalThis.String(object.resource) : "",
- type: isSet(object.type)
- ? anomaly_AnomalyTypeFromJSON(object.type)
- : Anomaly_AnomalyType.ANOMALY_TYPE_UNSPECIFIED,
- severity: isSet(object.severity)
- ? anomaly_AnomalySeverityFromJSON(object.severity)
- : Anomaly_AnomalySeverity.ANOMALY_SEVERITY_UNSPECIFIED,
- createTime: isSet(object.createTime) ? fromJsonTimestamp(object.createTime) : undefined,
- };
- },
-
- toJSON(message: Anomaly): unknown {
- const obj: any = {};
- if (message.resource !== "") {
- obj.resource = message.resource;
- }
- if (message.type !== Anomaly_AnomalyType.ANOMALY_TYPE_UNSPECIFIED) {
- obj.type = anomaly_AnomalyTypeToJSON(message.type);
- }
- if (message.severity !== Anomaly_AnomalySeverity.ANOMALY_SEVERITY_UNSPECIFIED) {
- obj.severity = anomaly_AnomalySeverityToJSON(message.severity);
- }
- if (message.createTime !== undefined) {
- obj.createTime = fromTimestamp(message.createTime).toISOString();
- }
- return obj;
- },
-
- create(base?: DeepPartial<Anomaly>): Anomaly {
- return Anomaly.fromPartial(base ?? {});
- },
- fromPartial(object: DeepPartial<Anomaly>): Anomaly {
- const message = createBaseAnomaly();
- message.resource = object.resource ?? "";
- message.type = object.type ?? Anomaly_AnomalyType.ANOMALY_TYPE_UNSPECIFIED;
- message.severity = object.severity ?? Anomaly_AnomalySeverity.ANOMALY_SEVERITY_UNSPECIFIED;
- message.createTime = (object.createTime !== undefined && object.createTime !== null)
- ? Timestamp.fromPartial(object.createTime)
- : undefined;
- return message;
- },
-};
-
-export type AnomalyServiceDefinition = typeof AnomalyServiceDefinition;
-export const AnomalyServiceDefinition = {
- name: "AnomalyService",
- fullName: "bytebase.v1.AnomalyService",
- methods: {
- searchAnomalies: {
- name: "SearchAnomalies",
- requestType: SearchAnomaliesRequest,
- requestStream: false,
- responseType: SearchAnomaliesResponse,
- responseStream: false,
- options: {
- _unknownFields: {
- 800016: [new Uint8Array([2])],
- 578365826: [
- new Uint8Array([
- 45,
- 58,
- 1,
- 42,
- 34,
- 40,
- 47,
- 118,
- 49,
- 47,
- 123,
- 112,
- 97,
- 114,
- 101,
- 110,
- 116,
- 61,
- 112,
- 114,
- 111,
- 106,
- 101,
- 99,
- 116,
- 115,
- 47,
- 42,
- 125,
- 47,
- 97,
- 110,
- 111,
- 109,
- 97,
- 108,
- 105,
- 101,
- 115,
- 58,
- 115,
- 101,
- 97,
- 114,
- 99,
- 104,
- ]),
- ],
- },
- },
- },
- },
-} as const;
-
-type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
-
-export type DeepPartial<T> = T extends Builtin ? T
- : T extends Long ? string | number | Long : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
- : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
- : T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }
- : Partial<T>;
-
-function toTimestamp(date: Date): Timestamp {
- const seconds = numberToLong(Math.trunc(date.getTime() / 1_000));
- const nanos = (date.getTime() % 1_000) * 1_000_000;
- return { seconds, nanos };
-}
-
-function fromTimestamp(t: Timestamp): Date {
- let millis = (t.seconds.toNumber() || 0) * 1_000;
- millis += (t.nanos || 0) / 1_000_000;
- return new globalThis.Date(millis);
-}
-
-function fromJsonTimestamp(o: any): Timestamp {
- if (o instanceof globalThis.Date) {
- return toTimestamp(o);
- } else if (typeof o === "string") {
- return toTimestamp(new globalThis.Date(o));
- } else {
- return Timestamp.fromJSON(o);
- }
-}
-
-function numberToLong(number: number) {
- return Long.fromNumber(number);
-}
-
-function isSet(value: any): boolean {
- return value !== null && value !== undefined;
-}
-
-export interface MessageFns<T> {
- encode(message: T, writer?: BinaryWriter): BinaryWriter;
- decode(input: BinaryReader | Uint8Array, length?: number): T;
- fromJSON(object: any): T;
- toJSON(message: T): unknown;
- create(base?: DeepPartial<T>): T;
- fromPartial(object: DeepPartial<T>): T;
-}
diff --git a/frontend/src/views/DatabaseDetail/DatabaseDetail.vue b/frontend/src/views/DatabaseDetail/DatabaseDetail.vue
index 0728ab2a5c..665e7f89af 100644
--- a/frontend/src/views/DatabaseDetail/DatabaseDetail.vue
+++ b/frontend/src/views/DatabaseDetail/DatabaseDetail.vue
@@ -110,7 +110,6 @@
:type="'default'"
:text="false"
:database="database"
- @finish="updateAnomalyList"
/>
<NButton
v-if="allowTransferDatabase"
@@ -140,7 +139,6 @@
<DatabaseOverviewPanel
class="mt-2"
:database="database"
- :anomaly-list="anomalyList"
/>
</NTabPane>
<NTabPane
@@ -223,7 +221,7 @@ import { useClipboard } from "@vueuse/core";
import dayjs from "dayjs";
import { ArrowRightLeftIcon, ClipboardCopyIcon } from "lucide-vue-next";
import { NButton, NTabPane, NTabs } from "naive-ui";
-import { computed, reactive, watch, ref, watchEffect } from "vue";
+import { computed, reactive, watch } from "vue";
import { useI18n } from "vue-i18n";
import { useRouter, useRoute } from "vue-router";
import { BBAttention, BBModal } from "@/bbkit";
@@ -249,7 +247,6 @@ import {
} from "@/components/v2";
import { PROJECT_V1_ROUTE_ISSUE_DETAIL } from "@/router/dashboard/projectV1";
import {
- useAnomalyV1Store,
useAppFeature,
useEnvironmentV1Store,
useDatabaseV1ByName,
@@ -262,10 +259,8 @@ import {
import {
UNKNOWN_PROJECT_NAME,
unknownEnvironment,
- isValidDatabaseName,
DEFAULT_PROJECT_NAME,
} from "@/types";
-import type { Anomaly } from "@/types/proto/v1/anomaly_service";
import { State } from "@/types/proto/v1/common";
import { DatabaseChangeMode } from "@/types/proto/v1/setting_service";
import {
@@ -313,7 +308,6 @@ const state = reactive<LocalState>({
selectedTab: "overview",
});
const route = useRoute();
-const anomalyList = ref<Anomaly[]>([]);
const {
allowSyncDatabase,
allowUpdateDatabase,
@@ -358,15 +352,6 @@ const { database, ready } = useDatabaseV1ByName(
const project = computed(() => database.value.projectEntity);
-watchEffect(async () => {
- if (isValidDatabaseName(database.value.name)) {
- anomalyList.value = await useAnomalyV1Store().fetchAnomalyList(
- database.value.project,
- { database: database.value.name }
- );
- }
-});
-
const hasSchemaDiagramFeature = computed((): boolean => {
return instanceV1HasAlterSchema(database.value.instanceResource);
});
@@ -425,13 +410,6 @@ const handleGotoSQLEditorFailed = () => {
state.showIncorrectProjectModal = true;
};
-const updateAnomalyList = async () => {
- anomalyList.value = await useAnomalyV1Store().fetchAnomalyList(
- database.value.project,
- { database: database.value.name }
- );
-};
-
const environment = computed(() => {
return (
useEnvironmentV1Store().getEnvironmentByName(
diff --git a/frontend/tailwind.config.js b/frontend/tailwind.config.js
index 71d4bf1a8c..9e95794581 100644
--- a/frontend/tailwind.config.js
+++ b/frontend/tailwind.config.js
@@ -12,7 +12,6 @@ module.exports = {
// "w-xxx" is used by BBTab
// "bg-xxx", "text-xxx" is used by BBAttention TaskCheckBadgeBar BBBadge
// "hover:bg-xxx", "hover:border-xxx" is used by TaskCheckBadgeBar BBBadge
- // "grid-cols-xxx" is used by AnomalyCenterDashboard
{ pattern: /^w-/ },
{ pattern: /^pl-/ },
{ pattern: /^(bg|border)-gray-/, variants: ["hover"] },
diff --git a/proto/gen/grpc-doc/openapi.yaml b/proto/gen/grpc-doc/openapi.yaml
index 7d148333a8..edc6acc4b0 100644
--- a/proto/gen/grpc-doc/openapi.yaml
+++ b/proto/gen/grpc-doc/openapi.yaml
@@ -3567,37 +3567,6 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/Status'
- /v1/projects/{project}/anomalies:search:
- post:
- tags:
- - AnomalyService
- operationId: AnomalyService_SearchAnomalies
- parameters:
- - name: project
- in: path
- description: The project id.
- required: true
- schema:
- type: string
- requestBody:
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/SearchAnomaliesRequest'
- required: true
- responses:
- "200":
- description: OK
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/SearchAnomaliesResponse'
- default:
- description: Default error response
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/Status'
/v1/projects/{project}/auditLogs:export:
post:
tags:
@@ -8111,38 +8080,6 @@ components:
link:
type: string
description: The optional link, user can follow the link to check extra details
- Anomaly:
- required:
- - resource
- type: object
- properties:
- resource:
- type: string
- description: |-
- The resource that is the target of the operation.
- Format:
- - Database: instances/{instance}/databases/{database}
- type:
- enum:
- - ANOMALY_TYPE_UNSPECIFIED
- - DATABASE_CONNECTION
- - DATABASE_SCHEMA_DRIFT
- type: string
- description: type is the type of the anomaly.
- format: enum
- severity:
- enum:
- - ANOMALY_SEVERITY_UNSPECIFIED
- - MEDIUM
- - HIGH
- - CRITICAL
- type: string
- description: severity is the severity of the anomaly.
- format: enum
- createTime:
- readOnly: true
- type: string
- format: date-time
AppIMSetting:
type: object
properties:
@@ -12644,56 +12581,6 @@ components:
$ref: '#/components/schemas/TableMetadata'
catalog:
$ref: '#/components/schemas/TableCatalog'
- SearchAnomaliesRequest:
- required:
- - parent
- type: object
- properties:
- parent:
- type: string
- description: |-
- The parent resource whose anomalies are to be listed.
- Format: projects/{project}
- filter:
- type: string
- description: |-
- filter is the filter to apply on the search anomaly request,
- follow the [ebnf](https://en.wikipedia.org/wiki/Extended_Backus%E2%80%93Naur_form) syntax.
- Only support filter by resource and type for now.
- For example:
- Search the anomalies of a specific resource: 'resource="instances/{instance}/databases/{database}".'
- Search the specified types of anomalies: 'type="MIGRATION_SCHEMA".'
- pageSize:
- type: integer
- description: |-
- Not used.
- The maximum number of anomalies to return. The service may return fewer than
- this value.
- If unspecified, at most 10 anomalies will be returned.
- The maximum value is 1000; values above 1000 will be coerced to 1000.
- format: int32
- pageToken:
- type: string
- description: |-
- Not used.
- A page token, received from a previous `SearchAnomalies` call.
- Provide this to retrieve the subsequent page.
-
- When paginating, all other parameters provided to `SearchAnomalies` must match
- the call that provided the page token.
- SearchAnomaliesResponse:
- type: object
- properties:
- anomalies:
- type: array
- items:
- $ref: '#/components/schemas/Anomaly'
- description: anomalies is the list of anomalies.
- nextPageToken:
- type: string
- description: |-
- Not used. A token, which can be sent as `page_token` to retrieve the next page.
- If this field is omitted, there are no subsequent pages.
SearchAuditLogsRequest:
required:
- parent
@@ -14281,7 +14168,6 @@ components:
format: enum
tags:
- name: ActuatorService
- - name: AnomalyService
- name: AuditLogService
- name: AuthService
- name: CelService
diff --git a/proto/gen/grpc-doc/store/README.md b/proto/gen/grpc-doc/store/README.md
index 0d06e83fb2..fb66eb66ba 100644
--- a/proto/gen/grpc-doc/store/README.md
+++ b/proto/gen/grpc-doc/store/README.md
@@ -18,10 +18,6 @@
- [Advice.Status](#bytebase-store-Advice-Status)
-- [store/anomaly.proto](#store_anomaly-proto)
- - [AnomalyConnectionPayload](#bytebase-store-AnomalyConnectionPayload)
- - [AnomalyDatabaseSchemaDriftPayload](#bytebase-store-AnomalyDatabaseSchemaDriftPayload)
-
- [store/approval.proto](#store_approval-proto)
- [ApprovalFlow](#bytebase-store-ApprovalFlow)
- [ApprovalNode](#bytebase-store-ApprovalNode)
@@ -532,54 +528,6 @@ offset.
-<a name="store_anomaly-proto"></a>
-<p align="right"><a href="#top">Top</a></p>
-
-## store/anomaly.proto
-
-
-
-<a name="bytebase-store-AnomalyConnectionPayload"></a>
-
-### AnomalyConnectionPayload
-
-
-
-| Field | Type | Label | Description |
-| ----- | ---- | ----- | ----------- |
-| detail | [string](#string) | | Connection failure detail |
-
-
-
-
-
-
-<a name="bytebase-store-AnomalyDatabaseSchemaDriftPayload"></a>
-
-### AnomalyDatabaseSchemaDriftPayload
-
-
-
-| Field | Type | Label | Description |
-| ----- | ---- | ----- | ----------- |
-| version | [string](#string) | | The schema version corresponds to the expected schema |
-| expect | [string](#string) | | The expected latest schema stored in the migration history table |
-| actual | [string](#string) | | The actual schema dumped from the database |
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
<a name="store_approval-proto"></a>
<p align="right"><a href="#top">Top</a></p>
diff --git a/proto/gen/grpc-doc/store/index.html b/proto/gen/grpc-doc/store/index.html
index 0f7d028170..557f234725 100644
--- a/proto/gen/grpc-doc/store/index.html
+++ b/proto/gen/grpc-doc/store/index.html
@@ -232,25 +232,6 @@
</li>
- <li>
- <a href="#store%2fanomaly.proto">store/anomaly.proto</a>
- <ul>
-
- <li>
- <a href="#bytebase.store.AnomalyConnectionPayload"><span class="badge">M</span>AnomalyConnectionPayload</a>
- </li>
-
- <li>
- <a href="#bytebase.store.AnomalyDatabaseSchemaDriftPayload"><span class="badge">M</span>AnomalyDatabaseSchemaDriftPayload</a>
- </li>
-
-
-
-
- </ul>
- </li>
-
-
<li>
<a href="#store%2fapproval.proto">store/approval.proto</a>
<ul>
@@ -2044,82 +2025,6 @@ TODO: use range instead. </p></td>
- <div class="file-heading">
- <h2 id="store/anomaly.proto">store/anomaly.proto</h2><a href="#title">Top</a>
- </div>
- <p></p>
-
-
- <h3 id="bytebase.store.AnomalyConnectionPayload">AnomalyConnectionPayload</h3>
- <p></p>
-
-
- <table class="field-table">
- <thead>
- <tr><td>Field</td><td>Type</td><td>Label</td><td>Description</td></tr>
- </thead>
- <tbody>
-
- <tr>
- <td>detail</td>
- <td><a href="#string">string</a></td>
- <td></td>
- <td><p>Connection failure detail </p></td>
- </tr>
-
- </tbody>
- </table>
-
-
-
-
-
- <h3 id="bytebase.store.AnomalyDatabaseSchemaDriftPayload">AnomalyDatabaseSchemaDriftPayload</h3>
- <p></p>
-
-
- <table class="field-table">
- <thead>
- <tr><td>Field</td><td>Type</td><td>Label</td><td>Description</td></tr>
- </thead>
- <tbody>
-
- <tr>
- <td>version</td>
- <td><a href="#string">string</a></td>
- <td></td>
- <td><p>The schema version corresponds to the expected schema </p></td>
- </tr>
-
- <tr>
- <td>expect</td>
- <td><a href="#string">string</a></td>
- <td></td>
- <td><p>The expected latest schema stored in the migration history table </p></td>
- </tr>
-
- <tr>
- <td>actual</td>
- <td><a href="#string">string</a></td>
- <td></td>
- <td><p>The actual schema dumped from the database </p></td>
- </tr>
-
- </tbody>
- </table>
-
-
-
-
-
-
-
-
-
-
-
-
-
<div class="file-heading">
<h2 id="store/approval.proto">store/approval.proto</h2><a href="#title">Top</a>
</div>
diff --git a/proto/gen/grpc-doc/v1/README.md b/proto/gen/grpc-doc/v1/README.md
index 1bc53e892d..6f6173e91a 100644
--- a/proto/gen/grpc-doc/v1/README.md
+++ b/proto/gen/grpc-doc/v1/README.md
@@ -303,16 +303,6 @@
- [ActuatorService](#bytebase-v1-ActuatorService)
-- [v1/anomaly_service.proto](#v1_anomaly_service-proto)
- - [Anomaly](#bytebase-v1-Anomaly)
- - [SearchAnomaliesRequest](#bytebase-v1-SearchAnomaliesRequest)
- - [SearchAnomaliesResponse](#bytebase-v1-SearchAnomaliesResponse)
-
- - [Anomaly.AnomalySeverity](#bytebase-v1-Anomaly-AnomalySeverity)
- - [Anomaly.AnomalyType](#bytebase-v1-Anomaly-AnomalyType)
-
- - [AnomalyService](#bytebase-v1-AnomalyService)
-
- [v1/iam_policy.proto](#v1_iam_policy-proto)
- [Binding](#bytebase-v1-Binding)
- [BindingDelta](#bytebase-v1-BindingDelta)
@@ -5392,115 +5382,6 @@ The theme resources.
-<a name="v1_anomaly_service-proto"></a>
-<p align="right"><a href="#top">Top</a></p>
-
-## v1/anomaly_service.proto
-
-
-
-<a name="bytebase-v1-Anomaly"></a>
-
-### Anomaly
-
-
-
-| Field | Type | Label | Description |
-| ----- | ---- | ----- | ----------- |
-| resource | [string](#string) | | The resource that is the target of the operation. Format: - Database: instances/{instance}/databases/{database} |
-| type | [Anomaly.AnomalyType](#bytebase-v1-Anomaly-AnomalyType) | | type is the type of the anomaly. |
-| severity | [Anomaly.AnomalySeverity](#bytebase-v1-Anomaly-AnomalySeverity) | | severity is the severity of the anomaly. |
-| create_time | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | |
-
-
-
-
-
-
-<a name="bytebase-v1-SearchAnomaliesRequest"></a>
-
-### SearchAnomaliesRequest
-
-
-
-| Field | Type | Label | Description |
-| ----- | ---- | ----- | ----------- |
-| parent | [string](#string) | | The parent resource whose anomalies are to be listed. Format: projects/{project} |
-| filter | [string](#string) | | filter is the filter to apply on the search anomaly request, follow the [ebnf](https://en.wikipedia.org/wiki/Extended_Backus%E2%80%93Naur_form) syntax. Only support filter by resource and type for now. For example: Search the anomalies of a specific resource: &#39;resource=&#34;instances/{instance}/databases/{database}&#34;.&#39; Search the specified types of anomalies: &#39;type=&#34;MIGRATION_SCHEMA&#34;.&#39; |
-| page_size | [int32](#int32) | | Not used. The maximum number of anomalies to return. The service may return fewer than this value. If unspecified, at most 10 anomalies will be returned. The maximum value is 1000; values above 1000 will be coerced to 1000. |
-| page_token | [string](#string) | | Not used. A page token, received from a previous `SearchAnomalies` call. Provide this to retrieve the subsequent page.
-
-When paginating, all other parameters provided to `SearchAnomalies` must match the call that provided the page token. |
-
-
-
-
-
-
-<a name="bytebase-v1-SearchAnomaliesResponse"></a>
-
-### SearchAnomaliesResponse
-
-
-
-| Field | Type | Label | Description |
-| ----- | ---- | ----- | ----------- |
-| anomalies | [Anomaly](#bytebase-v1-Anomaly) | repeated | anomalies is the list of anomalies. |
-| next_page_token | [string](#string) | | Not used. A token, which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages. |
-
-
-
-
-
-
-
-
-<a name="bytebase-v1-Anomaly-AnomalySeverity"></a>
-
-### Anomaly.AnomalySeverity
-AnomalySeverity is the severity of the anomaly.
-
-| Name | Number | Description |
-| ---- | ------ | ----------- |
-| ANOMALY_SEVERITY_UNSPECIFIED | 0 | Unspecified anomaly severity. |
-| MEDIUM | 1 | MEDIUM is the info level anomaly severity. |
-| HIGH | 2 | HIGH is the warning level anomaly severity. |
-| CRITICAL | 3 | CRITICAL is the critical level anomaly severity. |
-
-
-
-<a name="bytebase-v1-Anomaly-AnomalyType"></a>
-
-### Anomaly.AnomalyType
-AnomalyType is the type of the anomaly.
-
-| Name | Number | Description |
-| ---- | ------ | ----------- |
-| ANOMALY_TYPE_UNSPECIFIED | 0 | Unspecified anomaly type. |
-| DATABASE_CONNECTION | 5 | Database level anomaly.
-
-DATABASE_CONNECTION is the anomaly type for database connection, e.g. the database had been deleted. |
-| DATABASE_SCHEMA_DRIFT | 6 | DATABASE_SCHEMA_DRIFT is the anomaly type for database schema drift, e.g. the database schema had been changed without bytebase migration. |
-
-
-
-
-
-
-
-<a name="bytebase-v1-AnomalyService"></a>
-
-### AnomalyService
-
-
-| Method Name | Request Type | Response Type | Description |
-| ----------- | ------------ | ------------- | ------------|
-| SearchAnomalies | [SearchAnomaliesRequest](#bytebase-v1-SearchAnomaliesRequest) | [SearchAnomaliesResponse](#bytebase-v1-SearchAnomaliesResponse) | |
-
-
-
-
-
<a name="v1_iam_policy-proto"></a>
<p align="right"><a href="#top">Top</a></p>
diff --git a/proto/gen/grpc-doc/v1/index.html b/proto/gen/grpc-doc/v1/index.html
index f8e5dcc260..414022af7d 100644
--- a/proto/gen/grpc-doc/v1/index.html
+++ b/proto/gen/grpc-doc/v1/index.html
@@ -1335,41 +1335,6 @@
</li>
- <li>
- <a href="#v1%2fanomaly_service.proto">v1/anomaly_service.proto</a>
- <ul>
-
- <li>
- <a href="#bytebase.v1.Anomaly"><span class="badge">M</span>Anomaly</a>
- </li>
-
- <li>
- <a href="#bytebase.v1.SearchAnomaliesRequest"><span class="badge">M</span>SearchAnomaliesRequest</a>
- </li>
-
- <li>
- <a href="#bytebase.v1.SearchAnomaliesResponse"><span class="badge">M</span>SearchAnomaliesResponse</a>
- </li>
-
-
- <li>
- <a href="#bytebase.v1.Anomaly.AnomalySeverity"><span class="badge">E</span>Anomaly.AnomalySeverity</a>
- </li>
-
- <li>
- <a href="#bytebase.v1.Anomaly.AnomalyType"><span class="badge">E</span>Anomaly.AnomalyType</a>
- </li>
-
-
-
- <li>
- <a href="#bytebase.v1.AnomalyService"><span class="badge">S</span>AnomalyService</a>
- </li>
-
- </ul>
- </li>
-
-
<li>
<a href="#v1%2fiam_policy.proto">v1/iam_policy.proto</a>
<ul>
@@ -15589,273 +15554,6 @@ The last remaining workspace admin cannot be deleted.</p></td>
- <div class="file-heading">
- <h2 id="v1/anomaly_service.proto">v1/anomaly_service.proto</h2><a href="#title">Top</a>
- </div>
- <p></p>
-
-
- <h3 id="bytebase.v1.Anomaly">Anomaly</h3>
- <p></p>
-
-
- <table class="field-table">
- <thead>
- <tr><td>Field</td><td>Type</td><td>Label</td><td>Description</td></tr>
- </thead>
- <tbody>
-
- <tr>
- <td>resource</td>
- <td><a href="#string">string</a></td>
- <td></td>
- <td><p>The resource that is the target of the operation.
-Format:
-- Database: instances/{instance}/databases/{database} </p></td>
- </tr>
-
- <tr>
- <td>type</td>
- <td><a href="#bytebase.v1.Anomaly.AnomalyType">Anomaly.AnomalyType</a></td>
- <td></td>
- <td><p>type is the type of the anomaly. </p></td>
- </tr>
-
- <tr>
- <td>severity</td>
- <td><a href="#bytebase.v1.Anomaly.AnomalySeverity">Anomaly.AnomalySeverity</a></td>
- <td></td>
- <td><p>severity is the severity of the anomaly. </p></td>
- </tr>
-
- <tr>
- <td>create_time</td>
- <td><a href="#google.protobuf.Timestamp">google.protobuf.Timestamp</a></td>
- <td></td>
- <td><p> </p></td>
- </tr>
-
- </tbody>
- </table>
-
-
-
-
-
- <h3 id="bytebase.v1.SearchAnomaliesRequest">SearchAnomaliesRequest</h3>
- <p></p>
-
-
- <table class="field-table">
- <thead>
- <tr><td>Field</td><td>Type</td><td>Label</td><td>Description</td></tr>
- </thead>
- <tbody>
-
- <tr>
- <td>parent</td>
- <td><a href="#string">string</a></td>
- <td></td>
- <td><p>The parent resource whose anomalies are to be listed.
-Format: projects/{project} </p></td>
- </tr>
-
- <tr>
- <td>filter</td>
- <td><a href="#string">string</a></td>
- <td></td>
- <td><p>filter is the filter to apply on the search anomaly request,
-follow the [ebnf](https://en.wikipedia.org/wiki/Extended_Backus%E2%80%93Naur_form) syntax.
-Only support filter by resource and type for now.
-For example:
-Search the anomalies of a specific resource: &#39;resource=&#34;instances/{instance}/databases/{database}&#34;.&#39;
-Search the specified types of anomalies: &#39;type=&#34;MIGRATION_SCHEMA&#34;.&#39; </p></td>
- </tr>
-
- <tr>
- <td>page_size</td>
- <td><a href="#int32">int32</a></td>
- <td></td>
- <td><p>Not used.
-The maximum number of anomalies to return. The service may return fewer than
-this value.
-If unspecified, at most 10 anomalies will be returned.
-The maximum value is 1000; values above 1000 will be coerced to 1000. </p></td>
- </tr>
-
- <tr>
- <td>page_token</td>
- <td><a href="#string">string</a></td>
- <td></td>
- <td><p>Not used.
-A page token, received from a previous `SearchAnomalies` call.
-Provide this to retrieve the subsequent page.
-
-When paginating, all other parameters provided to `SearchAnomalies` must match
-the call that provided the page token. </p></td>
- </tr>
-
- </tbody>
- </table>
-
-
-
-
-
- <h3 id="bytebase.v1.SearchAnomaliesResponse">SearchAnomaliesResponse</h3>
- <p></p>
-
-
- <table class="field-table">
- <thead>
- <tr><td>Field</td><td>Type</td><td>Label</td><td>Description</td></tr>
- </thead>
- <tbody>
-
- <tr>
- <td>anomalies</td>
- <td><a href="#bytebase.v1.Anomaly">Anomaly</a></td>
- <td>repeated</td>
- <td><p>anomalies is the list of anomalies. </p></td>
- </tr>
-
- <tr>
- <td>next_page_token</td>
- <td><a href="#string">string</a></td>
- <td></td>
- <td><p>Not used. A token, which can be sent as `page_token` to retrieve the next page.
-If this field is omitted, there are no subsequent pages. </p></td>
- </tr>
-
- </tbody>
- </table>
-
-
-
-
-
-
-
- <h3 id="bytebase.v1.Anomaly.AnomalySeverity">Anomaly.AnomalySeverity</h3>
- <p>AnomalySeverity is the severity of the anomaly.</p>
- <table class="enum-table">
- <thead>
- <tr><td>Name</td><td>Number</td><td>Description</td></tr>
- </thead>
- <tbody>
-
- <tr>
- <td>ANOMALY_SEVERITY_UNSPECIFIED</td>
- <td>0</td>
- <td><p>Unspecified anomaly severity.</p></td>
- </tr>
-
- <tr>
- <td>MEDIUM</td>
- <td>1</td>
- <td><p>MEDIUM is the info level anomaly severity.</p></td>
- </tr>
-
- <tr>
- <td>HIGH</td>
- <td>2</td>
- <td><p>HIGH is the warning level anomaly severity.</p></td>
- </tr>
-
- <tr>
- <td>CRITICAL</td>
- <td>3</td>
- <td><p>CRITICAL is the critical level anomaly severity.</p></td>
- </tr>
-
- </tbody>
- </table>
-
- <h3 id="bytebase.v1.Anomaly.AnomalyType">Anomaly.AnomalyType</h3>
- <p>AnomalyType is the type of the anomaly.</p>
- <table class="enum-table">
- <thead>
- <tr><td>Name</td><td>Number</td><td>Description</td></tr>
- </thead>
- <tbody>
-
- <tr>
- <td>ANOMALY_TYPE_UNSPECIFIED</td>
- <td>0</td>
- <td><p>Unspecified anomaly type.</p></td>
- </tr>
-
- <tr>
- <td>DATABASE_CONNECTION</td>
- <td>5</td>
- <td><p>Database level anomaly.
-
-DATABASE_CONNECTION is the anomaly type for database connection, e.g. the database had been deleted.</p></td>
- </tr>
-
- <tr>
- <td>DATABASE_SCHEMA_DRIFT</td>
- <td>6</td>
- <td><p>DATABASE_SCHEMA_DRIFT is the anomaly type for database schema drift,
-e.g. the database schema had been changed without bytebase migration.</p></td>
- </tr>
-
- </tbody>
- </table>
-
-
-
-
-
- <h3 id="bytebase.v1.AnomalyService">AnomalyService</h3>
- <p></p>
- <table class="enum-table">
- <thead>
- <tr><td>Method Name</td><td>Request Type</td><td>Response Type</td><td>Description</td></tr>
- </thead>
- <tbody>
-
- <tr>
- <td>SearchAnomalies</td>
- <td><a href="#bytebase.v1.SearchAnomaliesRequest">SearchAnomaliesRequest</a></td>
- <td><a href="#bytebase.v1.SearchAnomaliesResponse">SearchAnomaliesResponse</a></td>
- <td><p></p></td>
- </tr>
-
- </tbody>
- </table>
-
-
-
-
- <h4>Methods with HTTP bindings</h4>
- <table>
- <thead>
- <tr>
- <td>Method Name</td>
- <td>Method</td>
- <td>Pattern</td>
- <td>Body</td>
- </tr>
- </thead>
- <tbody>
-
-
-
- <tr>
- <td>SearchAnomalies</td>
- <td>POST</td>
- <td>/v1/{parent=projects/*}/anomalies:search</td>
- <td>*</td>
- </tr>
-
-
- </tbody>
- </table>
-
-
-
-
<div class="file-heading">
<h2 id="v1/iam_policy.proto">v1/iam_policy.proto</h2><a href="#title">Top</a>
</div>
diff --git a/proto/generated-go/store/anomaly.pb.go b/proto/generated-go/store/anomaly.pb.go
deleted file mode 100644
index 439177b3d4..0000000000
--- a/proto/generated-go/store/anomaly.pb.go
+++ /dev/null
@@ -1,191 +0,0 @@
-// Code generated by protoc-gen-go. DO NOT EDIT.
-// versions:
-// protoc-gen-go v1.36.6
-// protoc (unknown)
-// source: store/anomaly.proto
-
-package store
-
-import (
- protoreflect "google.golang.org/protobuf/reflect/protoreflect"
- protoimpl "google.golang.org/protobuf/runtime/protoimpl"
- reflect "reflect"
- sync "sync"
- unsafe "unsafe"
-)
-
-const (
- // Verify that this generated code is sufficiently up-to-date.
- _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
- // Verify that runtime/protoimpl is sufficiently up-to-date.
- _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
-)
-
-type AnomalyConnectionPayload struct {
- state protoimpl.MessageState `protogen:"open.v1"`
- // Connection failure detail
- Detail string `protobuf:"bytes,1,opt,name=detail,proto3" json:"detail,omitempty"`
- unknownFields protoimpl.UnknownFields
- sizeCache protoimpl.SizeCache
-}
-
-func (x *AnomalyConnectionPayload) Reset() {
- *x = AnomalyConnectionPayload{}
- mi := &file_store_anomaly_proto_msgTypes[0]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
-}
-
-func (x *AnomalyConnectionPayload) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*AnomalyConnectionPayload) ProtoMessage() {}
-
-func (x *AnomalyConnectionPayload) ProtoReflect() protoreflect.Message {
- mi := &file_store_anomaly_proto_msgTypes[0]
- if x != nil {
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- if ms.LoadMessageInfo() == nil {
- ms.StoreMessageInfo(mi)
- }
- return ms
- }
- return mi.MessageOf(x)
-}
-
-// Deprecated: Use AnomalyConnectionPayload.ProtoReflect.Descriptor instead.
-func (*AnomalyConnectionPayload) Descriptor() ([]byte, []int) {
- return file_store_anomaly_proto_rawDescGZIP(), []int{0}
-}
-
-func (x *AnomalyConnectionPayload) GetDetail() string {
- if x != nil {
- return x.Detail
- }
- return ""
-}
-
-type AnomalyDatabaseSchemaDriftPayload struct {
- state protoimpl.MessageState `protogen:"open.v1"`
- // The schema version corresponds to the expected schema
- Version string `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"`
- // The expected latest schema stored in the migration history table
- Expect string `protobuf:"bytes,2,opt,name=expect,proto3" json:"expect,omitempty"`
- // The actual schema dumped from the database
- Actual string `protobuf:"bytes,3,opt,name=actual,proto3" json:"actual,omitempty"`
- unknownFields protoimpl.UnknownFields
- sizeCache protoimpl.SizeCache
-}
-
-func (x *AnomalyDatabaseSchemaDriftPayload) Reset() {
- *x = AnomalyDatabaseSchemaDriftPayload{}
- mi := &file_store_anomaly_proto_msgTypes[1]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
-}
-
-func (x *AnomalyDatabaseSchemaDriftPayload) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*AnomalyDatabaseSchemaDriftPayload) ProtoMessage() {}
-
-func (x *AnomalyDatabaseSchemaDriftPayload) ProtoReflect() protoreflect.Message {
- mi := &file_store_anomaly_proto_msgTypes[1]
- if x != nil {
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- if ms.LoadMessageInfo() == nil {
- ms.StoreMessageInfo(mi)
- }
- return ms
- }
- return mi.MessageOf(x)
-}
-
-// Deprecated: Use AnomalyDatabaseSchemaDriftPayload.ProtoReflect.Descriptor instead.
-func (*AnomalyDatabaseSchemaDriftPayload) Descriptor() ([]byte, []int) {
- return file_store_anomaly_proto_rawDescGZIP(), []int{1}
-}
-
-func (x *AnomalyDatabaseSchemaDriftPayload) GetVersion() string {
- if x != nil {
- return x.Version
- }
- return ""
-}
-
-func (x *AnomalyDatabaseSchemaDriftPayload) GetExpect() string {
- if x != nil {
- return x.Expect
- }
- return ""
-}
-
-func (x *AnomalyDatabaseSchemaDriftPayload) GetActual() string {
- if x != nil {
- return x.Actual
- }
- return ""
-}
-
-var File_store_anomaly_proto protoreflect.FileDescriptor
-
-const file_store_anomaly_proto_rawDesc = "" +
- "\n" +
- "\x13store/anomaly.proto\x12\x0ebytebase.store\"2\n" +
- "\x18AnomalyConnectionPayload\x12\x16\n" +
- "\x06detail\x18\x01 \x01(\tR\x06detail\"m\n" +
- "!AnomalyDatabaseSchemaDriftPayload\x12\x18\n" +
- "\aversion\x18\x01 \x01(\tR\aversion\x12\x16\n" +
- "\x06expect\x18\x02 \x01(\tR\x06expect\x12\x16\n" +
- "\x06actual\x18\x03 \x01(\tR\x06actualB\x14Z\x12generated-go/storeb\x06proto3"
-
-var (
- file_store_anomaly_proto_rawDescOnce sync.Once
- file_store_anomaly_proto_rawDescData []byte
-)
-
-func file_store_anomaly_proto_rawDescGZIP() []byte {
- file_store_anomaly_proto_rawDescOnce.Do(func() {
- file_store_anomaly_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_store_anomaly_proto_rawDesc), len(file_store_anomaly_proto_rawDesc)))
- })
- return file_store_anomaly_proto_rawDescData
-}
-
-var file_store_anomaly_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
-var file_store_anomaly_proto_goTypes = []any{
- (*AnomalyConnectionPayload)(nil), // 0: bytebase.store.AnomalyConnectionPayload
- (*AnomalyDatabaseSchemaDriftPayload)(nil), // 1: bytebase.store.AnomalyDatabaseSchemaDriftPayload
-}
-var file_store_anomaly_proto_depIdxs = []int32{
- 0, // [0:0] is the sub-list for method output_type
- 0, // [0:0] is the sub-list for method input_type
- 0, // [0:0] is the sub-list for extension type_name
- 0, // [0:0] is the sub-list for extension extendee
- 0, // [0:0] is the sub-list for field type_name
-}
-
-func init() { file_store_anomaly_proto_init() }
-func file_store_anomaly_proto_init() {
- if File_store_anomaly_proto != nil {
- return
- }
- type x struct{}
- out := protoimpl.TypeBuilder{
- File: protoimpl.DescBuilder{
- GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
- RawDescriptor: unsafe.Slice(unsafe.StringData(file_store_anomaly_proto_rawDesc), len(file_store_anomaly_proto_rawDesc)),
- NumEnums: 0,
- NumMessages: 2,
- NumExtensions: 0,
- NumServices: 0,
- },
- GoTypes: file_store_anomaly_proto_goTypes,
- DependencyIndexes: file_store_anomaly_proto_depIdxs,
- MessageInfos: file_store_anomaly_proto_msgTypes,
- }.Build()
- File_store_anomaly_proto = out.File
- file_store_anomaly_proto_goTypes = nil
- file_store_anomaly_proto_depIdxs = nil
-}
diff --git a/proto/generated-go/v1/anomaly_service.pb.go b/proto/generated-go/v1/anomaly_service.pb.go
deleted file mode 100644
index 06e1ebfb3e..0000000000
--- a/proto/generated-go/v1/anomaly_service.pb.go
+++ /dev/null
@@ -1,448 +0,0 @@
-// Code generated by protoc-gen-go. DO NOT EDIT.
-// versions:
-// protoc-gen-go v1.36.6
-// protoc (unknown)
-// source: v1/anomaly_service.proto
-
-package v1
-
-import (
- _ "google.golang.org/genproto/googleapis/api/annotations"
- protoreflect "google.golang.org/protobuf/reflect/protoreflect"
- protoimpl "google.golang.org/protobuf/runtime/protoimpl"
- timestamppb "google.golang.org/protobuf/types/known/timestamppb"
- reflect "reflect"
- sync "sync"
- unsafe "unsafe"
-)
-
-const (
- // Verify that this generated code is sufficiently up-to-date.
- _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
- // Verify that runtime/protoimpl is sufficiently up-to-date.
- _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
-)
-
-// AnomalyType is the type of the anomaly.
-type Anomaly_AnomalyType int32
-
-const (
- // Unspecified anomaly type.
- Anomaly_ANOMALY_TYPE_UNSPECIFIED Anomaly_AnomalyType = 0
- // Database level anomaly.
- //
- // DATABASE_CONNECTION is the anomaly type for database connection, e.g. the database had been deleted.
- Anomaly_DATABASE_CONNECTION Anomaly_AnomalyType = 5
- // DATABASE_SCHEMA_DRIFT is the anomaly type for database schema drift,
- // e.g. the database schema had been changed without bytebase migration.
- Anomaly_DATABASE_SCHEMA_DRIFT Anomaly_AnomalyType = 6
-)
-
-// Enum value maps for Anomaly_AnomalyType.
-var (
- Anomaly_AnomalyType_name = map[int32]string{
- 0: "ANOMALY_TYPE_UNSPECIFIED",
- 5: "DATABASE_CONNECTION",
- 6: "DATABASE_SCHEMA_DRIFT",
- }
- Anomaly_AnomalyType_value = map[string]int32{
- "ANOMALY_TYPE_UNSPECIFIED": 0,
- "DATABASE_CONNECTION": 5,
- "DATABASE_SCHEMA_DRIFT": 6,
- }
-)
-
-func (x Anomaly_AnomalyType) Enum() *Anomaly_AnomalyType {
- p := new(Anomaly_AnomalyType)
- *p = x
- return p
-}
-
-func (x Anomaly_AnomalyType) String() string {
- return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
-}
-
-func (Anomaly_AnomalyType) Descriptor() protoreflect.EnumDescriptor {
- return file_v1_anomaly_service_proto_enumTypes[0].Descriptor()
-}
-
-func (Anomaly_AnomalyType) Type() protoreflect.EnumType {
- return &file_v1_anomaly_service_proto_enumTypes[0]
-}
-
-func (x Anomaly_AnomalyType) Number() protoreflect.EnumNumber {
- return protoreflect.EnumNumber(x)
-}
-
-// Deprecated: Use Anomaly_AnomalyType.Descriptor instead.
-func (Anomaly_AnomalyType) EnumDescriptor() ([]byte, []int) {
- return file_v1_anomaly_service_proto_rawDescGZIP(), []int{2, 0}
-}
-
-// AnomalySeverity is the severity of the anomaly.
-type Anomaly_AnomalySeverity int32
-
-const (
- // Unspecified anomaly severity.
- Anomaly_ANOMALY_SEVERITY_UNSPECIFIED Anomaly_AnomalySeverity = 0
- // MEDIUM is the info level anomaly severity.
- Anomaly_MEDIUM Anomaly_AnomalySeverity = 1
- // HIGH is the warning level anomaly severity.
- Anomaly_HIGH Anomaly_AnomalySeverity = 2
- // CRITICAL is the critical level anomaly severity.
- Anomaly_CRITICAL Anomaly_AnomalySeverity = 3
-)
-
-// Enum value maps for Anomaly_AnomalySeverity.
-var (
- Anomaly_AnomalySeverity_name = map[int32]string{
- 0: "ANOMALY_SEVERITY_UNSPECIFIED",
- 1: "MEDIUM",
- 2: "HIGH",
- 3: "CRITICAL",
- }
- Anomaly_AnomalySeverity_value = map[string]int32{
- "ANOMALY_SEVERITY_UNSPECIFIED": 0,
- "MEDIUM": 1,
- "HIGH": 2,
- "CRITICAL": 3,
- }
-)
-
-func (x Anomaly_AnomalySeverity) Enum() *Anomaly_AnomalySeverity {
- p := new(Anomaly_AnomalySeverity)
- *p = x
- return p
-}
-
-func (x Anomaly_AnomalySeverity) String() string {
- return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
-}
-
-func (Anomaly_AnomalySeverity) Descriptor() protoreflect.EnumDescriptor {
- return file_v1_anomaly_service_proto_enumTypes[1].Descriptor()
-}
-
-func (Anomaly_AnomalySeverity) Type() protoreflect.EnumType {
- return &file_v1_anomaly_service_proto_enumTypes[1]
-}
-
-func (x Anomaly_AnomalySeverity) Number() protoreflect.EnumNumber {
- return protoreflect.EnumNumber(x)
-}
-
-// Deprecated: Use Anomaly_AnomalySeverity.Descriptor instead.
-func (Anomaly_AnomalySeverity) EnumDescriptor() ([]byte, []int) {
- return file_v1_anomaly_service_proto_rawDescGZIP(), []int{2, 1}
-}
-
-type SearchAnomaliesRequest struct {
- state protoimpl.MessageState `protogen:"open.v1"`
- // The parent resource whose anomalies are to be listed.
- // Format: projects/{project}
- Parent string `protobuf:"bytes,1,opt,name=parent,proto3" json:"parent,omitempty"`
- // filter is the filter to apply on the search anomaly request,
- // follow the [ebnf](https://en.wikipedia.org/wiki/Extended_Backus%E2%80%93Naur_form) syntax.
- // Only support filter by resource and type for now.
- // For example:
- // Search the anomalies of a specific resource: 'resource="instances/{instance}/databases/{database}".'
- // Search the specified types of anomalies: 'type="MIGRATION_SCHEMA".'
- Filter string `protobuf:"bytes,2,opt,name=filter,proto3" json:"filter,omitempty"`
- // Not used.
- // The maximum number of anomalies to return. The service may return fewer than
- // this value.
- // If unspecified, at most 10 anomalies will be returned.
- // The maximum value is 1000; values above 1000 will be coerced to 1000.
- PageSize int32 `protobuf:"varint,3,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"`
- // Not used.
- // A page token, received from a previous `SearchAnomalies` call.
- // Provide this to retrieve the subsequent page.
- //
- // When paginating, all other parameters provided to `SearchAnomalies` must match
- // the call that provided the page token.
- PageToken string `protobuf:"bytes,4,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"`
- unknownFields protoimpl.UnknownFields
- sizeCache protoimpl.SizeCache
-}
-
-func (x *SearchAnomaliesRequest) Reset() {
- *x = SearchAnomaliesRequest{}
- mi := &file_v1_anomaly_service_proto_msgTypes[0]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
-}
-
-func (x *SearchAnomaliesRequest) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*SearchAnomaliesRequest) ProtoMessage() {}
-
-func (x *SearchAnomaliesRequest) ProtoReflect() protoreflect.Message {
- mi := &file_v1_anomaly_service_proto_msgTypes[0]
- if x != nil {
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- if ms.LoadMessageInfo() == nil {
- ms.StoreMessageInfo(mi)
- }
- return ms
- }
- return mi.MessageOf(x)
-}
-
-// Deprecated: Use SearchAnomaliesRequest.ProtoReflect.Descriptor instead.
-func (*SearchAnomaliesRequest) Descriptor() ([]byte, []int) {
- return file_v1_anomaly_service_proto_rawDescGZIP(), []int{0}
-}
-
-func (x *SearchAnomaliesRequest) GetParent() string {
- if x != nil {
- return x.Parent
- }
- return ""
-}
-
-func (x *SearchAnomaliesRequest) GetFilter() string {
- if x != nil {
- return x.Filter
- }
- return ""
-}
-
-func (x *SearchAnomaliesRequest) GetPageSize() int32 {
- if x != nil {
- return x.PageSize
- }
- return 0
-}
-
-func (x *SearchAnomaliesRequest) GetPageToken() string {
- if x != nil {
- return x.PageToken
- }
- return ""
-}
-
-type SearchAnomaliesResponse struct {
- state protoimpl.MessageState `protogen:"open.v1"`
- // anomalies is the list of anomalies.
- Anomalies []*Anomaly `protobuf:"bytes,1,rep,name=anomalies,proto3" json:"anomalies,omitempty"`
- // Not used. A token, which can be sent as `page_token` to retrieve the next page.
- // If this field is omitted, there are no subsequent pages.
- NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken,proto3" json:"next_page_token,omitempty"`
- unknownFields protoimpl.UnknownFields
- sizeCache protoimpl.SizeCache
-}
-
-func (x *SearchAnomaliesResponse) Reset() {
- *x = SearchAnomaliesResponse{}
- mi := &file_v1_anomaly_service_proto_msgTypes[1]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
-}
-
-func (x *SearchAnomaliesResponse) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*SearchAnomaliesResponse) ProtoMessage() {}
-
-func (x *SearchAnomaliesResponse) ProtoReflect() protoreflect.Message {
- mi := &file_v1_anomaly_service_proto_msgTypes[1]
- if x != nil {
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- if ms.LoadMessageInfo() == nil {
- ms.StoreMessageInfo(mi)
- }
- return ms
- }
- return mi.MessageOf(x)
-}
-
-// Deprecated: Use SearchAnomaliesResponse.ProtoReflect.Descriptor instead.
-func (*SearchAnomaliesResponse) Descriptor() ([]byte, []int) {
- return file_v1_anomaly_service_proto_rawDescGZIP(), []int{1}
-}
-
-func (x *SearchAnomaliesResponse) GetAnomalies() []*Anomaly {
- if x != nil {
- return x.Anomalies
- }
- return nil
-}
-
-func (x *SearchAnomaliesResponse) GetNextPageToken() string {
- if x != nil {
- return x.NextPageToken
- }
- return ""
-}
-
-type Anomaly struct {
- state protoimpl.MessageState `protogen:"open.v1"`
- // The resource that is the target of the operation.
- // Format:
- // - Database: instances/{instance}/databases/{database}
- Resource string `protobuf:"bytes,1,opt,name=resource,proto3" json:"resource,omitempty"`
- // type is the type of the anomaly.
- Type Anomaly_AnomalyType `protobuf:"varint,2,opt,name=type,proto3,enum=bytebase.v1.Anomaly_AnomalyType" json:"type,omitempty"`
- // severity is the severity of the anomaly.
- Severity Anomaly_AnomalySeverity `protobuf:"varint,3,opt,name=severity,proto3,enum=bytebase.v1.Anomaly_AnomalySeverity" json:"severity,omitempty"`
- CreateTime *timestamppb.Timestamp `protobuf:"bytes,9,opt,name=create_time,json=createTime,proto3" json:"create_time,omitempty"`
- unknownFields protoimpl.UnknownFields
- sizeCache protoimpl.SizeCache
-}
-
-func (x *Anomaly) Reset() {
- *x = Anomaly{}
- mi := &file_v1_anomaly_service_proto_msgTypes[2]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
-}
-
-func (x *Anomaly) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*Anomaly) ProtoMessage() {}
-
-func (x *Anomaly) ProtoReflect() protoreflect.Message {
- mi := &file_v1_anomaly_service_proto_msgTypes[2]
- if x != nil {
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- if ms.LoadMessageInfo() == nil {
- ms.StoreMessageInfo(mi)
- }
- return ms
- }
- return mi.MessageOf(x)
-}
-
-// Deprecated: Use Anomaly.ProtoReflect.Descriptor instead.
-func (*Anomaly) Descriptor() ([]byte, []int) {
- return file_v1_anomaly_service_proto_rawDescGZIP(), []int{2}
-}
-
-func (x *Anomaly) GetResource() string {
- if x != nil {
- return x.Resource
- }
- return ""
-}
-
-func (x *Anomaly) GetType() Anomaly_AnomalyType {
- if x != nil {
- return x.Type
- }
- return Anomaly_ANOMALY_TYPE_UNSPECIFIED
-}
-
-func (x *Anomaly) GetSeverity() Anomaly_AnomalySeverity {
- if x != nil {
- return x.Severity
- }
- return Anomaly_ANOMALY_SEVERITY_UNSPECIFIED
-}
-
-func (x *Anomaly) GetCreateTime() *timestamppb.Timestamp {
- if x != nil {
- return x.CreateTime
- }
- return nil
-}
-
-var File_v1_anomaly_service_proto protoreflect.FileDescriptor
-
-const file_v1_anomaly_service_proto_rawDesc = "" +
- "\n" +
- "\x18v1/anomaly_service.proto\x12\vbytebase.v1\x1a\x1cgoogle/api/annotations.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x13v1/annotation.proto\"\xa3\x01\n" +
- "\x16SearchAnomaliesRequest\x125\n" +
- "\x06parent\x18\x01 \x01(\tB\x1d\xe2A\x01\x02\xfaA\x16\n" +
- "\x14bytebase.com/ProjectR\x06parent\x12\x16\n" +
- "\x06filter\x18\x02 \x01(\tR\x06filter\x12\x1b\n" +
- "\tpage_size\x18\x03 \x01(\x05R\bpageSize\x12\x1d\n" +
- "\n" +
- "page_token\x18\x04 \x01(\tR\tpageToken\"u\n" +
- "\x17SearchAnomaliesResponse\x122\n" +
- "\tanomalies\x18\x01 \x03(\v2\x14.bytebase.v1.AnomalyR\tanomalies\x12&\n" +
- "\x0fnext_page_token\x18\x02 \x01(\tR\rnextPageToken\"\xa0\x03\n" +
- "\aAnomaly\x12 \n" +
- "\bresource\x18\x01 \x01(\tB\x04\xe2A\x01\x02R\bresource\x124\n" +
- "\x04type\x18\x02 \x01(\x0e2 .bytebase.v1.Anomaly.AnomalyTypeR\x04type\x12@\n" +
- "\bseverity\x18\x03 \x01(\x0e2$.bytebase.v1.Anomaly.AnomalySeverityR\bseverity\x12A\n" +
- "\vcreate_time\x18\t \x01(\v2\x1a.google.protobuf.TimestampB\x04\xe2A\x01\x03R\n" +
- "createTime\"_\n" +
- "\vAnomalyType\x12\x1c\n" +
- "\x18ANOMALY_TYPE_UNSPECIFIED\x10\x00\x12\x17\n" +
- "\x13DATABASE_CONNECTION\x10\x05\x12\x19\n" +
- "\x15DATABASE_SCHEMA_DRIFT\x10\x06\"W\n" +
- "\x0fAnomalySeverity\x12 \n" +
- "\x1cANOMALY_SEVERITY_UNSPECIFIED\x10\x00\x12\n" +
- "\n" +
- "\x06MEDIUM\x10\x01\x12\b\n" +
- "\x04HIGH\x10\x02\x12\f\n" +
- "\bCRITICAL\x10\x032\xa8\x01\n" +
- "\x0eAnomalyService\x12\x95\x01\n" +
- "\x0fSearchAnomalies\x12#.bytebase.v1.SearchAnomaliesRequest\x1a$.bytebase.v1.SearchAnomaliesResponse\"7\x90\xea0\x02\x82\xd3\xe4\x93\x02-:\x01*\"(/v1/{parent=projects/*}/anomalies:searchB\x11Z\x0fgenerated-go/v1b\x06proto3"
-
-var (
- file_v1_anomaly_service_proto_rawDescOnce sync.Once
- file_v1_anomaly_service_proto_rawDescData []byte
-)
-
-func file_v1_anomaly_service_proto_rawDescGZIP() []byte {
- file_v1_anomaly_service_proto_rawDescOnce.Do(func() {
- file_v1_anomaly_service_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_v1_anomaly_service_proto_rawDesc), len(file_v1_anomaly_service_proto_rawDesc)))
- })
- return file_v1_anomaly_service_proto_rawDescData
-}
-
-var file_v1_anomaly_service_proto_enumTypes = make([]protoimpl.EnumInfo, 2)
-var file_v1_anomaly_service_proto_msgTypes = make([]protoimpl.MessageInfo, 3)
-var file_v1_anomaly_service_proto_goTypes = []any{
- (Anomaly_AnomalyType)(0), // 0: bytebase.v1.Anomaly.AnomalyType
- (Anomaly_AnomalySeverity)(0), // 1: bytebase.v1.Anomaly.AnomalySeverity
- (*SearchAnomaliesRequest)(nil), // 2: bytebase.v1.SearchAnomaliesRequest
- (*SearchAnomaliesResponse)(nil), // 3: bytebase.v1.SearchAnomaliesResponse
- (*Anomaly)(nil), // 4: bytebase.v1.Anomaly
- (*timestamppb.Timestamp)(nil), // 5: google.protobuf.Timestamp
-}
-var file_v1_anomaly_service_proto_depIdxs = []int32{
- 4, // 0: bytebase.v1.SearchAnomaliesResponse.anomalies:type_name -> bytebase.v1.Anomaly
- 0, // 1: bytebase.v1.Anomaly.type:type_name -> bytebase.v1.Anomaly.AnomalyType
- 1, // 2: bytebase.v1.Anomaly.severity:type_name -> bytebase.v1.Anomaly.AnomalySeverity
- 5, // 3: bytebase.v1.Anomaly.create_time:type_name -> google.protobuf.Timestamp
- 2, // 4: bytebase.v1.AnomalyService.SearchAnomalies:input_type -> bytebase.v1.SearchAnomaliesRequest
- 3, // 5: bytebase.v1.AnomalyService.SearchAnomalies:output_type -> bytebase.v1.SearchAnomaliesResponse
- 5, // [5:6] is the sub-list for method output_type
- 4, // [4:5] is the sub-list for method input_type
- 4, // [4:4] is the sub-list for extension type_name
- 4, // [4:4] is the sub-list for extension extendee
- 0, // [0:4] is the sub-list for field type_name
-}
-
-func init() { file_v1_anomaly_service_proto_init() }
-func file_v1_anomaly_service_proto_init() {
- if File_v1_anomaly_service_proto != nil {
- return
- }
- file_v1_annotation_proto_init()
- type x struct{}
- out := protoimpl.TypeBuilder{
- File: protoimpl.DescBuilder{
- GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
- RawDescriptor: unsafe.Slice(unsafe.StringData(file_v1_anomaly_service_proto_rawDesc), len(file_v1_anomaly_service_proto_rawDesc)),
- NumEnums: 2,
- NumMessages: 3,
- NumExtensions: 0,
- NumServices: 1,
- },
- GoTypes: file_v1_anomaly_service_proto_goTypes,
- DependencyIndexes: file_v1_anomaly_service_proto_depIdxs,
- EnumInfos: file_v1_anomaly_service_proto_enumTypes,
- MessageInfos: file_v1_anomaly_service_proto_msgTypes,
- }.Build()
- File_v1_anomaly_service_proto = out.File
- file_v1_anomaly_service_proto_goTypes = nil
- file_v1_anomaly_service_proto_depIdxs = nil
-}
diff --git a/proto/generated-go/v1/anomaly_service.pb.gw.go b/proto/generated-go/v1/anomaly_service.pb.gw.go
deleted file mode 100644
index cdad7a4550..0000000000
--- a/proto/generated-go/v1/anomaly_service.pb.gw.go
+++ /dev/null
@@ -1,172 +0,0 @@
-// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT.
-// source: v1/anomaly_service.proto
-
-/*
-Package v1 is a reverse proxy.
-
-It translates gRPC into RESTful JSON APIs.
-*/
-package v1
-
-import (
- "context"
- "errors"
- "io"
- "net/http"
-
- "github.com/grpc-ecosystem/grpc-gateway/v2/runtime"
- "github.com/grpc-ecosystem/grpc-gateway/v2/utilities"
- "google.golang.org/grpc"
- "google.golang.org/grpc/codes"
- "google.golang.org/grpc/grpclog"
- "google.golang.org/grpc/metadata"
- "google.golang.org/grpc/status"
- "google.golang.org/protobuf/proto"
-)
-
-// Suppress "imported and not used" errors
-var (
- _ codes.Code
- _ io.Reader
- _ status.Status
- _ = errors.New
- _ = runtime.String
- _ = utilities.NewDoubleArray
- _ = metadata.Join
-)
-
-func request_AnomalyService_SearchAnomalies_0(ctx context.Context, marshaler runtime.Marshaler, client AnomalyServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
- var (
- protoReq SearchAnomaliesRequest
- metadata runtime.ServerMetadata
- err error
- )
- if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
- }
- val, ok := pathParams["parent"]
- if !ok {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "parent")
- }
- protoReq.Parent, err = runtime.String(val)
- if err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "parent", err)
- }
- msg, err := client.SearchAnomalies(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
- return msg, metadata, err
-}
-
-func local_request_AnomalyService_SearchAnomalies_0(ctx context.Context, marshaler runtime.Marshaler, server AnomalyServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
- var (
- protoReq SearchAnomaliesRequest
- metadata runtime.ServerMetadata
- err error
- )
- if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
- }
- val, ok := pathParams["parent"]
- if !ok {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "parent")
- }
- protoReq.Parent, err = runtime.String(val)
- if err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "parent", err)
- }
- msg, err := server.SearchAnomalies(ctx, &protoReq)
- return msg, metadata, err
-}
-
-// RegisterAnomalyServiceHandlerServer registers the http handlers for service AnomalyService to "mux".
-// UnaryRPC :call AnomalyServiceServer directly.
-// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.
-// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterAnomalyServiceHandlerFromEndpoint instead.
-// GRPC interceptors will not work for this type of registration. To use interceptors, you must use the "runtime.WithMiddlewares" option in the "runtime.NewServeMux" call.
-func RegisterAnomalyServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server AnomalyServiceServer) error {
- mux.Handle(http.MethodPost, pattern_AnomalyService_SearchAnomalies_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
- ctx, cancel := context.WithCancel(req.Context())
- defer cancel()
- var stream runtime.ServerTransportStream
- ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
- inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
- annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/bytebase.v1.AnomalyService/SearchAnomalies", runtime.WithHTTPPathPattern("/v1/{parent=projects/*}/anomalies:search"))
- if err != nil {
- runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
- return
- }
- resp, md, err := local_request_AnomalyService_SearchAnomalies_0(annotatedContext, inboundMarshaler, server, req, pathParams)
- md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
- annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
- if err != nil {
- runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
- return
- }
- forward_AnomalyService_SearchAnomalies_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
- })
-
- return nil
-}
-
-// RegisterAnomalyServiceHandlerFromEndpoint is same as RegisterAnomalyServiceHandler but
-// automatically dials to "endpoint" and closes the connection when "ctx" gets done.
-func RegisterAnomalyServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {
- conn, err := grpc.NewClient(endpoint, opts...)
- if err != nil {
- return err
- }
- defer func() {
- if err != nil {
- if cerr := conn.Close(); cerr != nil {
- grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr)
- }
- return
- }
- go func() {
- <-ctx.Done()
- if cerr := conn.Close(); cerr != nil {
- grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr)
- }
- }()
- }()
- return RegisterAnomalyServiceHandler(ctx, mux, conn)
-}
-
-// RegisterAnomalyServiceHandler registers the http handlers for service AnomalyService to "mux".
-// The handlers forward requests to the grpc endpoint over "conn".
-func RegisterAnomalyServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {
- return RegisterAnomalyServiceHandlerClient(ctx, mux, NewAnomalyServiceClient(conn))
-}
-
-// RegisterAnomalyServiceHandlerClient registers the http handlers for service AnomalyService
-// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "AnomalyServiceClient".
-// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "AnomalyServiceClient"
-// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in
-// "AnomalyServiceClient" to call the correct interceptors. This client ignores the HTTP middlewares.
-func RegisterAnomalyServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client AnomalyServiceClient) error {
- mux.Handle(http.MethodPost, pattern_AnomalyService_SearchAnomalies_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
- ctx, cancel := context.WithCancel(req.Context())
- defer cancel()
- inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
- annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/bytebase.v1.AnomalyService/SearchAnomalies", runtime.WithHTTPPathPattern("/v1/{parent=projects/*}/anomalies:search"))
- if err != nil {
- runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
- return
- }
- resp, md, err := request_AnomalyService_SearchAnomalies_0(annotatedContext, inboundMarshaler, client, req, pathParams)
- annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
- if err != nil {
- runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
- return
- }
- forward_AnomalyService_SearchAnomalies_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
- })
- return nil
-}
-
-var (
- pattern_AnomalyService_SearchAnomalies_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2, 2, 3}, []string{"v1", "projects", "parent", "anomalies"}, "search"))
-)
-
-var (
- forward_AnomalyService_SearchAnomalies_0 = runtime.ForwardResponseMessage
-)
diff --git a/proto/generated-go/v1/anomaly_service_grpc.pb.go b/proto/generated-go/v1/anomaly_service_grpc.pb.go
deleted file mode 100644
index f91137dcbd..0000000000
--- a/proto/generated-go/v1/anomaly_service_grpc.pb.go
+++ /dev/null
@@ -1,121 +0,0 @@
-// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
-// versions:
-// - protoc-gen-go-grpc v1.5.1
-// - protoc (unknown)
-// source: v1/anomaly_service.proto
-
-package v1
-
-import (
- context "context"
- grpc "google.golang.org/grpc"
- codes "google.golang.org/grpc/codes"
- status "google.golang.org/grpc/status"
-)
-
-// This is a compile-time assertion to ensure that this generated file
-// is compatible with the grpc package it is being compiled against.
-// Requires gRPC-Go v1.64.0 or later.
-const _ = grpc.SupportPackageIsVersion9
-
-const (
- AnomalyService_SearchAnomalies_FullMethodName = "/bytebase.v1.AnomalyService/SearchAnomalies"
-)
-
-// AnomalyServiceClient is the client API for AnomalyService service.
-//
-// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
-type AnomalyServiceClient interface {
- SearchAnomalies(ctx context.Context, in *SearchAnomaliesRequest, opts ...grpc.CallOption) (*SearchAnomaliesResponse, error)
-}
-
-type anomalyServiceClient struct {
- cc grpc.ClientConnInterface
-}
-
-func NewAnomalyServiceClient(cc grpc.ClientConnInterface) AnomalyServiceClient {
- return &anomalyServiceClient{cc}
-}
-
-func (c *anomalyServiceClient) SearchAnomalies(ctx context.Context, in *SearchAnomaliesRequest, opts ...grpc.CallOption) (*SearchAnomaliesResponse, error) {
- cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
- out := new(SearchAnomaliesResponse)
- err := c.cc.Invoke(ctx, AnomalyService_SearchAnomalies_FullMethodName, in, out, cOpts...)
- if err != nil {
- return nil, err
- }
- return out, nil
-}
-
-// AnomalyServiceServer is the server API for AnomalyService service.
-// All implementations must embed UnimplementedAnomalyServiceServer
-// for forward compatibility.
-type AnomalyServiceServer interface {
- SearchAnomalies(context.Context, *SearchAnomaliesRequest) (*SearchAnomaliesResponse, error)
- mustEmbedUnimplementedAnomalyServiceServer()
-}
-
-// UnimplementedAnomalyServiceServer must be embedded to have
-// forward compatible implementations.
-//
-// NOTE: this should be embedded by value instead of pointer to avoid a nil
-// pointer dereference when methods are called.
-type UnimplementedAnomalyServiceServer struct{}
-
-func (UnimplementedAnomalyServiceServer) SearchAnomalies(context.Context, *SearchAnomaliesRequest) (*SearchAnomaliesResponse, error) {
- return nil, status.Errorf(codes.Unimplemented, "method SearchAnomalies not implemented")
-}
-func (UnimplementedAnomalyServiceServer) mustEmbedUnimplementedAnomalyServiceServer() {}
-func (UnimplementedAnomalyServiceServer) testEmbeddedByValue() {}
-
-// UnsafeAnomalyServiceServer may be embedded to opt out of forward compatibility for this service.
-// Use of this interface is not recommended, as added methods to AnomalyServiceServer will
-// result in compilation errors.
-type UnsafeAnomalyServiceServer interface {
- mustEmbedUnimplementedAnomalyServiceServer()
-}
-
-func RegisterAnomalyServiceServer(s grpc.ServiceRegistrar, srv AnomalyServiceServer) {
- // If the following call pancis, it indicates UnimplementedAnomalyServiceServer was
- // embedded by pointer and is nil. This will cause panics if an
- // unimplemented method is ever invoked, so we test this at initialization
- // time to prevent it from happening at runtime later due to I/O.
- if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
- t.testEmbeddedByValue()
- }
- s.RegisterService(&AnomalyService_ServiceDesc, srv)
-}
-
-func _AnomalyService_SearchAnomalies_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
- in := new(SearchAnomaliesRequest)
- if err := dec(in); err != nil {
- return nil, err
- }
- if interceptor == nil {
- return srv.(AnomalyServiceServer).SearchAnomalies(ctx, in)
- }
- info := &grpc.UnaryServerInfo{
- Server: srv,
- FullMethod: AnomalyService_SearchAnomalies_FullMethodName,
- }
- handler := func(ctx context.Context, req interface{}) (interface{}, error) {
- return srv.(AnomalyServiceServer).SearchAnomalies(ctx, req.(*SearchAnomaliesRequest))
- }
- return interceptor(ctx, in, info, handler)
-}
-
-// AnomalyService_ServiceDesc is the grpc.ServiceDesc for AnomalyService service.
-// It's only intended for direct use with grpc.RegisterService,
-// and not to be introspected or modified (even as a copy)
-var AnomalyService_ServiceDesc = grpc.ServiceDesc{
- ServiceName: "bytebase.v1.AnomalyService",
- HandlerType: (*AnomalyServiceServer)(nil),
- Methods: []grpc.MethodDesc{
- {
- MethodName: "SearchAnomalies",
- Handler: _AnomalyService_SearchAnomalies_Handler,
- },
- },
- Streams: []grpc.StreamDesc{},
- Metadata: "v1/anomaly_service.proto",
-}
diff --git a/proto/store/anomaly.proto b/proto/store/anomaly.proto
deleted file mode 100644
index 41245fe4e1..0000000000
--- a/proto/store/anomaly.proto
+++ /dev/null
@@ -1,19 +0,0 @@
-syntax = "proto3";
-
-package bytebase.store;
-
-option go_package = "generated-go/store";
-
-message AnomalyConnectionPayload {
- // Connection failure detail
- string detail = 1;
-}
-
-message AnomalyDatabaseSchemaDriftPayload {
- // The schema version corresponds to the expected schema
- string version = 1;
- // The expected latest schema stored in the migration history table
- string expect = 2;
- // The actual schema dumped from the database
- string actual = 3;
-}
diff --git a/proto/v1/anomaly_service.proto b/proto/v1/anomaly_service.proto
deleted file mode 100644
index 9b3e04b962..0000000000
--- a/proto/v1/anomaly_service.proto
+++ /dev/null
@@ -1,103 +0,0 @@
-syntax = "proto3";
-
-package bytebase.v1;
-
-import "google/api/annotations.proto";
-import "google/api/field_behavior.proto";
-import "google/api/resource.proto";
-import "google/protobuf/timestamp.proto";
-import "v1/annotation.proto";
-
-option go_package = "generated-go/v1";
-
-service AnomalyService {
- rpc SearchAnomalies(SearchAnomaliesRequest) returns (SearchAnomaliesResponse) {
- option (google.api.http) = {
- post: "/v1/{parent=projects/*}/anomalies:search"
- body: "*"
- };
- option (bytebase.v1.auth_method) = CUSTOM;
- }
-}
-
-message SearchAnomaliesRequest {
- // The parent resource whose anomalies are to be listed.
- // Format: projects/{project}
- string parent = 1 [
- (google.api.field_behavior) = REQUIRED,
- (google.api.resource_reference) = {type: "bytebase.com/Project"}
- ];
-
- // filter is the filter to apply on the search anomaly request,
- // follow the [ebnf](https://en.wikipedia.org/wiki/Extended_Backus%E2%80%93Naur_form) syntax.
- // Only support filter by resource and type for now.
- // For example:
- // Search the anomalies of a specific resource: 'resource="instances/{instance}/databases/{database}".'
- // Search the specified types of anomalies: 'type="MIGRATION_SCHEMA".'
- string filter = 2;
-
- // Not used.
- // The maximum number of anomalies to return. The service may return fewer than
- // this value.
- // If unspecified, at most 10 anomalies will be returned.
- // The maximum value is 1000; values above 1000 will be coerced to 1000.
- int32 page_size = 3;
-
- // Not used.
- // A page token, received from a previous `SearchAnomalies` call.
- // Provide this to retrieve the subsequent page.
- //
- // When paginating, all other parameters provided to `SearchAnomalies` must match
- // the call that provided the page token.
- string page_token = 4;
-}
-
-message SearchAnomaliesResponse {
- // anomalies is the list of anomalies.
- repeated Anomaly anomalies = 1;
-
- // Not used. A token, which can be sent as `page_token` to retrieve the next page.
- // If this field is omitted, there are no subsequent pages.
- string next_page_token = 2;
-}
-
-message Anomaly {
- // AnomalyType is the type of the anomaly.
- enum AnomalyType {
- // Unspecified anomaly type.
- ANOMALY_TYPE_UNSPECIFIED = 0;
-
- // Database level anomaly.
- //
- // DATABASE_CONNECTION is the anomaly type for database connection, e.g. the database had been deleted.
- DATABASE_CONNECTION = 5;
- // DATABASE_SCHEMA_DRIFT is the anomaly type for database schema drift,
- // e.g. the database schema had been changed without bytebase migration.
- DATABASE_SCHEMA_DRIFT = 6;
- }
-
- // AnomalySeverity is the severity of the anomaly.
- enum AnomalySeverity {
- // Unspecified anomaly severity.
- ANOMALY_SEVERITY_UNSPECIFIED = 0;
- // MEDIUM is the info level anomaly severity.
- MEDIUM = 1;
- // HIGH is the warning level anomaly severity.
- HIGH = 2;
- // CRITICAL is the critical level anomaly severity.
- CRITICAL = 3;
- }
-
- // The resource that is the target of the operation.
- // Format:
- // - Database: instances/{instance}/databases/{database}
- string resource = 1 [(google.api.field_behavior) = REQUIRED];
-
- // type is the type of the anomaly.
- AnomalyType type = 2;
-
- // severity is the severity of the anomaly.
- AnomalySeverity severity = 3;
-
- google.protobuf.Timestamp create_time = 9 [(google.api.field_behavior) = OUTPUT_ONLY];
-}