Search in sources :

Example 6 with Exemplar

use of io.opencensus.metrics.data.Exemplar in project instrumentation-java by census-instrumentation.

the class DistributionTest method createAndGet_Exemplar.

@Test
public void createAndGet_Exemplar() {
    Exemplar exemplar = Exemplar.create(-9.9, TIMESTAMP, ATTACHMENTS);
    assertThat(exemplar.getValue()).isWithin(TOLERANCE).of(-9.9);
    assertThat(exemplar.getTimestamp()).isEqualTo(TIMESTAMP);
    assertThat(exemplar.getAttachments()).isEqualTo(ATTACHMENTS);
}
Also used : Exemplar(io.opencensus.metrics.data.Exemplar) Test(org.junit.Test)

Example 7 with Exemplar

use of io.opencensus.metrics.data.Exemplar in project instrumentation-java by census-instrumentation.

the class DistributionTest method createAndGet_BucketWithExemplar.

@Test
public void createAndGet_BucketWithExemplar() {
    Exemplar exemplar = Exemplar.create(12.2, TIMESTAMP, ATTACHMENTS);
    Bucket bucket = Bucket.create(7, exemplar);
    assertThat(bucket.getCount()).isEqualTo(7);
    assertThat(bucket.getExemplar()).isEqualTo(exemplar);
}
Also used : Exemplar(io.opencensus.metrics.data.Exemplar) Bucket(io.opencensus.metrics.export.Distribution.Bucket) Test(org.junit.Test)

Aggregations

Exemplar (io.opencensus.metrics.data.Exemplar)7 Test (org.junit.Test)6 Bucket (io.opencensus.metrics.export.Distribution.Bucket)2 DistributionData (io.opencensus.stats.AggregationData.DistributionData)2 Timestamp (io.opencensus.common.Timestamp)1 MutableDistribution (io.opencensus.implcore.stats.MutableAggregation.MutableDistribution)1 MutableLastValueDouble (io.opencensus.implcore.stats.MutableAggregation.MutableLastValueDouble)1 MutableSumDouble (io.opencensus.implcore.stats.MutableAggregation.MutableSumDouble)1 StatsTestUtil.createEmptyViewData (io.opencensus.implcore.stats.StatsTestUtil.createEmptyViewData)1 BucketOptions (io.opencensus.metrics.export.Distribution.BucketOptions)1 ExplicitOptions (io.opencensus.metrics.export.Distribution.BucketOptions.ExplicitOptions)1 Point (io.opencensus.metrics.export.Point)1 LastValueDataDouble (io.opencensus.stats.AggregationData.LastValueDataDouble)1 SumDataDouble (io.opencensus.stats.AggregationData.SumDataDouble)1 View (io.opencensus.stats.View)1 ViewData (io.opencensus.stats.ViewData)1 ArrayList (java.util.ArrayList)1 Map (java.util.Map)1