Пример #1
0
 public void AddProperties(CounterMetadata original)
 {
     foreach (var kvp in original.Properties)
     {
         Properties [kvp.Key] = kvp.Value;
     }
 }
Пример #2
0
 public void AddTo(CounterMetadata metadata)
 {
     for (var bucket = 0; bucket < buckets.Length; bucket++)
     {
         metadata.Properties [$"Bucket{bucket}"] = buckets [bucket];
     }
 }
Пример #3
0
 public CounterMetadata(CounterMetadata original)
 {
     if (original?.Properties != null)
     {
         this.Properties = new Dictionary <string, object> (original.Properties);
     }
     else
     {
         this.Properties = new Dictionary <string, object> ();
     }
 }
Пример #4
0
        public void BucketIndexing()
        {
            var bucketLimits = ImmutableArray.Create(0, 1, 2, 3, 4);
            var bucket       = new BucketTimings(bucketLimits);

            for (int i = 0; i < bucketLimits.Length + 1; ++i)
            {
                bucket.Add(TimeSpan.FromMilliseconds(i));
            }

            var metadata = new CounterMetadata();

            bucket.AddTo(metadata);

            for (int i = 0; i < bucketLimits.Length + 1; ++i)
            {
                Assert.AreEqual(1, metadata.Properties [$"Bucket{i}"]);
            }

            Assert.That(metadata.Properties, Is.Not.Contains($"Bucket{bucketLimits.Length + 2}"));
        }
Пример #5
0
 public CounterMetadata(CounterMetadata original)
 {
     this.properties = new Dictionary <string, object> (original.properties);
 }