internal/lsp: fixed broken tracing
I dropped the line that added the stats to the context when merging the recent changes. Change-Id: I66ab2958b0737360896b40bf30c5ca3c2cebbae5 Reviewed-on: https://go-review.googlesource.com/c/tools/+/186300 Run-TryBot: Ian Cottrell <iancottrell@google.com> Reviewed-by: Rebecca Stambler <rstambler@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
parent
e98af23098
commit
128ec6dfca
|
@ -148,17 +148,18 @@ func (h *handler) Request(ctx context.Context, direction jsonrpc2.Direction, r *
|
|||
if r.Method == "" {
|
||||
panic("no method in rpc stats")
|
||||
}
|
||||
s := &rpcStats{
|
||||
stats := &rpcStats{
|
||||
method: r.Method,
|
||||
start: time.Now(),
|
||||
direction: direction,
|
||||
payload: r.Params,
|
||||
}
|
||||
ctx = context.WithValue(ctx, statsKey, stats)
|
||||
mode := telemetry.Outbound
|
||||
if direction == jsonrpc2.Receive {
|
||||
mode = telemetry.Inbound
|
||||
}
|
||||
ctx, s.close = trace.StartSpan(ctx, r.Method,
|
||||
ctx, stats.close = trace.StartSpan(ctx, r.Method,
|
||||
tag.Tag{Key: telemetry.Method, Value: r.Method},
|
||||
tag.Tag{Key: telemetry.RPCDirection, Value: mode},
|
||||
tag.Tag{Key: telemetry.RPCID, Value: r.ID},
|
||||
|
@ -207,8 +208,12 @@ func (h *handler) Error(ctx context.Context, err error) {
|
|||
func (h *handler) getStats(ctx context.Context) *rpcStats {
|
||||
stats, ok := ctx.Value(statsKey).(*rpcStats)
|
||||
if !ok || stats == nil {
|
||||
method, ok := ctx.Value(telemetry.Method).(string)
|
||||
if !ok {
|
||||
method = "???"
|
||||
}
|
||||
stats = &rpcStats{
|
||||
method: "???",
|
||||
method: method,
|
||||
close: func() {},
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue