add lightstep instrumentation
This commit is contained in:
parent
5c26d1488f
commit
72659a3603
3 changed files with 16 additions and 0 deletions
|
|
@ -5,6 +5,7 @@ import (
|
|||
"crypto/tls"
|
||||
"fmt"
|
||||
|
||||
"github.com/opentracing/opentracing-go"
|
||||
"golang.org/x/crypto/ssh"
|
||||
)
|
||||
|
||||
|
|
@ -52,6 +53,9 @@ func WithTLSConfig(tlsConfig *tls.Config) ClientOption {
|
|||
// JoinWorkspace connects the client to the server's Live Share
|
||||
// workspace and returns a session representing their connection.
|
||||
func (c *Client) JoinWorkspace(ctx context.Context) (*Session, error) {
|
||||
span, ctx := opentracing.StartSpanFromContext(ctx, "Client.JoinWorkspace")
|
||||
defer span.Finish()
|
||||
|
||||
clientSocket := newSocket(c.connection, c.tlsConfig)
|
||||
if err := clientSocket.connect(ctx); err != nil {
|
||||
return nil, fmt.Errorf("error connecting websocket: %v", err)
|
||||
|
|
@ -120,6 +124,9 @@ func (s *Session) openStreamingChannel(ctx context.Context, id channelID) (ssh.C
|
|||
return nil, fmt.Errorf("error getting stream id: %v", err)
|
||||
}
|
||||
|
||||
span, ctx := opentracing.StartSpanFromContext(ctx, "Session.OpenChannel+SendRequest")
|
||||
defer span.Finish()
|
||||
|
||||
channel, reqs, err := s.ssh.conn.OpenChannel("session", nil)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("error opening ssh channel for transport: %v", err)
|
||||
|
|
|
|||
|
|
@ -5,6 +5,8 @@ import (
|
|||
"fmt"
|
||||
"io"
|
||||
"net"
|
||||
|
||||
"github.com/opentracing/opentracing-go"
|
||||
)
|
||||
|
||||
// A PortForwarder forwards TCP traffic over a LiveShare session from a port on a remote
|
||||
|
|
@ -108,6 +110,9 @@ func awaitError(ctx context.Context, errc <-chan error) error {
|
|||
|
||||
// handleConnection handles forwarding for a single accepted connection, then closes it.
|
||||
func (fwd *PortForwarder) handleConnection(ctx context.Context, id channelID, conn io.ReadWriteCloser) (err error) {
|
||||
span, ctx := opentracing.StartSpanFromContext(ctx, "PortForwarder.handleConnection")
|
||||
defer span.Finish()
|
||||
|
||||
defer safeClose(conn, &err)
|
||||
|
||||
channel, err := fwd.session.openStreamingChannel(ctx, id)
|
||||
|
|
|
|||
4
rpc.go
4
rpc.go
|
|
@ -6,6 +6,7 @@ import (
|
|||
"io"
|
||||
"sync"
|
||||
|
||||
"github.com/opentracing/opentracing-go"
|
||||
"github.com/sourcegraph/jsonrpc2"
|
||||
)
|
||||
|
||||
|
|
@ -26,6 +27,9 @@ func (r *rpcClient) connect(ctx context.Context) {
|
|||
}
|
||||
|
||||
func (r *rpcClient) do(ctx context.Context, method string, args, result interface{}) error {
|
||||
span, ctx := opentracing.StartSpanFromContext(ctx, method)
|
||||
defer span.Finish()
|
||||
|
||||
waiter, err := r.Conn.DispatchCall(ctx, method, args)
|
||||
if err != nil {
|
||||
return fmt.Errorf("error dispatching %q call: %v", method, err)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue