Search in sources :

Example 1 with InfluxDbPoint

use of io.dropwizard.metrics.influxdb.data.InfluxDbPoint in project light-4j by networknt.

the class InfluxDbReporterTest method reportsDoubleGaugeValues.

@Test
public void reportsDoubleGaugeValues() throws Exception {
    reporter.report(map("gauge", gauge(1.1)), this.map(), this.map(), this.map(), this.map());
    final ArgumentCaptor<InfluxDbPoint> influxDbPointCaptor = ArgumentCaptor.forClass(InfluxDbPoint.class);
    Mockito.verify(influxDb, atLeastOnce()).appendPoints(influxDbPointCaptor.capture());
    InfluxDbPoint point = influxDbPointCaptor.getValue();
/*
        assertThat(point.getMeasurement()).isEqualTo("gauge");
        assertThat(point.getFields()).isNotEmpty();
        assertThat(point.getFields()).hasSize(1);
        assertThat(point.getFields()).contains(entry("value", 1.1));
        */
}
Also used : InfluxDbPoint(io.dropwizard.metrics.influxdb.data.InfluxDbPoint) Test(org.junit.Test)

Example 2 with InfluxDbPoint

use of io.dropwizard.metrics.influxdb.data.InfluxDbPoint in project light-4j by networknt.

the class InfluxDbReporterTest method reportsCounters.

@Test
public void reportsCounters() throws Exception {
    final Counter counter = mock(Counter.class);
    Mockito.when(counter.getCount()).thenReturn(100L);
    reporter.report(this.map(), this.map("counter", counter), this.map(), this.map(), this.map());
    final ArgumentCaptor<InfluxDbPoint> influxDbPointCaptor = ArgumentCaptor.forClass(InfluxDbPoint.class);
    Mockito.verify(influxDb, atLeastOnce()).appendPoints(influxDbPointCaptor.capture());
    InfluxDbPoint point = influxDbPointCaptor.getValue();
    System.out.println("point = " + point);
/*
        assertThat(point.getMeasurement()).isEqualTo("counter");
        assertThat(point.getFields()).isNotEmpty();
        assertThat(point.getFields()).hasSize(1);
        assertThat(point.getFields()).contains(entry("count", 100L));
        */
}
Also used : Counter(io.dropwizard.metrics.Counter) InfluxDbPoint(io.dropwizard.metrics.influxdb.data.InfluxDbPoint) Test(org.junit.Test)

Example 3 with InfluxDbPoint

use of io.dropwizard.metrics.influxdb.data.InfluxDbPoint in project light-4j by networknt.

the class InfluxDbReporterTest method reportsIntegerGaugeValues.

@Test
public void reportsIntegerGaugeValues() throws Exception {
    reporter.report(map("gauge", gauge(1)), this.map(), this.map(), this.map(), this.map());
    final ArgumentCaptor<InfluxDbPoint> influxDbPointCaptor = ArgumentCaptor.forClass(InfluxDbPoint.class);
    Mockito.verify(influxDb, atLeastOnce()).appendPoints(influxDbPointCaptor.capture());
    InfluxDbPoint point = influxDbPointCaptor.getValue();
/*
        assertThat(point.getMeasurement()).isEqualTo("gauge");
        assertThat(point.getFields()).isNotEmpty();
        assertThat(point.getFields()).hasSize(1);
        assertThat(point.getFields()).contains(entry("value", 1));
        */
}
Also used : InfluxDbPoint(io.dropwizard.metrics.influxdb.data.InfluxDbPoint) Test(org.junit.Test)

Example 4 with InfluxDbPoint

use of io.dropwizard.metrics.influxdb.data.InfluxDbPoint in project light-4j by networknt.

the class InfluxDbReporterTest method reportsFloatGaugeValues.

@Test
public void reportsFloatGaugeValues() throws Exception {
    reporter.report(map("gauge", gauge(1.1f)), this.map(), this.map(), this.map(), this.map());
    final ArgumentCaptor<InfluxDbPoint> influxDbPointCaptor = ArgumentCaptor.forClass(InfluxDbPoint.class);
    Mockito.verify(influxDb, atLeastOnce()).appendPoints(influxDbPointCaptor.capture());
    InfluxDbPoint point = influxDbPointCaptor.getValue();
/*
        assertThat(point.getMeasurement()).isEqualTo("gauge");
        assertThat(point.getFields()).isNotEmpty();
        assertThat(point.getFields()).hasSize(1);
        assertThat(point.getFields()).contains(entry("value", 1.1f));
        */
}
Also used : InfluxDbPoint(io.dropwizard.metrics.influxdb.data.InfluxDbPoint) Test(org.junit.Test)

Example 5 with InfluxDbPoint

use of io.dropwizard.metrics.influxdb.data.InfluxDbPoint in project light-4j by networknt.

the class InfluxDbReporterTest method reportsLongGaugeValues.

@Test
public void reportsLongGaugeValues() throws Exception {
    reporter.report(map("gauge", gauge(1L)), this.map(), this.map(), this.map(), this.map());
    final ArgumentCaptor<InfluxDbPoint> influxDbPointCaptor = ArgumentCaptor.forClass(InfluxDbPoint.class);
    Mockito.verify(influxDb, atLeastOnce()).appendPoints(influxDbPointCaptor.capture());
    InfluxDbPoint point = influxDbPointCaptor.getValue();
/*
        assertThat(point.getMeasurement()).isEqualTo("gauge");
        assertThat(point.getFields()).isNotEmpty();
        assertThat(point.getFields()).hasSize(1);
        assertThat(point.getFields()).contains(entry("value", 1L));
        */
}
Also used : InfluxDbPoint(io.dropwizard.metrics.influxdb.data.InfluxDbPoint) Test(org.junit.Test)

Aggregations

InfluxDbPoint (io.dropwizard.metrics.influxdb.data.InfluxDbPoint)14 Test (org.junit.Test)9 Snapshot (io.dropwizard.metrics.Snapshot)4 Counter (io.dropwizard.metrics.Counter)1 Histogram (io.dropwizard.metrics.Histogram)1 Meter (io.dropwizard.metrics.Meter)1 Timer (io.dropwizard.metrics.Timer)1