diff --git a/api/src/main/java/io/opentelemetry/stats/Measure.java b/api/src/main/java/io/opentelemetry/metrics/Measure.java similarity index 94% rename from api/src/main/java/io/opentelemetry/stats/Measure.java rename to api/src/main/java/io/opentelemetry/metrics/Measure.java index 21b5d8d57da..b2b2d3630e1 100644 --- a/api/src/main/java/io/opentelemetry/stats/Measure.java +++ b/api/src/main/java/io/opentelemetry/metrics/Measure.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.opentelemetry.stats; +package io.opentelemetry.metrics; import javax.annotation.concurrent.ThreadSafe; @@ -27,7 +27,7 @@ public interface Measure { /** * An enum that represents all the possible value types for a {@code Measure} or a {@code - * Measurement}. + * io.opentelemetry.metrics.Measurement}. * * @since 0.1.0 */ @@ -39,7 +39,8 @@ enum Type { /** * Returns a new {@link Measurement} for this {@code Measure}. * - * @param value the corresponding {@code double} value for the {@code Measurement}. + * @param value the corresponding {@code double} value for the {@code + * io.opentelemetry.metrics.Measurement}. * @return a new {@link Measurement} for this {@code Measure}. * @throws UnsupportedOperationException if the type is not {@link Measure.Type#DOUBLE}. */ @@ -48,7 +49,8 @@ enum Type { /** * Returns a new {@link Measurement} for this {@code Measure}. * - * @param value the corresponding {@code long} value for the {@code Measurement}. + * @param value the corresponding {@code long} value for the {@code + * io.opentelemetry.metrics.Measurement}. * @return a new {@link Measurement} for this {@code Measure}. * @throws UnsupportedOperationException if the type is not {@link Measure.Type#LONG}. */ diff --git a/api/src/main/java/io/opentelemetry/stats/Measurement.java b/api/src/main/java/io/opentelemetry/metrics/Measurement.java similarity index 86% rename from api/src/main/java/io/opentelemetry/stats/Measurement.java rename to api/src/main/java/io/opentelemetry/metrics/Measurement.java index 060c50358e4..3f6f85881cb 100644 --- a/api/src/main/java/io/opentelemetry/stats/Measurement.java +++ b/api/src/main/java/io/opentelemetry/metrics/Measurement.java @@ -14,12 +14,12 @@ * limitations under the License. */ -package io.opentelemetry.stats; +package io.opentelemetry.metrics; import javax.annotation.concurrent.Immutable; /** - * Immutable representation of a {@code Measurement}. + * Immutable representation of a {@code io.opentelemetry.metrics.Measurement}. * * @since 0.1.0 */ diff --git a/api/src/main/java/io/opentelemetry/metrics/Meter.java b/api/src/main/java/io/opentelemetry/metrics/Meter.java index 1c91490d87f..2a677e79b02 100644 --- a/api/src/main/java/io/opentelemetry/metrics/Meter.java +++ b/api/src/main/java/io/opentelemetry/metrics/Meter.java @@ -16,7 +16,92 @@ package io.opentelemetry.metrics; -/** Entry point fot metrics API, this object allows to record measurements and {@link Metric}s. */ +import io.opentelemetry.tags.TagMap; +import io.opentelemetry.trace.SpanContext; +import java.util.List; + +/** + * Meter is a simple, interface that allows users to record measurements (metrics). + * + *

There are two ways to record measurements: + * + *

+ * + *

Example usage for raw measurement: + * + *

{@code
+ * class MyClass {
+ *   private static final Meter meter = Metrics.getMeter();
+ *   private static final Measure cacheHit = meter.measureBuilder("cache_hit").build();
+ *
+ *   Response serverHandler(Request request) {
+ *     if (inCache(request)) {
+ *       meter.record(Collections.singletonList(cacheHit.createMeasurement(1)));
+ *       return fromCache(request);
+ *     }
+ *     ...  // do other work
+ *   }
+ *
+ * }
+ * }
+ * + *

Example usage for already aggregated metrics: + * + *

{@code
+ * public final void exportGarbageCollectorMetrics {
+ *   final CounterLong collectionMetric =
+ *       meter
+ *           .counterLongBuilder("collection")
+ *           .setDescription("Time spent in a given JVM garbage collector in milliseconds.")
+ *           .setUnit("ms")
+ *           .setLabelKeys(Collections.singletonList(GC))
+ *           .build();
+ *   collectionMetric.setCallback(
+ *       new Runnable() {
+ *         @Override
+ *         public void run() {
+ *           for (GarbageCollectorMXBean gc : ManagementFactory.getGarbageCollectorMXBeans()) {
+ *             LabelValue gcName = LabelValue.create(gc.getName());
+ *             collectionMetric
+ *                 .getOrCreateTimeSeries(Collections.singletonList(gcName))
+ *                 .set(gc.getCollectionTime());
+ *           }
+ *         }
+ *       });
+ *   }
+ * }
+ * + *

Example usage for simple pre-defined aggregation metrics: + * + *

{@code
+ * class YourClass {
+ *
+ *   private static final Meter meter = Metrics.getMeter();
+ *   private static final MetricRegistry metricRegistry = meter.metricRegistryBuilder().build();
+ *
+ *   List labelKeys = Arrays.asList(LabelKey.create("Name", "desc"));
+ *   List labelValues = Arrays.asList(LabelValue.create("Inbound"));
+ *
+ *   GaugeDouble gauge = metricRegistry.addDoubleGauge("queue_size",
+ *                       "Pending jobs", "1", labelKeys);
+ *
+ *   // It is recommended to keep a reference of a TimeSeries.
+ *   GaugeDouble.TimeSeries inboundTimeSeries = gauge.getOrCreateTimeSeries(labelValues);
+ *
+ *   void doSomeWork() {
+ *      // Your code here.
+ *      inboundTimeSeries.add(15);
+ *   }
+ *
+ * }
+ * }
+ */ public interface Meter { /** @@ -62,4 +147,45 @@ public interface Meter { * @since 0.1.0 */ CounterLong.Builder counterLongBuilder(String name); + + /** + * Returns a new builder for a {@code Measure}. + * + * @param name Name of measure, as a {@code String}. Should be a ASCII string with a length no + * greater than 255 characters. + * @return a new builder for a {@code Measure}. + * @since 0.1.0 + */ + Measure.Builder measureBuilder(String name); + + /** + * Records all given measurements, with the current {@link + * io.opentelemetry.tags.Tagger#getCurrentTagMap}. + * + * @param measurements the list of {@code io.opentelemetry.metrics.Measurement}s to record. + * @since 0.1.0 + */ + void record(List measurements); + + /** + * Records all given measurements, with an explicit {@link TagMap}. + * + * @param measurements the list of {@code io.opentelemetry.metrics.Measurement}s to record. + * @param tags the tags associated with the measurements. + * @since 0.1.0 + */ + void record(List measurements, TagMap tags); + + /** + * Records all given measurements, with an explicit {@link TagMap}. These measurements are + * associated with the given {@code SpanContext}. + * + * @param measurements the list of {@code io.opentelemetry.metrics.Measurement}s to record. + * @param tags the tags associated with the measurements. + * @param spanContext the {@code SpanContext} that identifies the {@code Span} for which the + * measurements are associated with. + * @since 0.1.0 + */ + // TODO: Avoid tracing dependency and accept Attachments as in OpenCensus. + void record(List measurements, TagMap tags, SpanContext spanContext); } diff --git a/api/src/main/java/io/opentelemetry/metrics/NoopMetrics.java b/api/src/main/java/io/opentelemetry/metrics/NoopMetrics.java index fd90394e652..f397a13d5df 100644 --- a/api/src/main/java/io/opentelemetry/metrics/NoopMetrics.java +++ b/api/src/main/java/io/opentelemetry/metrics/NoopMetrics.java @@ -16,10 +16,15 @@ package io.opentelemetry.metrics; +import io.opentelemetry.internal.StringUtils; import io.opentelemetry.internal.Utils; import io.opentelemetry.resource.Resource; +import io.opentelemetry.tags.TagMap; +import io.opentelemetry.trace.SpanContext; import java.util.List; import java.util.Map; +import javax.annotation.concurrent.Immutable; +import javax.annotation.concurrent.ThreadSafe; /** * No-op implementations of metrics classes. @@ -40,6 +45,12 @@ public static Meter newNoopMeter() { } private static final class NoopMeter implements Meter { + /* VisibleForTesting */ static final int NAME_MAX_LENGTH = 255; + private static final String ERROR_MESSAGE_INVALID_NAME = + "Name should be a ASCII string with a length no greater than " + + NAME_MAX_LENGTH + + " characters."; + @Override public GaugeLong.Builder gaugeLongBuilder(String name) { Utils.checkNotNull(name, "name"); @@ -63,6 +74,32 @@ public CounterLong.Builder counterLongBuilder(String name) { Utils.checkNotNull(name, "name"); return new NoopCounterLong.NoopBuilder(); } + + @Override + public Measure.Builder measureBuilder(String name) { + Utils.checkArgument( + StringUtils.isPrintableString(name) && name.length() <= NAME_MAX_LENGTH, + ERROR_MESSAGE_INVALID_NAME); + return new NoopMeasure.NoopBuilder(); + } + + @Override + public void record(List measurements) { + Utils.checkNotNull(measurements, "measurements"); + } + + @Override + public void record(List measurements, TagMap tags) { + Utils.checkNotNull(measurements, "measurements"); + Utils.checkNotNull(tags, "tags"); + } + + @Override + public void record(List measurements, TagMap tags, SpanContext spanContext) { + Utils.checkNotNull(tags, "tags"); + Utils.checkNotNull(measurements, "measurements"); + Utils.checkNotNull(spanContext, "spanContext"); + } } /** No-op implementations of GaugeLong class. */ @@ -444,4 +481,63 @@ public CounterLong build() { } } } + + @ThreadSafe + private static final class NoopMeasure implements Measure { + private final Type type; + + private NoopMeasure(Type type) { + this.type = type; + } + + @Override + public Measurement createDoubleMeasurement(double value) { + if (type != Type.DOUBLE) { + throw new UnsupportedOperationException("This type can only create double measurement"); + } + Utils.checkArgument(value >= 0.0, "Unsupported negative values."); + return NoopMeasurement.INSTANCE; + } + + @Override + public Measurement createLongMeasurement(long value) { + if (type != Type.LONG) { + throw new UnsupportedOperationException("This type can only create long measurement"); + } + Utils.checkArgument(value >= 0, "Unsupported negative values."); + return NoopMeasurement.INSTANCE; + } + + private static final class NoopBuilder implements Measure.Builder { + private Type type = Type.DOUBLE; + + @Override + public Builder setDescription(String description) { + Utils.checkNotNull(description, "description"); + return this; + } + + @Override + public Builder setUnit(String unit) { + Utils.checkNotNull(unit, "unit"); + return this; + } + + @Override + public Builder setType(Type type) { + this.type = Utils.checkNotNull(type, "type"); + return this; + } + + @Override + public Measure build() { + return new NoopMeasure(type); + } + } + } + + @Immutable + private static final class NoopMeasurement implements Measurement { + private static final Measurement INSTANCE = new NoopMeasurement(); + } } diff --git a/api/src/main/java/io/opentelemetry/stats/NoopStats.java b/api/src/main/java/io/opentelemetry/stats/NoopStats.java deleted file mode 100644 index fcf09500ffd..00000000000 --- a/api/src/main/java/io/opentelemetry/stats/NoopStats.java +++ /dev/null @@ -1,139 +0,0 @@ -/* - * Copyright 2019, OpenTelemetry Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.opentelemetry.stats; - -import io.opentelemetry.internal.StringUtils; -import io.opentelemetry.internal.Utils; -import io.opentelemetry.tags.TagMap; -import io.opentelemetry.trace.SpanContext; -import java.util.List; -import javax.annotation.concurrent.Immutable; -import javax.annotation.concurrent.ThreadSafe; - -/** - * No-op implementations of stats classes. - * - * @since 0.1.0 - */ -public final class NoopStats { - - private NoopStats() {} - - /** - * Returns a {@code StatsRecorder} that is no-op implementation for {@link StatsRecorder}. - * - * @return a {@code StatsRecorder} that is no-op implementation for {@code StatsRecorder}. - * @since 0.1.0 - */ - public static StatsRecorder newNoopStatsRecorder() { - return new NoopStatsRecorder(); - } - - @Immutable - private static final class NoopStatsRecorder implements StatsRecorder { - /* VisibleForTesting */ static final int NAME_MAX_LENGTH = 255; - private static final String ERROR_MESSAGE_INVALID_NAME = - "Name should be a ASCII string with a length no greater than " - + NAME_MAX_LENGTH - + " characters."; - - @Override - public Measure.Builder measureBuilder(String name) { - Utils.checkArgument( - StringUtils.isPrintableString(name) && name.length() <= NAME_MAX_LENGTH, - ERROR_MESSAGE_INVALID_NAME); - return new NoopMeasure.NoopBuilder(); - } - - @Override - public void record(List measurements) { - Utils.checkNotNull(measurements, "measurements"); - } - - @Override - public void record(List measurements, TagMap tags) { - Utils.checkNotNull(measurements, "measurements"); - Utils.checkNotNull(tags, "tags"); - } - - @Override - public void record(List measurements, TagMap tags, SpanContext spanContext) { - Utils.checkNotNull(tags, "tags"); - Utils.checkNotNull(measurements, "measurements"); - Utils.checkNotNull(spanContext, "spanContext"); - } - } - - @ThreadSafe - private static final class NoopMeasure implements Measure { - private final Type type; - - private NoopMeasure(Type type) { - this.type = type; - } - - @Override - public Measurement createDoubleMeasurement(double value) { - if (type != Type.DOUBLE) { - throw new UnsupportedOperationException("This type can only create double measurement"); - } - Utils.checkArgument(value >= 0.0, "Unsupported negative values."); - return NoopMeasurement.INSTANCE; - } - - @Override - public Measurement createLongMeasurement(long value) { - if (type != Type.LONG) { - throw new UnsupportedOperationException("This type can only create long measurement"); - } - Utils.checkArgument(value >= 0, "Unsupported negative values."); - return NoopMeasurement.INSTANCE; - } - - private static final class NoopBuilder implements Measure.Builder { - private Type type = Type.DOUBLE; - - @Override - public Builder setDescription(String description) { - Utils.checkNotNull(description, "description"); - return this; - } - - @Override - public Builder setUnit(String unit) { - Utils.checkNotNull(unit, "unit"); - return this; - } - - @Override - public Builder setType(Type type) { - this.type = Utils.checkNotNull(type, "type"); - return this; - } - - @Override - public Measure build() { - return new NoopMeasure(type); - } - } - } - - @Immutable - private static final class NoopMeasurement implements Measurement { - private static final Measurement INSTANCE = new NoopMeasurement(); - } -} diff --git a/api/src/main/java/io/opentelemetry/stats/Stats.java b/api/src/main/java/io/opentelemetry/stats/Stats.java deleted file mode 100644 index 69c3a125dd0..00000000000 --- a/api/src/main/java/io/opentelemetry/stats/Stats.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright 2019, OpenTelemetry Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.opentelemetry.stats; - -/** - * Class for accessing the global {@link StatsRecorder}. - * - * @since 0.1.0 - */ -public final class Stats { - private static final StatsRecorder STATS_RECORDER = NoopStats.newNoopStatsRecorder(); - - /** - * Returns the global {@link StatsRecorder}. - * - * @return stats recorder. - * @since 0.1.0 - */ - public static StatsRecorder getStatsRecorder() { - return STATS_RECORDER; - } - - private Stats() {} -} diff --git a/api/src/main/java/io/opentelemetry/stats/StatsRecorder.java b/api/src/main/java/io/opentelemetry/stats/StatsRecorder.java deleted file mode 100644 index e46bd941ad6..00000000000 --- a/api/src/main/java/io/opentelemetry/stats/StatsRecorder.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright 2019, OpenTelemetry Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.opentelemetry.stats; - -import io.opentelemetry.tags.TagMap; -import io.opentelemetry.tags.Tagger; -import io.opentelemetry.trace.SpanContext; -import java.util.List; -import javax.annotation.concurrent.ThreadSafe; - -/** - * Provides methods to record stats against tags. - * - * @since 0.1.0 - */ -@ThreadSafe -public interface StatsRecorder { - - /** - * Returns a new builder for a {@code Measure}. - * - * @param name Name of measure, as a {@code String}. Should be a ASCII string with a length no - * greater than 255 characters. - * @return a new builder for a {@code Measure}. - * @since 0.1.0 - */ - Measure.Builder measureBuilder(String name); - - /** - * Records all given measurements, with the current {@link Tagger#getCurrentTagMap}. - * - * @param measurements the list of {@code Measurement}s to record. - * @since 0.1.0 - */ - void record(List measurements); - - /** - * Records all given measurements, with an explicit {@link TagMap}. - * - * @param measurements the list of {@code Measurement}s to record. - * @param tags the tags associated with the measurements. - * @since 0.1.0 - */ - void record(List measurements, TagMap tags); - - /** - * Records all given measurements, with an explicit {@link TagMap}. These measurements are - * associated with the given {@code SpanContext}. - * - * @param measurements the list of {@code Measurement}s to record. - * @param tags the tags associated with the measurements. - * @param spanContext the {@code SpanContext} that identifies the {@code Span} for which the - * measurements are associated with. - * @since 0.1.0 - */ - void record(List measurements, TagMap tags, SpanContext spanContext); -} diff --git a/api/src/main/java/io/opentelemetry/stats/package-info.java b/api/src/main/java/io/opentelemetry/stats/package-info.java deleted file mode 100644 index 93e84c6a624..00000000000 --- a/api/src/main/java/io/opentelemetry/stats/package-info.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright 2019, OpenTelemetry Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** API for stats recording. */ -// TODO: Add more details. -// TODO: Add code examples. -package io.opentelemetry.stats; diff --git a/api/src/test/java/io/opentelemetry/stats/MeasureTest.java b/api/src/test/java/io/opentelemetry/metrics/MeasureTest.java similarity index 80% rename from api/src/test/java/io/opentelemetry/stats/MeasureTest.java rename to api/src/test/java/io/opentelemetry/metrics/MeasureTest.java index 9d6e68f7d2d..c4ad596fa9f 100644 --- a/api/src/test/java/io/opentelemetry/stats/MeasureTest.java +++ b/api/src/test/java/io/opentelemetry/metrics/MeasureTest.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.opentelemetry.stats; +package io.opentelemetry.metrics; import java.util.Arrays; import org.junit.Rule; @@ -23,10 +23,10 @@ import org.junit.runner.RunWith; import org.junit.runners.JUnit4; -/** Tests for {@link Measure}. */ +/** Tests for {@link io.opentelemetry.metrics.Measure}. */ @RunWith(JUnit4.class) public final class MeasureTest { - private static final StatsRecorder STATS_RECORDER = NoopStats.newNoopStatsRecorder(); + private static final Meter meter = NoopMetrics.newNoopMeter(); @Rule public final ExpectedException thrown = ExpectedException.none(); @@ -36,18 +36,18 @@ public void preventTooLongMeasureName() { Arrays.fill(chars, 'a'); String longName = String.valueOf(chars); thrown.expect(IllegalArgumentException.class); - STATS_RECORDER.measureBuilder(longName).build(); + meter.measureBuilder(longName).build(); } @Test public void preventNonPrintableMeasureName() { thrown.expect(IllegalArgumentException.class); - STATS_RECORDER.measureBuilder("\2").build(); + meter.measureBuilder("\2").build(); } @Test public void preventNegativeValue() { - Measure myMeasure = STATS_RECORDER.measureBuilder("MyMeasure").build(); + Measure myMeasure = meter.measureBuilder("MyMeasure").build(); thrown.expect(IllegalArgumentException.class); myMeasure.createDoubleMeasurement(-5); } diff --git a/api/src/test/java/io/opentelemetry/stats/NoopStatsTest.java b/api/src/test/java/io/opentelemetry/metrics/NoopMeter.java similarity index 88% rename from api/src/test/java/io/opentelemetry/stats/NoopStatsTest.java rename to api/src/test/java/io/opentelemetry/metrics/NoopMeter.java index bf1985eaa0f..ea31f900cee 100644 --- a/api/src/test/java/io/opentelemetry/stats/NoopStatsTest.java +++ b/api/src/test/java/io/opentelemetry/metrics/NoopMeter.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.opentelemetry.stats; +package io.opentelemetry.metrics; import io.opentelemetry.tags.Tag; import io.opentelemetry.tags.TagKey; @@ -30,17 +30,17 @@ import org.junit.runner.RunWith; import org.junit.runners.JUnit4; -/** Unit tests for {@link NoopStats}. */ +/** Unit tests for {@link NoopMeter}. */ @RunWith(JUnit4.class) -public final class NoopStatsTest { +public final class NoopMeter { private static final Tag TAG = Tag.create( TagKey.create("key"), TagValue.create("value"), Tag.METADATA_UNLIMITED_PROPAGATION); - private static final StatsRecorder STATS_RECORDER = NoopStats.newNoopStatsRecorder(); + private static final Meter meter = NoopMetrics.newNoopMeter(); private static final Measure MEASURE = - STATS_RECORDER + meter .measureBuilder("my measure") .setDescription("description") .setType(Measure.Type.DOUBLE) @@ -69,7 +69,7 @@ public TagValue getTagValue(TagKey tagKey) { @Test public void noopStatsRecorder_Record() { List measurements = Collections.singletonList(MEASURE.createDoubleMeasurement(5)); - STATS_RECORDER.record(measurements, tagMap); + meter.record(measurements, tagMap); } // The NoopStatsRecorder should do nothing, so this test just checks that record doesn't throw an @@ -77,7 +77,7 @@ public void noopStatsRecorder_Record() { @Test public void noopStatsRecorder_RecordWithCurrentContext() { List measurements = Collections.singletonList(MEASURE.createDoubleMeasurement(6)); - STATS_RECORDER.record(measurements); + meter.record(measurements); } @Test @@ -85,6 +85,6 @@ public void noopStatsRecorder_Record_DisallowNulltagMap() { List measurements = Collections.singletonList(MEASURE.createDoubleMeasurement(6)); thrown.expect(NullPointerException.class); thrown.expectMessage("tags"); - STATS_RECORDER.record(measurements, null); + meter.record(measurements, null); } } diff --git a/api/src/test/java/io/opentelemetry/stats/StatsTest.java b/api/src/test/java/io/opentelemetry/stats/StatsTest.java deleted file mode 100644 index 9705174c585..00000000000 --- a/api/src/test/java/io/opentelemetry/stats/StatsTest.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright 2019, OpenTelemetry Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.opentelemetry.stats; - -import static com.google.common.truth.Truth.assertThat; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.JUnit4; - -/** Tests for {@link Stats}. */ -@RunWith(JUnit4.class) -public final class StatsTest { - - @Test - public void defaultValues() { - assertThat(Stats.getStatsRecorder()).isInstanceOf(NoopStats.newNoopStatsRecorder().getClass()); - } -} diff --git a/sdk/src/main/java/io/opentelemetry/sdk/stats/Aggregation.java b/sdk/src/main/java/io/opentelemetry/sdk/stats/Aggregation.java index a5d44ae5e91..e242881ab69 100644 --- a/sdk/src/main/java/io/opentelemetry/sdk/stats/Aggregation.java +++ b/sdk/src/main/java/io/opentelemetry/sdk/stats/Aggregation.java @@ -65,7 +65,7 @@ public BucketBoundaries getBucketBoundaries() { public abstract Type getType(); /** - * Calculate sum on aggregated {@code Measurement}s. + * Calculate sum on aggregated {@code io.opentelemetry.metrics.Measurement}s. * * @since 0.1.0 */ @@ -94,7 +94,7 @@ public final Type getType() { } /** - * Calculate count on aggregated {@code Measurement}s. + * Calculate count on aggregated {@code io.opentelemetry.metrics.Measurement}s. * * @since 0.1.0 */ @@ -123,8 +123,8 @@ public final Type getType() { } /** - * Calculate distribution stats on aggregated {@code Measurement}s. Distribution includes mean, - * count, histogram, min, max and sum of squared deviations. + * Calculate distribution stats on aggregated {@code io.opentelemetry.metrics.Measurement}s. + * Distribution includes mean, count, histogram, min, max and sum of squared deviations. * * @since 0.1.0 */ @@ -156,7 +156,7 @@ public final Type getType() { } /** - * Calculate the last value of aggregated {@code Measurement}s. + * Calculate the last value of aggregated {@code io.opentelemetry.metrics.Measurement}s. * * @since 0.1.0 */ diff --git a/sdk/src/main/java/io/opentelemetry/sdk/stats/View.java b/sdk/src/main/java/io/opentelemetry/sdk/stats/View.java index 7b9e73ac79d..818d0e0a819 100644 --- a/sdk/src/main/java/io/opentelemetry/sdk/stats/View.java +++ b/sdk/src/main/java/io/opentelemetry/sdk/stats/View.java @@ -19,7 +19,7 @@ import com.google.auto.value.AutoValue; import io.opentelemetry.internal.StringUtils; import io.opentelemetry.internal.Utils; -import io.opentelemetry.stats.Measure; +import io.opentelemetry.metrics.Measure; import io.opentelemetry.tags.TagKey; import java.util.Collections; import java.util.HashSet; diff --git a/sdk/src/main/java/io/opentelemetry/sdk/stats/impl/MeasurementImpl.java b/sdk/src/main/java/io/opentelemetry/sdk/stats/impl/MeasurementImpl.java index c1797edab64..01a048b7ed8 100644 --- a/sdk/src/main/java/io/opentelemetry/sdk/stats/impl/MeasurementImpl.java +++ b/sdk/src/main/java/io/opentelemetry/sdk/stats/impl/MeasurementImpl.java @@ -17,8 +17,8 @@ package io.opentelemetry.sdk.stats.impl; import com.google.auto.value.AutoValue; -import io.opentelemetry.stats.Measure; -import io.opentelemetry.stats.Measurement; +import io.opentelemetry.metrics.Measure; +import io.opentelemetry.metrics.Measurement; import javax.annotation.concurrent.Immutable; abstract class MeasurementImpl implements Measurement {