private static Span.Types.Link FromILink(ILink source)
        {
            var result = new Span.Types.Link
            {
                Attributes = FromIAttributeMap(source.Attributes),
                TraceId    = ByteString.CopyFrom(source.Context.TraceId.Bytes),
                SpanId     = ByteString.CopyFrom(source.Context.SpanId.Bytes),
            };

            return(result);
        }
        public static Span.Types.Link ToLink(this ILink link)
        {
            var ret = new Span.Types.Link();

            ret.SpanId  = link.SpanId.ToLowerBase16();
            ret.TraceId = link.TraceId.ToLowerBase16();

            if (link.Attributes != null)
            {
                ret.Attributes = new Span.Types.Attributes
                {
                    DroppedAttributesCount = OpenTelemetry.Trace.Config.TraceParams.Default.MaxNumberOfAttributes - link.Attributes.Count,

                    AttributeMap = { link.Attributes.ToDictionary(
                                         att => att.Key,
                                         att => att.Value.ToAttributeValue()) }
                };
            }

            return(ret);
        }
        public static Span.Types.Link ToLink(this ActivityLink link)
        {
            var ret = new Span.Types.Link
            {
                SpanId  = link.Context.SpanId.ToHexString(),
                TraceId = link.Context.TraceId.ToHexString(),
            };

            if (link.Tags != null)
            {
                ret.Attributes = new Span.Types.Attributes
                {
                    AttributeMap =
                    {
                        link.Tags.ToDictionary(
                            att => att.Key,
                            att => att.Value.ToAttributeValue()),
                    },
                };
            }

            return(ret);
        }