Ejemplo n.º 1
0
        internal SpanData(
            ISpanContext context,
            ISpanId parentSpanId,
            bool?hasRemoteParent,
            string name,
            Timestamp startTimestamp,
            IAttributes attributes,
            ITimedEvents <IAnnotation> annotations,
            ITimedEvents <IMessageEvent> messageEvents,
            ILinks links,
            int?childSpanCount,
            Status status,
            SpanKind kind,
            Timestamp endTimestamp)
        {
            this.Context         = context ?? throw new ArgumentNullException(nameof(context));
            this.ParentSpanId    = parentSpanId;
            this.HasRemoteParent = hasRemoteParent;
            this.Name            = name ?? throw new ArgumentNullException(nameof(name));
            this.StartTimestamp  = startTimestamp ?? throw new ArgumentNullException(nameof(startTimestamp));
            this.Attributes      = attributes ?? Export.Attributes.Create(new Dictionary <string, IAttributeValue>(), 0);
            this.Annotations     = annotations ?? TimedEvents <IAnnotation> .Create(Enumerable.Empty <ITimedEvent <IAnnotation> >(), 0);

            this.MessageEvents = messageEvents ?? TimedEvents <IMessageEvent> .Create(Enumerable.Empty <ITimedEvent <IMessageEvent> >(), 0);

            this.Links          = links ?? LinkList.Create(Enumerable.Empty <ILink>(), 0);
            this.ChildSpanCount = childSpanCount;
            this.Status         = status;
            this.Kind           = kind;
            this.EndTimestamp   = endTimestamp;
        }
Ejemplo n.º 2
0
        public static ISpanData Create(
            ISpanContext context,
            ISpanId parentSpanId,
            bool?hasRemoteParent,
            string name,
            Timestamp startTimestamp,
            IAttributes attributes,
            ITimedEvents <IAnnotation> annotations,
            ITimedEvents <IMessageEvent> messageOrNetworkEvents,
            ILinks links,
            int?childSpanCount,
            Status status,
            SpanKind kind,
            Timestamp endTimestamp)
        {
            if (messageOrNetworkEvents == null)
            {
                messageOrNetworkEvents = TimedEvents <IMessageEvent> .Create(new List <ITimedEvent <IMessageEvent> >(), 0);
            }

            var messageEventsList = new List <ITimedEvent <IMessageEvent> >();

            foreach (ITimedEvent <IMessageEvent> timedEvent in messageOrNetworkEvents.Events)
            {
                messageEventsList.Add(timedEvent);
            }

            ITimedEvents <IMessageEvent> messageEvents = TimedEvents <IMessageEvent> .Create(messageEventsList, messageOrNetworkEvents.DroppedEventsCount);

            return(new SpanData(
                       context,
                       parentSpanId,
                       hasRemoteParent,
                       name,
                       startTimestamp,
                       attributes,
                       annotations,
                       messageEvents,
                       links,
                       childSpanCount,
                       status,
                       kind,
                       endTimestamp));
        }