private bool TryExtractTracestate(string[] tracestateCollection, out List <KeyValuePair <string, string> > tracestateResult)
        {
            tracestateResult = null;

            try
            {
                if (tracestateCollection != null)
                {
                    tracestateResult = new List <KeyValuePair <string, string> >();

                    // Iterate in reverse order because when call builder set the elements is added in the
                    // front of the list.
                    for (int i = tracestateCollection.Length - 1; i >= 0; i--)
                    {
                        if (!TracestateUtils.AppendTracestate(tracestateCollection[i], tracestateResult))
                        {
                            return(false);
                        }
                    }
                }

                return(true);
            }
            catch (Exception)
            {
                // failure to parse tracestate should not disregard traceparent
                // TODO: logging
            }

            return(false);
        }
Esempio n. 2
0
        private bool TryExtractTracestate(string[] tracestateCollection, out List <KeyValuePair <string, string> > tracestateResult)
        {
            tracestateResult = null;

            if (tracestateCollection != null)
            {
                tracestateResult = new List <KeyValuePair <string, string> >();

                // Iterate in reverse order because when call builder set the elements is added in the
                // front of the list.
                for (int i = tracestateCollection.Length - 1; i >= 0; i--)
                {
                    if (!TracestateUtils.AppendTracestate(tracestateCollection[i], tracestateResult))
                    {
                        return(false);
                    }
                }
            }

            return(true);
        }