Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions cmd/maestro/server/grpc_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ import (
"crypto/x509"
"fmt"
"net"
"open-cluster-management.io/sdk-go/pkg/server/grpc/health"
"os"
"time"

ce "github.com/cloudevents/sdk-go/v2"
"github.com/cloudevents/sdk-go/v2/binding"
Expand Down Expand Up @@ -143,6 +145,7 @@ func (svr *GRPCServer) Start() error {
return err
}
pbv1.RegisterCloudEventServiceServer(svr.grpcServer, svr)
health.RegisterHeartbeatHealthServer(svr.grpcServer, 10*time.Second)
return svr.grpcServer.Serve(lis)
}

Expand Down
6 changes: 4 additions & 2 deletions cmd/maestro/server/metrics_interceptor.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ func newMetricsUnaryInterceptor() grpc.UnaryServerInterceptor {
// extract the type from the method name
methodInfo := strings.Split(info.FullMethod, "/")
if len(methodInfo) != 3 || methodInfo[2] != "Publish" {
return nil, fmt.Errorf("invalid method name: %s", info.FullMethod)
// only record publish metrics
return handler(ctx, req)
}
t := methodInfo[2]
pubReq, ok := req.(*pbv1.PublishRequest)
Expand Down Expand Up @@ -103,7 +104,8 @@ func newMetricsStreamInterceptor() grpc.StreamServerInterceptor {
}
methodInfo := strings.Split(info.FullMethod, "/")
if len(methodInfo) != 3 || methodInfo[2] != "Subscribe" {
return fmt.Errorf("invalid method name for stream method: %s", info.FullMethod)
// only record metrics for subscribe method
return handler(srv, stream)
}
t := methodInfo[2]
source := ""
Expand Down
2 changes: 2 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ require (
sigs.k8s.io/yaml v1.6.0
)

replace open-cluster-management.io/sdk-go => github.com/qiujian16/sdk-go v0.0.0-20250910080815-b3f743a384e2

require (
cel.dev/expr v0.24.0 // indirect
cloud.google.com/go/compute/metadata v0.6.0 // indirect
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,8 @@ github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R
github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
github.com/prometheus/procfs v0.16.1 h1:hZ15bTNuirocR6u0JZ6BAHHmwS1p8B4P6MRqxtzMyRg=
github.com/prometheus/procfs v0.16.1/go.mod h1:teAbpZRB1iIAJYREa1LsoWUXykVXA1KlTmWl8x/U+Is=
github.com/qiujian16/sdk-go v0.0.0-20250910080815-b3f743a384e2 h1:Vcp7yvPnfk+yROjnx8sVeOoMCATOiIVkS9cts2xCtzQ=
github.com/qiujian16/sdk-go v0.0.0-20250910080815-b3f743a384e2/go.mod h1:JVQupKu0xVcuVP4IUJF7hjvrXK8plZiwGPZcdqngjXk=
github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4=
github.com/robfig/cron v1.2.0 h1:ZjScXvvxeQ63Dbyxy76Fj3AT3Ut0aKsyd2/tl3DTMuQ=
github.com/robfig/cron v1.2.0/go.mod h1:JGuDeoQd7Z6yL4zQhZ3OPEVHB7fL6Ka6skscFHfmt2k=
Expand Down Expand Up @@ -931,8 +933,6 @@ open-cluster-management.io/api v1.0.1-0.20250827024027-f3e5dab96ea1 h1:X5dL1aKnk
open-cluster-management.io/api v1.0.1-0.20250827024027-f3e5dab96ea1/go.mod h1:lEc5Wkc9ON5ym/qAtIqNgrE7NW7IEOCOC611iQMlnKM=
open-cluster-management.io/ocm v1.0.1-0.20250903083110-e0476eebb495 h1:ARgB7+Gbl/EBYHxJT2VDvz2T9oKu7AAYDRfbQ9HPQNM=
open-cluster-management.io/ocm v1.0.1-0.20250903083110-e0476eebb495/go.mod h1:dvpGrRVnpIFCzOGefBzCh4v0LS+pWd8bnnu3ffVxqlc=
open-cluster-management.io/sdk-go v1.0.1-0.20250901084824-d4c9f78c2e6a h1:3AUAQPzzQXqxs4Dk7BwAIIjsWaQEps9JsXp88HEXq3E=
open-cluster-management.io/sdk-go v1.0.1-0.20250901084824-d4c9f78c2e6a/go.mod h1:JVQupKu0xVcuVP4IUJF7hjvrXK8plZiwGPZcdqngjXk=
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.31.2 h1:jpcvIRr3GLoUoEKRkHKSmGjxb6lWwrBlJsXc+eUYQHM=
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.31.2/go.mod h1:Ve9uj1L+deCXFrPOk1LpFXqTg7LCFzFso6PA48q/XZw=
sigs.k8s.io/controller-runtime v0.21.0 h1:CYfjpEuicjUecRk+KAeyYh+ouUBn4llGyDYytIGcJS8=
Expand Down