Skip to content

Commit

Permalink
internal/lsp: log snapshot IDs, don't log context cancellation
Browse files Browse the repository at this point in the history
Updates golang/go#36772

Change-Id: Id6f1be9511f37865d5c6efcff10230e03724b27d
Reviewed-on: https://go-review.googlesource.com/c/tools/+/216497
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
  • Loading branch information
stamblerre committed Jan 27, 2020
1 parent f3a1686 commit 0576458
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
6 changes: 5 additions & 1 deletion internal/lsp/diagnostics.go
Expand Up @@ -36,6 +36,8 @@ func (s *Server) diagnose(ctx context.Context, snapshot source.Snapshot) {
ctx, done := trace.StartSpan(ctx, "lsp:background-worker")
defer done()

ctx = telemetry.Snapshot.With(ctx, snapshot.ID())

// Diagnose all of the packages in the workspace.
go func() {
wsPackages, err := snapshot.WorkspacePackages(ctx)
Expand Down Expand Up @@ -148,7 +150,9 @@ func (s *Server) publishReports(ctx context.Context, snapshot source.Snapshot, r
URI: protocol.NewURI(fileID.URI),
Version: fileID.Version,
}); err != nil {
log.Error(ctx, "publishReports: failed to deliver diagnostic", err, telemetry.File)
if ctx.Err() == nil {
log.Error(ctx, "publishReports: failed to deliver diagnostic", err, telemetry.File)
}
continue
}
// Update the delivered map.
Expand Down
1 change: 1 addition & 0 deletions internal/lsp/telemetry/telemetry.go
Expand Up @@ -25,6 +25,7 @@ const (
Package = tag.Key("package")
PackagePath = tag.Key("package_path")
Query = tag.Key("query")
Snapshot = tag.Key("snapshot")
)

var (
Expand Down

0 comments on commit 0576458

Please sign in to comment.