Skip to content

Commit

Permalink
server(ticdc): implement diagnosticsService in cdc (#10262) (#10363)
Browse files Browse the repository at this point in the history
close #10263
  • Loading branch information
ti-chi-bot authored Feb 9, 2024
1 parent 67111b1 commit d6f68de
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
21 changes: 13 additions & 8 deletions cdc/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ import (
"github.com/dustin/go-humanize"
"github.com/gin-gonic/gin"
"github.com/pingcap/errors"
"github.com/pingcap/kvproto/pkg/diagnosticspb"
"github.com/pingcap/log"
"github.com/pingcap/sysutil"
"github.com/pingcap/tidb/util/gctuner"
"github.com/pingcap/tiflow/cdc"
"github.com/pingcap/tiflow/cdc/capture"
Expand Down Expand Up @@ -75,11 +77,12 @@ type Server interface {
// TODO: we need to make server more unit testable and add more test cases.
// Especially we need to decouple the HTTPServer out of server.
type server struct {
capture capture.Capture
tcpServer tcpserver.TCPServer
grpcService *p2p.ServerWrapper
statusServer *http.Server
etcdClient etcd.CDCEtcdClient
capture capture.Capture
tcpServer tcpserver.TCPServer
grpcService *p2p.ServerWrapper
diagnosticsService *sysutil.DiagnosticsServer
statusServer *http.Server
etcdClient etcd.CDCEtcdClient
// pdClient is the default upstream PD client.
// The PD acts as a metadata management service for TiCDC.
pdClient pd.Client
Expand Down Expand Up @@ -112,9 +115,10 @@ func New(pdEndpoints []string) (*server, error) {

debugConfig := config.GetGlobalServerConfig().Debug
s := &server{
pdEndpoints: pdEndpoints,
grpcService: p2p.NewServerWrapper(debugConfig.Messages.ToMessageServerConfig()),
tcpServer: tcpServer,
pdEndpoints: pdEndpoints,
grpcService: p2p.NewServerWrapper(debugConfig.Messages.ToMessageServerConfig()),
diagnosticsService: sysutil.NewDiagnosticsServer(conf.LogFile),
tcpServer: tcpServer,
}

log.Info("CDC server created",
Expand Down Expand Up @@ -356,6 +360,7 @@ func (s *server) run(ctx context.Context) (err error) {

grpcServer := grpc.NewServer(s.grpcService.ServerOptions()...)
p2pProto.RegisterCDCPeerToPeerServer(grpcServer, s.grpcService)
diagnosticspb.RegisterDiagnosticsServer(grpcServer, s.diagnosticsService)

eg.Go(func() error {
return grpcServer.Serve(s.tcpServer.GrpcListener())
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ require (
github.com/pingcap/badger v1.5.1-0.20230103063557-828f39b09b6d // indirect
github.com/pingcap/fn v1.0.0 // indirect
github.com/pingcap/goleveldb v0.0.0-20191226122134-f82aafb29989 // indirect
github.com/pingcap/sysutil v1.0.1-0.20230407040306-fb007c5aff21 // indirect
github.com/pingcap/sysutil v1.0.1-0.20230407040306-fb007c5aff21
github.com/pingcap/tipb v0.0.0-20230919054518-dfd7d194838f // indirect
github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4 // indirect
github.com/pkg/errors v0.9.1 // indirect
Expand Down

0 comments on commit d6f68de

Please sign in to comment.