Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Websocket tracing spans #3682

Merged
merged 4 commits into from
Sep 17, 2019
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions app/api_topology.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"context"

"github.com/gorilla/mux"
ot "github.com/opentracing/opentracing-go"
log "github.com/sirupsen/logrus"

"github.com/weaveworks/scope/common/xfer"
Expand Down Expand Up @@ -133,6 +134,8 @@ func handleWebsocket(
defer rep.UnWait(ctx, wait)

for {
span := ot.StartSpan("ws.Render", ot.Tag{"topology", topologyID})
bboreham marked this conversation as resolved.
Show resolved Hide resolved
ctx := ot.ContextWithSpan(ctx, span)
// We measure how much time has passed since the channel was opened
// and add it to the initial report timestamp to get the timestamp
// of the snapshot we want to report right now.
Expand All @@ -144,11 +147,13 @@ func handleWebsocket(
re, err := rep.Report(ctx, reportTimestamp)
if err != nil {
log.Errorf("Error generating report: %v", err)
span.Finish()
bboreham marked this conversation as resolved.
Show resolved Hide resolved
return
}
renderer, filter, err := topologyRegistry.RendererForTopology(topologyID, r.Form, re)
if err != nil {
log.Errorf("Error generating report: %v", err)
span.Finish()
return
}

Expand All @@ -167,8 +172,10 @@ func handleWebsocket(
if !xfer.IsExpectedWSCloseError(err) {
log.Errorf("cannot serialize topology diff: %s", err)
}
span.Finish()
return
}
span.Finish()

select {
case <-wait:
Expand Down
1 change: 1 addition & 0 deletions app/multitenant/aws_collector.go
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,7 @@ func (c *awsCollector) Report(ctx context.Context, timestamp time.Time) (report.
if err != nil {
return report.MakeReport(), err
}
span.SetTag("userid", userid)
end := timestamp
start := end.Add(-c.cfg.Window)
reportKeys, err := c.getReportKeys(ctx, userid, start, end)
Expand Down