func Send(ctx context.Context, err error) error {
	meta, ok := metadata.FromIncomingContext(ctx)
	if !ok {
		meta = metadata.New(nil)
	}
	if trace.IsDebug() {
		SetDebugInfo(err, meta)
	}
	if len(meta) != 0 {
		sendErr := grpc.SendHeader(ctx, meta)
		if sendErr != nil {
			return trace.NewAggregate(err, sendErr)
		}
	}
	return ToGRPC(err)
}
Send is a high level function that:
* converts error to GRPC error
* attaches debug metadata to existing metadata if possible
* sends the header to GRPC
package trail
import (
	"encoding/base64"
	"encoding/json"
	"github.com/gravitational/trace"
	"github.com/gravitational/trace/internal"
	"golang.org/x/net/context"
	"google.golang.org/grpc"
	"google.golang.org/grpc/codes"
	"google.golang.org/grpc/metadata"
	"google.golang.org/grpc/status"
)