Ejemplo n.º 1
0
        //public virtual void AddMessageEvent(MessageEventBase messageEvent)
        //{
        // Default implementation by invoking addNetworkEvent() so that any existing derived classes,
        // including implementation and the mocked ones, do not need to override this method explicitly.
        //addNetworkEvent(BaseMessageEventUtil.asNetworkEvent(messageEvent));
        //}

        //public abstract void AddLink(LinkBase link);

        private Span(
            ISpanContext context,
            SpanOptions options,
            string name,
            ISpanId parentSpanId,
            bool?hasRemoteParent,
            ITraceParams traceParams,
            IStartEndHandler startEndHandler,
            ITimestampConverter timestampConverter,
            IClock clock)
            : base(context, options)
        {
            this.parentSpanId           = parentSpanId;
            this.hasRemoteParent        = hasRemoteParent;
            this.name                   = name;
            this.traceParams            = traceParams;
            this.startEndHandler        = startEndHandler;
            this.clock                  = clock;
            this.hasBeenEnded           = false;
            this.sampleToLocalSpanStore = false;
            if (options.HasFlag(SpanOptions.RECORD_EVENTS))
            {
                this.timestampConverter = timestampConverter != null ? timestampConverter : Census.Internal.TimestampConverter.Now(clock);
                startNanoTime           = clock.NowNanos;
            }
            else
            {
                this.startNanoTime      = 0;
                this.timestampConverter = timestampConverter;
            }
        }
Ejemplo n.º 2
0
 private Span(
     ISpanContext context,
     SpanOptions options,
     string name,
     ISpanId parentSpanId,
     bool?hasRemoteParent,
     ITraceParams traceParams,
     IStartEndHandler startEndHandler,
     ITimestampConverter timestampConverter,
     IClock clock)
     : base(context, options)
 {
     this.parentSpanId           = parentSpanId;
     this.hasRemoteParent        = hasRemoteParent;
     this.Name                   = name;
     this.traceParams            = traceParams ?? throw new ArgumentNullException(nameof(traceParams));
     this.startEndHandler        = startEndHandler;
     this.clock                  = clock;
     this.hasBeenEnded           = false;
     this.sampleToLocalSpanStore = false;
     if (options.HasFlag(SpanOptions.RecordEvents))
     {
         this.timestampConverter = timestampConverter ?? OpenCensus.Internal.TimestampConverter.Now(clock);
         this.startNanoTime      = clock.NowNanos;
     }
     else
     {
         this.startNanoTime      = 0;
         this.timestampConverter = timestampConverter;
     }
 }
Ejemplo n.º 3
0
 protected SpanBase(ISpanContext context, SpanOptions options = SpanOptions.NONE)
 {
     if (context == null)
     {
         throw new ArgumentNullException(nameof(context));
     }
     if (context.TraceOptions.IsSampled && !options.HasFlag(SpanOptions.RECORD_EVENTS))
     {
         throw new ArgumentOutOfRangeException("Span is sampled, but does not have RECORD_EVENTS set.");
     }
     Context = context;
     Options = options;
 }
Ejemplo n.º 4
0
 private Span(
     ISpanContext context,
     SpanOptions options,
     string name,
     ISpanId parentSpanId,
     bool?hasRemoteParent,
     ITraceParams traceParams,
     IStartEndHandler startEndHandler,
     Timer timestampConverter)
     : base(context, options)
 {
     this.parentSpanId           = parentSpanId;
     this.hasRemoteParent        = hasRemoteParent;
     this.Name                   = name;
     this.traceParams            = traceParams ?? throw new ArgumentNullException(nameof(traceParams));
     this.startEndHandler        = startEndHandler;
     this.hasBeenEnded           = false;
     this.sampleToLocalSpanStore = false;
     if (options.HasFlag(SpanOptions.RecordEvents))
     {
         if (timestampConverter == null)
         {
             this.timestampConverter = Timer.StartNew();
             this.startTime          = this.timestampConverter.StartTime;
         }
         else
         {
             this.timestampConverter = timestampConverter;
             this.startTime          = this.timestampConverter.Now;
         }
     }
     else
     {
         this.startTime          = DateTimeOffset.MinValue;
         this.timestampConverter = timestampConverter;
     }
 }