diff --git a/client/internal/vanus/net/connection/connect.go b/client/internal/vanus/net/connection/connect.go index 173f5dcc5..aef3acb5d 100644 --- a/client/internal/vanus/net/connection/connect.go +++ b/client/internal/vanus/net/connection/connect.go @@ -24,7 +24,7 @@ import ( "google.golang.org/grpc/credentials/insecure" // first-party libraries. - "github.com/vanus-labs/vanus/internal/primitive/interceptor/errinterceptor" + errinterceptor "github.com/vanus-labs/vanus/pkg/grpc/interceptor/errors" ) func Connect(ctx context.Context, endpoint string) (*grpc.ClientConn, error) { diff --git a/cmd/controller/main.go b/cmd/controller/main.go index c571ffd7f..a8cb7d897 100644 --- a/cmd/controller/main.go +++ b/cmd/controller/main.go @@ -15,6 +15,7 @@ package main import ( + // standard libraries. "context" "flag" "fmt" @@ -23,6 +24,7 @@ import ( "runtime/debug" "sync" + // third-party libraries. recovery "github.com/grpc-ecosystem/go-grpc-middleware/recovery" "go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc" "google.golang.org/grpc" @@ -30,18 +32,20 @@ import ( "google.golang.org/grpc/reflection" "google.golang.org/grpc/status" - "github.com/vanus-labs/vanus/internal/controller/tenant" + // first-party libraries. "github.com/vanus-labs/vanus/observability" "github.com/vanus-labs/vanus/observability/log" "github.com/vanus-labs/vanus/observability/metrics" + errinterceptor "github.com/vanus-labs/vanus/pkg/grpc/interceptor/errors" "github.com/vanus-labs/vanus/pkg/util/signal" ctrlpb "github.com/vanus-labs/vanus/proto/pkg/controller" + // this project. "github.com/vanus-labs/vanus/internal/controller" "github.com/vanus-labs/vanus/internal/controller/eventbus" "github.com/vanus-labs/vanus/internal/controller/member" + "github.com/vanus-labs/vanus/internal/controller/tenant" "github.com/vanus-labs/vanus/internal/controller/trigger" - "github.com/vanus-labs/vanus/internal/primitive/interceptor/errinterceptor" "github.com/vanus-labs/vanus/internal/primitive/interceptor/memberinterceptor" "github.com/vanus-labs/vanus/internal/primitive/vanus" ) diff --git a/cmd/root/main.go b/cmd/root/main.go index f9ec87e30..a35a91354 100644 --- a/cmd/root/main.go +++ b/cmd/root/main.go @@ -18,7 +18,6 @@ import ( "context" "flag" "fmt" - "github.com/vanus-labs/vanus/internal/controller/root" "net" "os" "runtime/debug" @@ -34,12 +33,13 @@ import ( "github.com/vanus-labs/vanus/observability" "github.com/vanus-labs/vanus/observability/log" "github.com/vanus-labs/vanus/observability/metrics" + errinterceptor "github.com/vanus-labs/vanus/pkg/grpc/interceptor/errors" "github.com/vanus-labs/vanus/pkg/util/signal" ctrlpb "github.com/vanus-labs/vanus/proto/pkg/controller" "github.com/vanus-labs/vanus/internal/controller" "github.com/vanus-labs/vanus/internal/controller/member" - "github.com/vanus-labs/vanus/internal/primitive/interceptor/errinterceptor" + "github.com/vanus-labs/vanus/internal/controller/root" "github.com/vanus-labs/vanus/internal/primitive/interceptor/memberinterceptor" "github.com/vanus-labs/vanus/internal/primitive/vanus" ) diff --git a/internal/gateway/proxy/proxy.go b/internal/gateway/proxy/proxy.go index 10ea27421..70afe6e3d 100644 --- a/internal/gateway/proxy/proxy.go +++ b/internal/gateway/proxy/proxy.go @@ -57,23 +57,25 @@ import ( "github.com/vanus-labs/vanus/client/pkg/api" "github.com/vanus-labs/vanus/client/pkg/option" "github.com/vanus-labs/vanus/client/pkg/policy" - "github.com/vanus-labs/vanus/internal/convert" - "github.com/vanus-labs/vanus/internal/gateway/auth" - "github.com/vanus-labs/vanus/internal/primitive" - "github.com/vanus-labs/vanus/internal/primitive/authorization" - "github.com/vanus-labs/vanus/internal/primitive/interceptor/errinterceptor" - "github.com/vanus-labs/vanus/internal/primitive/vanus" - "github.com/vanus-labs/vanus/internal/trigger/filter" - "github.com/vanus-labs/vanus/internal/trigger/transform" "github.com/vanus-labs/vanus/observability/log" "github.com/vanus-labs/vanus/observability/metrics" "github.com/vanus-labs/vanus/observability/tracing" "github.com/vanus-labs/vanus/pkg/cluster" "github.com/vanus-labs/vanus/pkg/errors" + errinterceptor "github.com/vanus-labs/vanus/pkg/grpc/interceptor/errors" "github.com/vanus-labs/vanus/proto/pkg/cloudevents" ctrlpb "github.com/vanus-labs/vanus/proto/pkg/controller" metapb "github.com/vanus-labs/vanus/proto/pkg/meta" proxypb "github.com/vanus-labs/vanus/proto/pkg/proxy" + + // this project. + "github.com/vanus-labs/vanus/internal/convert" + "github.com/vanus-labs/vanus/internal/gateway/auth" + "github.com/vanus-labs/vanus/internal/primitive" + "github.com/vanus-labs/vanus/internal/primitive/authorization" + "github.com/vanus-labs/vanus/internal/primitive/vanus" + "github.com/vanus-labs/vanus/internal/trigger/filter" + "github.com/vanus-labs/vanus/internal/trigger/transform" ) const ( diff --git a/internal/store/segment/server.go b/internal/store/segment/server.go index ae5ec382b..1b10b21a9 100644 --- a/internal/store/segment/server.go +++ b/internal/store/segment/server.go @@ -46,6 +46,7 @@ import ( "github.com/vanus-labs/vanus/observability/tracing" "github.com/vanus-labs/vanus/pkg/cluster" "github.com/vanus-labs/vanus/pkg/errors" + errinterceptor "github.com/vanus-labs/vanus/pkg/grpc/interceptor/errors" "github.com/vanus-labs/vanus/pkg/util" cepb "github.com/vanus-labs/vanus/proto/pkg/cloudevents" ctrlpb "github.com/vanus-labs/vanus/proto/pkg/controller" @@ -54,7 +55,6 @@ import ( // this project. "github.com/vanus-labs/vanus/internal/primitive" - "github.com/vanus-labs/vanus/internal/primitive/interceptor/errinterceptor" "github.com/vanus-labs/vanus/internal/primitive/vanus" "github.com/vanus-labs/vanus/internal/store" "github.com/vanus-labs/vanus/internal/store/block" @@ -554,12 +554,14 @@ func (s *server) AppendToBlock(ctx context.Context, id vanus.ID, events []*cepb. b.Append(ctx, entries, future.onAppended) seqs, err := future.wait() if err != nil { - metrics.WriteTPSCounterVec.WithLabelValues(s.volumeIDStr, b.IDStr(), metrics.LabelFailed).Add(float64(len(events))) + metrics.WriteTPSCounterVec.WithLabelValues(s.volumeIDStr, b.IDStr(), + metrics.LabelFailed).Add(float64(len(events))) metrics.WriteThroughputCounterVec.WithLabelValues(s.volumeIDStr, b.IDStr(), metrics.LabelFailed).Add(float64(size)) return nil, s.processAppendError(ctx, b, err) } metrics.WriteTPSCounterVec.WithLabelValues(s.volumeIDStr, b.IDStr(), metrics.LabelSuccess).Add(float64(len(events))) - metrics.WriteThroughputCounterVec.WithLabelValues(s.volumeIDStr, b.IDStr(), metrics.LabelSuccess).Add(float64(size)) + metrics.WriteThroughputCounterVec.WithLabelValues(s.volumeIDStr, b.IDStr(), + metrics.LabelSuccess).Add(float64(size)) return seqs, nil } diff --git a/pkg/cluster/raw_client/conn.go b/pkg/cluster/raw_client/conn.go index 0fd28f499..368dbdcb1 100644 --- a/pkg/cluster/raw_client/conn.go +++ b/pkg/cluster/raw_client/conn.go @@ -15,6 +15,7 @@ package raw_client import ( + // standard libraries. "context" "fmt" "os" @@ -22,6 +23,7 @@ import ( "sync" "time" + // third-party libraries. "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/connectivity" @@ -29,10 +31,13 @@ import ( "google.golang.org/grpc/status" "google.golang.org/protobuf/types/known/emptypb" - "github.com/vanus-labs/vanus/internal/primitive/interceptor/errinterceptor" + // first-party libraries. "github.com/vanus-labs/vanus/observability/log" - "github.com/vanus-labs/vanus/pkg/errors" ctrlpb "github.com/vanus-labs/vanus/proto/pkg/controller" + + // this project. + "github.com/vanus-labs/vanus/pkg/errors" + errinterceptor "github.com/vanus-labs/vanus/pkg/grpc/interceptor/errors" ) const ( diff --git a/internal/primitive/interceptor/errinterceptor/error.go b/pkg/grpc/interceptor/errors/error.go similarity index 98% rename from internal/primitive/interceptor/errinterceptor/error.go rename to pkg/grpc/interceptor/errors/error.go index c38efabed..f905c2306 100644 --- a/internal/primitive/interceptor/errinterceptor/error.go +++ b/pkg/grpc/interceptor/errors/error.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package errinterceptor +package errors import ( "context" diff --git a/internal/primitive/interceptor/errinterceptor/error_test.go b/pkg/grpc/interceptor/errors/error_test.go similarity index 96% rename from internal/primitive/interceptor/errinterceptor/error_test.go rename to pkg/grpc/interceptor/errors/error_test.go index 3806375e9..069eb9fa3 100644 --- a/internal/primitive/interceptor/errinterceptor/error_test.go +++ b/pkg/grpc/interceptor/errors/error_test.go @@ -12,4 +12,4 @@ // See the License for the specific language governing permissions and // limitations under the License. -package errinterceptor +package errors