public void AddProperties(CounterMetadata original) { foreach (var kvp in original.Properties) { Properties [kvp.Key] = kvp.Value; } }
public void AddTo(CounterMetadata metadata) { for (var bucket = 0; bucket < buckets.Length; bucket++) { metadata.Properties [$"Bucket{bucket}"] = buckets [bucket]; } }
public CounterMetadata(CounterMetadata original) { if (original?.Properties != null) { this.Properties = new Dictionary <string, object> (original.Properties); } else { this.Properties = new Dictionary <string, object> (); } }
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}")); }
public CounterMetadata(CounterMetadata original) { this.properties = new Dictionary <string, object> (original.properties); }