public void SerializeWithoutDimensionsIsCorrect() { var timestamp = new Timestamp(new DateTime(2000, 01, 01, 05, 15, 32)).Value; var data = new MetricData("compute", null, 1000, timestamp); Assert.Equal("compute value=1000 946703732000000000", data.ToString()); }
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()); }
public void SerializeIsCorrect() { var timestamp = new Timestamp(new DateTime(2000, 01, 01, 05, 15, 32)); var data = new MetricData( name: "compute", dimensions: new[] { new Dimension("hostId", "1") }, value: 1000, timestamp: timestamp ); Assert.Equal("compute,hostId=1 value=1000 946703732000000000", data.ToString()); }
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()); }
public void SerializeWithoutTimestamp() { var data = new MetricData("memory", new[] { new Dimension("hostId", "1") }, 1000, null); Assert.Equal("memory,hostId=1 value=1000", data.ToString()); }
public void NameCanIncludeTags() { var data = new MetricData("memory,hostId=1", null, 1000, null); Assert.Equal("memory,hostId=1 value=1000", data.ToString()); }