/** Convert this {@link MutableViewData} to {@link ViewData}. */
 internal abstract IViewData ToViewData(ITimestamp now, StatsCollectionState state);
 /** Record double stats with the given tags. */
 internal abstract void Record(ITagContext context, double value, ITimestamp timestamp);
 /** Record long stats with the given tags. */
 internal void Record(ITagContext tags, long value, ITimestamp timestamp)
 {
     // TODO(songya): shall we check for precision loss here?
     Record(tags, (double)value, timestamp);
 }
Example #4
0
        private static long GetNanos(ITimestamp time)
        {
            var nanoSeconds = time.Seconds * NUM_NANOS_PER_SECOND;

            return(nanoSeconds + time.Nanos);
        }
 internal static MutableViewData Create(IView view, ITimestamp start)
 {
     return(new CumulativeMutableViewData(view, start));
 }
 private TimestampConverter(ITimestamp timestamp, long nanoTime)
 {
     this.timestamp = timestamp;
     this.nanoTime  = nanoTime;
 }
        public StatfulClient(IClientConfiguration configurationGateway, IMessageBuffer buffer, ITimestamp timestamp,
                             ILuckyCoin luckyCoin)
        {
            this.buffer    = buffer ?? throw new ArgumentNullException("buffer", "Buffer message cannot be null!");
            this.timestamp = timestamp ?? throw new ArgumentNullException("timestamp", "Timestamp calculator cannot be null!");
            this.luckyCoin = luckyCoin ?? throw new ArgumentNullException("luckyCoin", "Lucky coin cannot be null!");

            this.configurationGateway = configurationGateway ?? throw new ArgumentNullException("configurationGateway", "Configuration gateway cannot be null!");
            this.logger = configurationGateway.Logger;
        }
Example #8
0
 public static ITimedEvent <T> Create(ITimestamp timestamp, T @event)
 {
     return(new TimedEvent <T>(timestamp, @event));
 }
 private static TimeInterval CreateTimeInterval(ITimestamp start, ITimestamp end)
 {
     return(new TimeInterval {
         StartTime = start.ToTimestamp(), EndTime = end.ToTimestamp()
     });
 }
 internal override void ResumeStatsCollection(ITimestamp now)
 {
     start = now;
 }
Example #11
0
 internal TimedEvent(ITimestamp timestamp, T @event)
 {
     this.Timestamp = timestamp;
     this.Event     = @event;
 }
 internal CumulativeMutableViewData(IView view, ITimestamp start)
     : base(view)
 {
     this.start = start;
 }
Example #13
0
        public static IViewData Create(IView view, IDictionary <TagValues, IAggregationData> map, ITimestamp start, ITimestamp end)
        {
            IDictionary <TagValues, IAggregationData> deepCopy = new Dictionary <TagValues, IAggregationData>();

            foreach (var entry in map)
            {
                CheckAggregation(view.Aggregation, entry.Value, view.Measure);
                deepCopy.Add(entry.Key, entry.Value);
            }

            return(new ViewData(
                       view,
                       new ReadOnlyDictionary <TagValues, IAggregationData>(deepCopy),
                       start,
                       end));
        }
Example #14
0
        internal ViewData(IView view, IDictionary <TagValues, IAggregationData> aggregationMap, ITimestamp start, ITimestamp end)
        {
            if (view == null)
            {
                throw new ArgumentNullException(nameof(view));
            }

            this.View = view;
            if (aggregationMap == null)
            {
                throw new ArgumentNullException(nameof(aggregationMap));
            }

            this.AggregationMap = aggregationMap;

            if (start == null)
            {
                throw new ArgumentNullException(nameof(start));
            }

            this.Start = start;
            if (end == null)
            {
                throw new ArgumentNullException(nameof(end));
            }

            this.End = end;
        }
 // Resume stats collection, and reset Start Timestamp (for CumulativeMutableViewData), or refresh
 // bucket list (for InternalMutableViewData).
 internal abstract void ResumeStatsCollection(ITimestamp now);
 public SerializationBuilder(ITimestamp timestamp = null)
 {
     _timestamp = timestamp ?? new Timestamp();
     TestObject = new MessageSerializationService();
 }
Example #17
0
        internal SpanData(
            ISpanContext context,
            ISpanId parentSpanId,
            bool?hasRemoteParent,
            string name,
            ITimestamp startTimestamp,
            IAttributes attributes,
            ITimedEvents <IAnnotation> annotations,
            ITimedEvents <IMessageEvent> messageEvents,
            ILinks links,
            int?childSpanCount,
            Status status,
            ITimestamp endTimestamp)
        {
            if (context == null)
            {
                throw new ArgumentNullException(nameof(context));
            }

            this.Context         = context;
            this.ParentSpanId    = parentSpanId;
            this.HasRemoteParent = hasRemoteParent;
            if (name == null)
            {
                throw new ArgumentNullException(nameof(name));
            }

            this.Name = name;
            if (startTimestamp == null)
            {
                throw new ArgumentNullException(nameof(startTimestamp));
            }

            this.StartTimestamp = startTimestamp;
            if (attributes == null)
            {
                throw new ArgumentNullException(nameof(attributes));
            }

            this.Attributes = attributes;
            if (annotations == null)
            {
                throw new ArgumentNullException(nameof(annotations));
            }

            this.Annotations = annotations;
            if (messageEvents == null)
            {
                throw new ArgumentNullException(nameof(messageEvents));
            }

            this.MessageEvents = messageEvents;
            if (links == null)
            {
                throw new ArgumentNullException(nameof(links));
            }

            this.Links          = links;
            this.ChildSpanCount = childSpanCount;
            this.Status         = status;
            this.EndTimestamp   = endTimestamp;
        }
Example #18
0
 public void AdvanceTime(IDuration duration)
 {
     lock (_lck) { currentTime = currentTime.AddDuration(duration); }
 }
 public NettyDiscoveryHandler(IDiscoveryManager discoveryManager, IDatagramChannel channel, IMessageSerializationService messageSerializationService, ITimestamp timestamp, ILogManager logManager)
 {
     _logger                      = logManager?.GetClassLogger() ?? throw new ArgumentNullException(nameof(logManager));
     _discoveryManager            = discoveryManager ?? throw new ArgumentNullException(nameof(discoveryManager));
     _channel                     = channel ?? throw new ArgumentNullException(nameof(channel));
     _messageSerializationService = messageSerializationService ?? throw new ArgumentNullException(nameof(messageSerializationService));
     _timestamp                   = timestamp ?? throw new ArgumentNullException(nameof(timestamp));
 }
 public MessageBuilder(ITimestamp timestamp)
 {
     this.timestamp = timestamp;
 }