Search in sources :

Example 21 with MetricDescriptor

use of io.opencensus.metrics.export.MetricDescriptor in project instrumentation-java by census-instrumentation.

the class MetricUtilsTest method viewToMetricDescriptor.

@Test
public void viewToMetricDescriptor() {
    MetricDescriptor metricDescriptor = MetricUtils.viewToMetricDescriptor(VIEW_1);
    assertThat(metricDescriptor).isNotNull();
    assertThat(metricDescriptor.getName()).isEqualTo(VIEW_NAME.asString());
    assertThat(metricDescriptor.getUnit()).isEqualTo(MEASURE_UNIT);
    assertThat(metricDescriptor.getType()).isEqualTo(Type.GAUGE_DOUBLE);
    assertThat(metricDescriptor.getDescription()).isEqualTo(VIEW_DESCRIPTION);
    assertThat(metricDescriptor.getLabelKeys()).containsExactly(LabelKey.create(KEY.getName(), ""));
}
Also used : MetricDescriptor(io.opencensus.metrics.export.MetricDescriptor) Test(org.junit.Test)

Aggregations

MetricDescriptor (io.opencensus.metrics.export.MetricDescriptor)21 TimeSeries (io.opencensus.metrics.export.TimeSeries)17 ArrayList (java.util.ArrayList)11 Test (org.junit.Test)11 LabelValue (io.opencensus.metrics.LabelValue)10 LabelKey (io.opencensus.metrics.LabelKey)8 Metric (io.opencensus.metrics.export.Metric)8 Timestamp (io.opencensus.common.Timestamp)4 Point (io.opencensus.metrics.export.Point)3 AbstractMap (java.util.AbstractMap)3 List (java.util.List)3 Type (io.opencensus.metrics.export.MetricDescriptor.Type)2 Snapshot (io.opencensus.metrics.export.Summary.Snapshot)2 ValueAtPercentile (io.opencensus.metrics.export.Summary.Snapshot.ValueAtPercentile)2 Value (io.opencensus.metrics.export.Value)2 Nullable (javax.annotation.Nullable)2 DataPoint (com.signalfx.metrics.protobuf.SignalFxProtocolBuffers.DataPoint)1 MetricType (com.signalfx.metrics.protobuf.SignalFxProtocolBuffers.MetricType)1 DoublePoint (io.opencensus.metrics.DoubleCumulative.DoublePoint)1 DoublePoint (io.opencensus.metrics.DoubleGauge.DoublePoint)1