Skip to content
Merged
Changes from all 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
14 changes: 12 additions & 2 deletions lib/proxy/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import (
"github.com/prometheus/client_golang/prometheus"
"github.com/sirupsen/logrus"
"go.opentelemetry.io/otel/attribute"
"go.opentelemetry.io/otel/codes"
oteltrace "go.opentelemetry.io/otel/trace"
"golang.org/x/exp/slices"

Expand Down Expand Up @@ -205,9 +206,12 @@ func (r *Router) DialHost(ctx context.Context, clientSrcAddr, clientDstAddr net.
attribute.String("site", clusterName),
),
)
connectingToNode.Inc()
defer func() {
if err != nil {
failedConnectingToNode.Inc()
span.RecordError(trace.Unwrap(err))
span.SetStatus(codes.Error, err.Error())
}
span.End()
}()
Expand Down Expand Up @@ -433,15 +437,21 @@ func getServer(ctx context.Context, host, port string, site site) (types.Server,
// DialSite establishes a connection to the auth server in the provided
// cluster. If the clusterName is an empty string then a connection to
// the local auth server will be established.
func (r *Router) DialSite(ctx context.Context, clusterName string, clientSrcAddr, clientDstAddr net.Addr) (net.Conn, error) {
func (r *Router) DialSite(ctx context.Context, clusterName string, clientSrcAddr, clientDstAddr net.Addr) (_ net.Conn, err error) {
_, span := r.tracer.Start(
ctx,
"router/DialSite",
oteltrace.WithAttributes(
attribute.String("site", clusterName),
),
)
defer span.End()
defer func() {
if err != nil {
span.RecordError(trace.Unwrap(err))
span.SetStatus(codes.Error, err.Error())
}
span.End()
}()

// default to local cluster if one wasn't provided
if clusterName == "" {
Expand Down