private static bool IsBadClientSpan(IClientSpanLocate locate, ClientSpanLocateMode mode)
        {
            if (locate == null)
            {
                return(true);
            }

            if (string.IsNullOrWhiteSpace(locate.TracerId))
            {
                return(true);
            }

            if (string.IsNullOrWhiteSpace(locate.TraceId))
            {
                return(true);
            }

            if (mode == ClientSpanLocateMode.ForParent)
            {
                if (string.IsNullOrWhiteSpace(locate.ParentSpanId))
                {
                    return(true);
                }
            }
            else
            {
                if (string.IsNullOrWhiteSpace(locate.SpanId))
                {
                    return(true);
                }
            }

            return(false);
        }
Exemple #2
0
        public static ClientSpan TryCreate(ClientSpanLocateMode mode, IClientSpanLocate locate, string opName, IDictionary <string, string> bags = null)
        {
            var shouldReturnNull = locate.IsBadLocateArgs(mode);

            if (shouldReturnNull)
            {
                return(null);
            }

            var clientSpan = new ClientSpan();

            clientSpan.With(locate);
            clientSpan.OpName = opName;
            if (bags != null)
            {
                clientSpan.Bags = bags;
            }
            return(clientSpan);
        }
 public static bool IsBadLocateArgs(this IClientSpanLocate locate, ClientSpanLocateMode mode)
 {
     return(ClientSpanLocateKeyHelper.IsBadLocateArgs(locate, mode));
 }
 public static bool IsBadLocateArgs(IClientSpanLocate locate, ClientSpanLocateMode mode)
 {
     return(IsBadClientSpan(locate, mode));
 }