mirror of
https://github.com/golang/go.git
synced 2025-05-05 15:43:04 +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()
|
return s.forward()
|
||||||
}
|
}
|
||||||
|
|
||||||
// For debugging purposes only.
|
prepare := func(ctx context.Context, srv *lsp.Server) *lsp.Server {
|
||||||
run := func(ctx context.Context, srv *lsp.Server) {
|
srv.Conn.AddHandler(&handler{})
|
||||||
go srv.Run(ctx)
|
return srv
|
||||||
}
|
}
|
||||||
|
run := func(ctx context.Context, srv *lsp.Server) { go prepare(ctx, srv).Run(ctx) }
|
||||||
if s.Address != "" {
|
if s.Address != "" {
|
||||||
return lsp.RunServerOnAddress(ctx, s.app.cache, s.Address, run)
|
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)
|
stream = protocol.LoggingStream(stream, out)
|
||||||
}
|
}
|
||||||
ctx, srv := lsp.NewServer(ctx, s.app.cache, stream)
|
ctx, srv := lsp.NewServer(ctx, s.app.cache, stream)
|
||||||
return srv.Run(ctx)
|
return prepare(ctx, srv).Run(ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Serve) forward() error {
|
func (s *Serve) forward() error {
|
||||||
@ -119,9 +120,7 @@ func (s *Serve) forward() error {
|
|||||||
return <-errc
|
return <-errc
|
||||||
}
|
}
|
||||||
|
|
||||||
type handler struct {
|
type handler struct{}
|
||||||
out io.Writer
|
|
||||||
}
|
|
||||||
|
|
||||||
type rpcStats struct {
|
type rpcStats struct {
|
||||||
method string
|
method string
|
||||||
|
Loading…
x
Reference in New Issue
Block a user