mirror of
https://github.com/golang/go.git
synced 2025-05-05 07:33:00 +00:00
internal/lsp: restore the rpc metrics
The special handler was dropped in cl/191963 which moved the logging functionality, but was still needed for the rpc metrics Change-Id: I494ef47646fe0d705709694378dbc981b549622a Reviewed-on: https://go-review.googlesource.com/c/tools/+/205164 Run-TryBot: Ian Cottrell <iancottrell@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Rebecca Stambler <rstambler@golang.org>
This commit is contained in:
parent
64da2da6fb
commit
b1cdfd15c4
@ -81,10 +81,11 @@ func (s *Serve) Run(ctx context.Context, args ...string) error {
|
||||
return s.forward()
|
||||
}
|
||||
|
||||
// For debugging purposes only.
|
||||
run := func(ctx context.Context, srv *lsp.Server) {
|
||||
go srv.Run(ctx)
|
||||
prepare := func(ctx context.Context, srv *lsp.Server) *lsp.Server {
|
||||
srv.Conn.AddHandler(&handler{})
|
||||
return srv
|
||||
}
|
||||
run := func(ctx context.Context, srv *lsp.Server) { go prepare(ctx, srv).Run(ctx) }
|
||||
if s.Address != "" {
|
||||
return lsp.RunServerOnAddress(ctx, s.app.cache, s.Address, run)
|
||||
}
|
||||
@ -96,7 +97,7 @@ func (s *Serve) Run(ctx context.Context, args ...string) error {
|
||||
stream = protocol.LoggingStream(stream, out)
|
||||
}
|
||||
ctx, srv := lsp.NewServer(ctx, s.app.cache, stream)
|
||||
return srv.Run(ctx)
|
||||
return prepare(ctx, srv).Run(ctx)
|
||||
}
|
||||
|
||||
func (s *Serve) forward() error {
|
||||
@ -119,9 +120,7 @@ func (s *Serve) forward() error {
|
||||
return <-errc
|
||||
}
|
||||
|
||||
type handler struct {
|
||||
out io.Writer
|
||||
}
|
||||
type handler struct{}
|
||||
|
||||
type rpcStats struct {
|
||||
method string
|
||||
|
Loading…
x
Reference in New Issue
Block a user