Exemplo n.º 1
0
        public void ParseWithoutDimensionsIsCorrect()
        {
            var timestamp = new Timestamp(new DateTime(2000, 01, 01, 05, 15, 32)).Value;

            var data = MetricData.Parse("compute value=1000 946703732000000000");

            Assert.Equal("value", data.Properties[0].Name);
            Assert.Equal(1000d, data.Properties[0].Value);

            Assert.Equal(timestamp, data.Timestamp.Value);
        }
Exemplo n.º 2
0
        public void ParseWithoutTimestamp()
        {
            var a = MetricData.Parse("requestCount,appId=1 value=1000");

            Assert.Equal("requestCount", a.Name);

            Assert.Equal("appId", a.Dimensions[0].Name);
            Assert.Equal("1", a.Dimensions[0].Value);

            Assert.Equal(1000d, a.Properties[0].Value);

            Assert.Null(a.Timestamp);
        }
Exemplo n.º 3
0
        public void Parse()
        {
            var a = MetricData.Parse("requestCount,appId=1,appVersion=5.1.1 value=1000 0");

            Assert.Equal("requestCount", a.Name);

            Assert.Equal("appId", a.Dimensions[0].Name);
            Assert.Equal("1", a.Dimensions[0].Value);
            Assert.Equal("appVersion", a.Dimensions[1].Name);
            Assert.Equal("5.1.1", a.Dimensions[1].Value);

            Assert.Equal(1000d, a.Properties[0].Value);
            Assert.Equal(0, a.Timestamp);
        }
Exemplo n.º 4
0
        public void SerializeMultiplePropertiesIsCorrect()
        {
            var timestamp = new Timestamp(new DateTime(2000, 01, 01, 05, 15, 32)).Value;

            var data = new MetricData(
                name: "compute",
                dimensions: new[] { new Dimension("hostId", "1"), new Dimension("locationId", "10") },
                properties: new[] { new MetricDataProperty("count", 1), new MetricDataProperty("value", 100d) },
                timestamp: timestamp
                );

            Assert.Equal("compute,hostId=1,locationId=10 count=1i,value=100 946703732000000000", data.ToString());

            var data2 = MetricData.Parse(data.ToString());

            Assert.Equal("compute,hostId=1,locationId=10 count=1i,value=100 946703732000000000", data2.ToString());
        }
Exemplo n.º 5
0
        public void A()
        {
            var point = MetricData.Parse("transfer,accountId=1,country=AU,type=egress value=100 1422568543702900257");

            Assert.Equal(3, point.Dimensions.Length);

            var a = Aggregates.GetSeriesPermutations(point).ToArray();

            Assert.Equal(@"
transfer
transfer,accountId=1
transfer,accountId=1,country=AU
transfer,accountId=1,country=AU,type=egress
transfer,country=AU
transfer,country=AU,type=egress
transfer,type=egress".Trim(), string.Join(Environment.NewLine, a));
        }
Exemplo n.º 6
0
        public void SerializeMultipleProperties2IsCorrect()
        {
            var data = new MetricData(
                name: "ƒ/decode",
                dimensions: null,
                properties: new[] {
                new MetricDataProperty("count", 4565234),
                new MetricDataProperty("pixels", 100),
                new MetricDataProperty("time", new TimeSpan((long)(54.4522d * TimeSpan.TicksPerSecond)))
            },
                timestamp: null
                );

            Assert.Equal("ƒ/decode count=4565234i,pixels=100i,time=54.4522", data.ToString());

            var data2 = MetricData.Parse(data.ToString());

            Assert.Equal("ƒ/decode count=4565234i,pixels=100i,time=54.4522", data2.ToString());
        }