Merge "ref: Implement the javascript server side of vtrace."
diff --git a/services/wsprd/ipc/server/invoker.go b/services/wsprd/ipc/server/invoker.go
index 196ff2a..2f69c03 100644
--- a/services/wsprd/ipc/server/invoker.go
+++ b/services/wsprd/ipc/server/invoker.go
@@ -7,6 +7,7 @@
"v.io/v23/vdl"
"v.io/v23/vdlroot/signature"
"v.io/v23/verror"
+ "v.io/v23/vtrace"
)
var typedNil []int
@@ -65,6 +66,8 @@
return nil, reply.Err
}
+ vtrace.GetStore(call.Context()).Merge(reply.TraceResponse)
+
// Convert the reply.Results from []*vdl.Value to []interface{}
results := make([]interface{}, len(reply.Results))
for i, r := range reply.Results {
diff --git a/services/wsprd/ipc/server/server.go b/services/wsprd/ipc/server/server.go
index 3c3bcc8..25fbdf2 100644
--- a/services/wsprd/ipc/server/server.go
+++ b/services/wsprd/ipc/server/server.go
@@ -20,6 +20,7 @@
"v.io/v23/vdlroot/signature"
vdltime "v.io/v23/vdlroot/time"
"v.io/v23/verror"
+ "v.io/v23/vtrace"
"v.io/x/lib/vlog"
)
@@ -40,6 +41,7 @@
type ServerRPCRequestCall struct {
SecurityCall SecurityCall
Deadline vdltime.Deadline
+ TraceRequest vtrace.Request
}
type FlowHandler interface {
@@ -146,16 +148,16 @@
errHandler := func(err error) <-chan *lib.ServerRPCReply {
if ch := s.popServerRequest(flow.ID); ch != nil {
stdErr := verror.Convert(verror.ErrInternal, call.Context(), err).(verror.E)
- ch <- &lib.ServerRPCReply{nil, &stdErr}
+ ch <- &lib.ServerRPCReply{nil, &stdErr, vtrace.Response{}}
s.helper.CleanupFlow(flow.ID)
}
return replyChan
-
}
rpcCall := ServerRPCRequestCall{
SecurityCall: securityCall,
Deadline: timeout,
+ TraceRequest: vtrace.GetRequest(call.Context()),
}
// Send a invocation request to JavaScript
@@ -189,7 +191,7 @@
s.helper.CleanupFlow(flow.ID)
err := verror.Convert(verror.ErrAborted, call.Context(), call.Context().Err()).(verror.E)
- ch <- &lib.ServerRPCReply{nil, &err}
+ ch <- &lib.ServerRPCReply{nil, &err, vtrace.Response{}}
}()
go proxyStream(call, flow.Writer)
@@ -289,7 +291,7 @@
s.helper.CleanupFlow(flow.ID)
err := verror.Convert(verror.ErrAborted, call.Context(), call.Context().Err()).(verror.E)
- ch <- &lib.ServerRPCReply{nil, &err}
+ ch <- &lib.ServerRPCReply{nil, &err, vtrace.Response{}}
}()
return globChan, nil
diff --git a/services/wsprd/lib/writer.vdl b/services/wsprd/lib/writer.vdl
index a50c9af..bab2b75 100644
--- a/services/wsprd/lib/writer.vdl
+++ b/services/wsprd/lib/writer.vdl
@@ -1,7 +1,10 @@
package lib
+import "v.io/v23/vtrace"
+
// The response from the javascript server to the proxy.
type ServerRPCReply struct {
Results []any
Err error
+ TraceResponse vtrace.Response
}
diff --git a/services/wsprd/lib/writer.vdl.go b/services/wsprd/lib/writer.vdl.go
index e0f585d..9a07516 100644
--- a/services/wsprd/lib/writer.vdl.go
+++ b/services/wsprd/lib/writer.vdl.go
@@ -6,12 +6,16 @@
import (
// VDL system imports
"v.io/v23/vdl"
+
+ // VDL user imports
+ "v.io/v23/vtrace"
)
// The response from the javascript server to the proxy.
type ServerRPCReply struct {
- Results []*vdl.Value
- Err error
+ Results []*vdl.Value
+ Err error
+ TraceResponse vtrace.Response
}
func (ServerRPCReply) __VDLReflect(struct {