use of com.microsoft.applicationinsights.smoketest.schemav2.DataPoint in project ApplicationInsights-Java by microsoft.
the class CoreAndFilterTests method trackMetric.
@Test
@TargetUri("/trackMetric")
public void trackMetric() throws Exception {
List<Envelope> rdList = mockedIngestion.waitForItems("RequestData", 1);
List<Envelope> mdList = mockedIngestion.waitForItems("MetricData", 1);
Envelope rdEnvelope = rdList.get(0);
Envelope mdEnvelope = mdList.get(0);
RequestData rd = (RequestData) ((Data<?>) rdEnvelope.getData()).getBaseData();
MetricData md = (MetricData) ((Data<?>) mdEnvelope.getData()).getBaseData();
List<DataPoint> metrics = md.getMetrics();
assertEquals(1, metrics.size());
DataPoint dp = metrics.get(0);
final double expectedValue = 111222333.0;
double epsilon = Math.ulp(expectedValue);
assertEquals(DataPointType.Measurement, dp.getKind());
assertEquals(expectedValue, dp.getValue(), epsilon);
assertEquals("TimeToRespond", dp.getName());
assertNull("getCount was non-null", dp.getCount());
assertNull("getMin was non-null", dp.getMin());
assertNull("getMax was non-null", dp.getMax());
assertNull("getStdDev was non-null", dp.getStdDev());
assertParentChild(rd, rdEnvelope, mdEnvelope, "GET /CoreAndFilter/trackMetric");
}
use of com.microsoft.applicationinsights.smoketest.schemav2.DataPoint in project ApplicationInsights-Java by microsoft.
the class MicrometerTest method doMostBasicTest.
@Test
@TargetUri("/test")
public void doMostBasicTest() throws Exception {
Telemetry telemetry = getTelemetry(0);
assertEquals("GET /test", telemetry.rd.getName());
assertTrue(telemetry.rd.getUrl().matches("http://localhost:[0-9]+/test"));
assertEquals("200", telemetry.rd.getResponseCode());
assertTrue(telemetry.rd.getSuccess());
assertNull(telemetry.rd.getSource());
assertTrue(telemetry.rd.getProperties().isEmpty());
assertTrue(telemetry.rd.getMeasurements().isEmpty());
// sleep a bit and make sure that the excluded metric is not reported
Thread.sleep(10000);
List<Envelope> metricItems = mockedIngestion.getItemsEnvelopeDataType("MetricData").stream().filter(e -> {
MetricData data = (MetricData) ((Data<?>) e.getData()).getBaseData();
List<DataPoint> points = data.getMetrics();
DataPoint point = points.get(0);
return point.getValue() == 1;
}).collect(Collectors.toList());
MetricData data = (MetricData) ((Data<?>) metricItems.get(0).getData()).getBaseData();
List<DataPoint> points = data.getMetrics();
assertEquals(1, points.size());
DataPoint point = points.get(0);
assertEquals(DataPointType.Measurement, point.getKind());
// (this was verified above in Predicate also)
assertEquals(1, point.getValue(), 0);
assertEquals("test_counter", point.getName());
assertNull("getCount was non-null", point.getCount());
assertNull("getMin was non-null", point.getMin());
assertNull("getMax was non-null", point.getMax());
assertNull("getStdDev was non-null", point.getStdDev());
assertEquals(1, data.getProperties().size());
assertEquals("value1", data.getProperties().get("tag1"));
}
use of com.microsoft.applicationinsights.smoketest.schemav2.DataPoint in project ApplicationInsights-Java by microsoft.
the class PerfCountersDataTest method assertPerfMetric.
private void assertPerfMetric(MetricData perfMetric) {
List<DataPoint> metrics = perfMetric.getMetrics();
assertEquals(1, metrics.size());
DataPoint dp = metrics.get(0);
assertEquals(DataPointType.Measurement, dp.getKind());
}
Aggregations