diff options
author | Yang Song <songy23@users.noreply.github.com> | 2018-08-13 11:36:27 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-13 11:36:27 -0700 |
commit | 775816d699bd4f02788db5609a87386940e34aff (patch) | |
tree | 021d47fb4c67d0441a5861a9e4a69b8d168e572d /impl_lite/src | |
parent | 66ae2eed952579e6982b05c0bcebe0670afb0afe (diff) | |
download | opencensus-java-775816d699bd4f02788db5609a87386940e34aff.tar.gz |
Metrics: Implement ExportComponent, make ProducerManager abstract. (#1347)
* Metrics: Implement ExportComponent, make ProducerManager abstract.
* Metrics: Add impl and impllite.
* Resolve two TODOs.
* Fix import path, leave a TODO for getMetricRegistry.
* Make NoopMetricProducerManager private. Add missing since tag.
Diffstat (limited to 'impl_lite/src')
-rw-r--r-- | impl_lite/src/main/java/io/opencensus/impllite/metrics/MetricsComponentImplLite.java | 23 | ||||
-rw-r--r-- | impl_lite/src/test/java/io/opencensus/impllite/metrics/MetricsTest.java | 36 |
2 files changed, 59 insertions, 0 deletions
diff --git a/impl_lite/src/main/java/io/opencensus/impllite/metrics/MetricsComponentImplLite.java b/impl_lite/src/main/java/io/opencensus/impllite/metrics/MetricsComponentImplLite.java new file mode 100644 index 00000000..e755088d --- /dev/null +++ b/impl_lite/src/main/java/io/opencensus/impllite/metrics/MetricsComponentImplLite.java @@ -0,0 +1,23 @@ +/* + * Copyright 2018, OpenCensus 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.opencensus.impllite.metrics; + +import io.opencensus.implcore.metrics.MetricsComponentImplBase; +import io.opencensus.metrics.MetricsComponent; + +/** Android-compatible implementation of {@link MetricsComponent}. */ +public final class MetricsComponentImplLite extends MetricsComponentImplBase {} diff --git a/impl_lite/src/test/java/io/opencensus/impllite/metrics/MetricsTest.java b/impl_lite/src/test/java/io/opencensus/impllite/metrics/MetricsTest.java new file mode 100644 index 00000000..ab8889a9 --- /dev/null +++ b/impl_lite/src/test/java/io/opencensus/impllite/metrics/MetricsTest.java @@ -0,0 +1,36 @@ +/* + * Copyright 2018, OpenCensus 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.opencensus.impllite.metrics; + +import static com.google.common.truth.Truth.assertThat; + +import io.opencensus.implcore.metrics.export.ExportComponentImpl; +import io.opencensus.metrics.Metrics; +import io.opencensus.metrics.MetricsComponent; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.JUnit4; + +/** Test for accessing the {@link MetricsComponent} through the {@link Metrics} class. */ +@RunWith(JUnit4.class) +public class MetricsTest { + + @Test + public void getExportComponent() { + assertThat(Metrics.getExportComponent()).isInstanceOf(ExportComponentImpl.class); + } +} |