Skip to content

Commit a4a7131

Browse files
authored
Metrics: Merge Beta Version of Metrics Preaggregation into Develop
2 parents 057c255 + 6092810 commit a4a7131

File tree

82 files changed

+19596
-26
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

82 files changed

+19596
-26
lines changed

Microsoft.ApplicationInsights.sln

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
Microsoft Visual Studio Solution File, Format Version 12.00
33
# Visual Studio 15
4-
VisualStudioVersion = 15.0.27128.1
4+
VisualStudioVersion = 15.0.26430.16
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Microsoft.ApplicationInsights.Tests", "Microsoft.ApplicationInsights.Tests", "{C2FEEDE5-8CAE-41A4-8932-42D284A86EA7}"
77
EndProject

PublicAPI/Microsoft.ApplicationInsights.dll/net45/PublicAPI.Unshipped.txt

Lines changed: 236 additions & 4 deletions
Large diffs are not rendered by default.

PublicAPI/Microsoft.ApplicationInsights.dll/net46/PublicAPI.Unshipped.txt

Lines changed: 236 additions & 3 deletions
Large diffs are not rendered by default.

PublicAPI/Microsoft.ApplicationInsights.dll/netstandard1.3/PublicAPI.Unshipped.txt

Lines changed: 236 additions & 3 deletions
Large diffs are not rendered by default.

Test/Microsoft.ApplicationInsights.Test/Shared/MetricTests.cs

Lines changed: 1699 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
using System;
2+
3+
using Microsoft.VisualStudio.TestTools.UnitTesting;
4+
using Microsoft.ApplicationInsights.Extensibility;
5+
6+
using System.Linq;
7+
using Microsoft.ApplicationInsights.DataContracts;
8+
using Microsoft.ApplicationInsights.Channel;
9+
10+
namespace Microsoft.ApplicationInsights.Metrics.Extensibility
11+
{
12+
/// <summary />
13+
[TestClass]
14+
public class AggregationPeriodSummaryTests
15+
{
16+
/// <summary />
17+
[TestMethod]
18+
public void Ctor()
19+
{
20+
{
21+
var period = new AggregationPeriodSummary(null, null);
22+
Assert.IsNotNull(period);
23+
}
24+
}
25+
26+
/// <summary />
27+
[TestMethod]
28+
public void PersistentAggregates()
29+
{
30+
{
31+
MetricAggregate[] p = new MetricAggregate[0];
32+
var period = new AggregationPeriodSummary(p, null);
33+
34+
Assert.IsNull(period.NonpersistentAggregates);
35+
36+
Assert.IsNotNull(period.PersistentAggregates);
37+
Assert.AreSame(p, period.PersistentAggregates);
38+
Assert.AreEqual(0, period.PersistentAggregates.Count);
39+
}
40+
{
41+
MetricAggregate[] p = new MetricAggregate[] { new MetricAggregate("mns1", "mid1", "KindA"),
42+
new MetricAggregate("mns2", "mid2", "KindB"),
43+
new MetricAggregate("mns3", "mid3", "KindC") };
44+
var period = new AggregationPeriodSummary(p, null);
45+
46+
Assert.IsNull(period.NonpersistentAggregates);
47+
48+
Assert.IsNotNull(period.PersistentAggregates);
49+
Assert.AreSame(p, period.PersistentAggregates);
50+
Assert.AreEqual(3, period.PersistentAggregates.Count);
51+
52+
Assert.AreEqual("mns1", period.PersistentAggregates[0].MetricNamespace);
53+
Assert.AreEqual("mid1", period.PersistentAggregates[0].MetricId);
54+
Assert.AreEqual("KindA", period.PersistentAggregates[0].AggregationKindMoniker);
55+
56+
Assert.AreEqual("mns2", period.PersistentAggregates[1].MetricNamespace);
57+
Assert.AreEqual("mid2", period.PersistentAggregates[1].MetricId);
58+
Assert.AreEqual("KindB", period.PersistentAggregates[1].AggregationKindMoniker);
59+
60+
Assert.AreEqual("mns3", period.PersistentAggregates[2].MetricNamespace);
61+
Assert.AreEqual("mid3", period.PersistentAggregates[2].MetricId);
62+
Assert.AreEqual("KindC", period.PersistentAggregates[2].AggregationKindMoniker);
63+
}
64+
{
65+
MetricAggregate[] np = new MetricAggregate[] { new MetricAggregate("MNS1", "mid1", "KindA"),
66+
new MetricAggregate("MNS2", "mid2", "KindB"),
67+
new MetricAggregate("MNS3", "mid3", "KindC") };
68+
var period = new AggregationPeriodSummary(null, np);
69+
70+
Assert.IsNull(period.PersistentAggregates);
71+
72+
Assert.IsNotNull(period.NonpersistentAggregates);
73+
Assert.AreSame(np, period.NonpersistentAggregates);
74+
Assert.AreEqual(3, period.NonpersistentAggregates.Count);
75+
76+
Assert.AreEqual("MNS1", period.NonpersistentAggregates[0].MetricNamespace);
77+
Assert.AreEqual("mid1", period.NonpersistentAggregates[0].MetricId);
78+
Assert.AreEqual("KindA", period.NonpersistentAggregates[0].AggregationKindMoniker);
79+
80+
Assert.AreEqual("MNS2", period.NonpersistentAggregates[1].MetricNamespace);
81+
Assert.AreEqual("mid2", period.NonpersistentAggregates[1].MetricId);
82+
Assert.AreEqual("KindB", period.NonpersistentAggregates[1].AggregationKindMoniker);
83+
84+
Assert.AreEqual("MNS3", period.NonpersistentAggregates[2].MetricNamespace);
85+
Assert.AreEqual("mid3", period.NonpersistentAggregates[2].MetricId);
86+
Assert.AreEqual("KindC", period.NonpersistentAggregates[2].AggregationKindMoniker);
87+
}
88+
89+
}
90+
}
91+
}

0 commit comments

Comments
 (0)