veyron/runtimes/google/ipc: Derive incomming server call contexts from server.ctx.
Also, while I'm here, change the names of vtrace spans to be just nouns.
Change-Id: I0ebf93253639e1287e80fcab21d002fd0f5d578e
diff --git a/runtimes/google/ipc/client.go b/runtimes/google/ipc/client.go
index 4e12fb9..e828b51 100644
--- a/runtimes/google/ipc/client.go
+++ b/runtimes/google/ipc/client.go
@@ -233,7 +233,7 @@
// tryCall makes a single attempt at a call.
func (c *client) tryCall(ctx context.T, name, method string, args []interface{}, opts []ipc.CallOpt) (ipc.Call, verror.E) {
- ctx, _ = vtrace.WithNewSpan(ctx, fmt.Sprintf("Client Call: %s.%s", name, method))
+ ctx, _ = vtrace.WithNewSpan(ctx, fmt.Sprintf("<client>\"%s\".%s", name, method))
_, serverPattern, name := splitObjectName(name)
diff --git a/runtimes/google/ipc/server.go b/runtimes/google/ipc/server.go
index 943a71b..b645d28 100644
--- a/runtimes/google/ipc/server.go
+++ b/runtimes/google/ipc/server.go
@@ -9,7 +9,6 @@
"sync"
"time"
- "veyron.io/veyron/veyron2"
"veyron.io/veyron/veyron2/config"
"veyron.io/veyron/veyron2/context"
"veyron.io/veyron/veyron2/ipc"
@@ -686,11 +685,10 @@
func newFlowServer(flow stream.Flow, server *server) *flowServer {
server.Lock()
disp := server.disp
- runtime := veyron2.RuntimeFromContext(server.ctx)
server.Unlock()
return &flowServer{
- T: InternalNewContext(runtime),
+ T: server.ctx,
server: server,
disp: disp,
// TODO(toddw): Support different codecs
@@ -811,15 +809,15 @@
if verr != nil {
// We don't know what the ipc call was supposed to be, but we'll create
// a placeholder span so we can capture annotations.
- fs.T, _ = ivtrace.WithNewSpan(fs, "Failed IPC Call")
+ fs.T, _ = ivtrace.WithNewSpan(fs, fmt.Sprintf("\"%s\".UNKNOWN", fs.Name()))
return nil, verr
}
fs.method = req.Method
// TODO(mattr): Currently this allows users to trigger trace collection
// on the server even if they will not be allowed to collect the
- // results later. This might be consider a DOS vector.
- spanName := fmt.Sprintf("Server Call: %s.%s", fs.Name(), fs.Method())
+ // results later. This might be considered a DOS vector.
+ spanName := fmt.Sprintf("\"%s\".%s", fs.Name(), fs.Method())
fs.T, _ = ivtrace.WithContinuedSpan(fs, spanName, req.TraceRequest)
var cancel context.CancelFunc
diff --git a/runtimes/google/vtrace/vtrace_test.go b/runtimes/google/vtrace/vtrace_test.go
index c25d6f9..f8af7f9 100644
--- a/runtimes/google/vtrace/vtrace_test.go
+++ b/runtimes/google/vtrace/vtrace_test.go
@@ -227,10 +227,10 @@
expectedSpans := []string{
": c0-begin, c0-end",
- "Client Call: c1.Run",
- "Server Call: .Run: c1-begin, c1-end",
- "Client Call: c2.Run",
- "Server Call: .Run: c2-begin, c2-end",
+ "<client>\"c1\".Run",
+ "\"\".Run: c1-begin, c1-end",
+ "<client>\"c2\".Run",
+ "\"\".Run: c2-begin, c2-end",
}
expectSequence(t, span.Trace().Record(), expectedSpans)
}
@@ -247,10 +247,10 @@
expectedSpans := []string{
": c0-end",
- "Client Call: c1.Run",
- "Server Call: .Run: c1-end",
- "Client Call: c2.Run",
- "Server Call: .Run: c2-begin, c2-end",
+ "<client>\"c1\".Run",
+ "\"\".Run: c1-end",
+ "<client>\"c2\".Run",
+ "\"\".Run: c2-begin, c2-end",
}
expectSequence(t, span.Trace().Record(), expectedSpans)
}