Skip to content

Commit

Permalink
remove statview
Browse files Browse the repository at this point in the history
  • Loading branch information
smallnest committed Aug 22, 2024
1 parent 0679c4a commit 091fbb0
Show file tree
Hide file tree
Showing 8 changed files with 1 addition and 421 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ require (
github.com/godzie44/go-uring v0.0.0-20220926161041-69611e8b13d5
github.com/gogo/protobuf v1.3.2
github.com/golang/snappy v0.0.4
github.com/grandcat/zeroconf v1.0.0
github.com/hashicorp/go-multierror v1.1.1
github.com/hashicorp/golang-lru v1.0.2
github.com/jamiealquiza/tachymeter v2.0.0+incompatible
Expand Down Expand Up @@ -60,6 +59,7 @@ require (
github.com/go-task/slim-sprig/v3 v3.0.0 // indirect
github.com/google/pprof v0.0.0-20240727154555-813a5fbdbec8 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/grandcat/zeroconf v1.0.0 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/klauspost/cpuid/v2 v2.2.8 // indirect
github.com/klauspost/reedsolomon v1.12.3 // indirect
Expand Down
13 changes: 0 additions & 13 deletions server/gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,19 +39,6 @@ func (s *Server) startGateway(network string, ln net.Listener) net.Listener {
go s.startJSONRPC2(jsonrpc2Ln)
}

if s.EnableProfile {
// debugLn := m.Match(http1Path("/debug/"))
debugLn := m.Match(cmux.HTTP1Fast())
vm := NewViewManager(debugLn, s)
go func() {
if err := vm.Start(); err != nil {
log.Errorf("start view manager failed: %v", err)
}
}()

s.ViewManager = vm
}

if !s.DisableHTTPGateway {
httpLn := m.Match(cmux.HTTP1Fast()) // X-RPCX-MessageID
go s.startHTTP1APIGateway(httpLn)
Expand Down
15 changes: 0 additions & 15 deletions server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import (
"sync/atomic"
"time"

"github.com/jamiealquiza/tachymeter"
"github.com/smallnest/rpcx/log"
"github.com/smallnest/rpcx/protocol"
"github.com/smallnest/rpcx/share"
Expand Down Expand Up @@ -87,7 +86,6 @@ type Server struct {
jsonrpcHTTPServer *http.Server
DisableHTTPGateway bool // disable http invoke or not.
DisableJSONRPC bool // disable json rpc or not.
EnableProfile bool // enable profile and statsview or not
AsyncWrite bool // set true if your server only serves few clients
pool WorkerPool

Expand Down Expand Up @@ -119,7 +117,6 @@ type Server struct {

handlerMsgNum int32
requestCount atomic.Uint64
tachymeter *tachymeter.Tachymeter

// HandleServiceError is used to get all service errors. You can use it write logs or others.
HandleServiceError func(error)
Expand All @@ -128,8 +125,6 @@ type Server struct {
// If not set, it use err.Error()
ServerErrorFunc func(res *protocol.Message, err error) string

ViewManager *ViewManager

// The server is started.
Started chan struct{}
}
Expand All @@ -155,8 +150,6 @@ func NewServer(options ...OptionFn) *Server {
s.options["TCPKeepAlivePeriod"] = 3 * time.Minute
}

s.tachymeter = tachymeter.New(&tachymeter.Config{Size: 1000})

return s
}

Expand Down Expand Up @@ -546,14 +539,6 @@ func (s *Server) processOneRequest(ctx *share.Context, req *protocol.Message, co
atomic.AddInt32(&s.handlerMsgNum, 1)
defer atomic.AddInt32(&s.handlerMsgNum, -1)

if s.EnableProfile && s.tachymeter != nil {
s.requestCount.Add(1)
start := time.Now()
defer func() {
s.tachymeter.AddTime(time.Since(start))
}()
}

// 心跳请求,直接处理返回
if req.IsHeartbeat() {
s.Plugins.DoHeartbeatRequest(ctx, req)
Expand Down
139 changes: 0 additions & 139 deletions server/statsview.go

This file was deleted.

25 changes: 0 additions & 25 deletions server/statsview_disabled.go

This file was deleted.

62 changes: 0 additions & 62 deletions server/statsview_handler_viewers.go

This file was deleted.

74 changes: 0 additions & 74 deletions server/statsview_processtime_viewers.go

This file was deleted.

Loading

0 comments on commit 091fbb0

Please sign in to comment.