aboutsummaryrefslogtreecommitdiff
path: root/api/src/main/java/io/opencensus
diff options
context:
space:
mode:
authorKristen Kozak <sebright@google.com>2018-07-09 15:56:07 -0700
committerKristen Kozak <sebright@google.com>2018-07-09 16:17:09 -0700
commit1c46243de0bbb19ce5610daccf9bb0ad9d66c2a1 (patch)
tree8ba3b826c7fc07d34874672fb48f7e33f3702882 /api/src/main/java/io/opencensus
parentd6e5f6ac96a2c1ab6350509c6c1c305af2a36be4 (diff)
downloadopencensus-java-1c46243de0bbb19ce5610daccf9bb0ad9d66c2a1.tar.gz
Mention that SampledSpanStore.getRegisteredSpanNamesForCollection is for testing.
This commit fixes the last part of #977. getRegisteredSpanNamesForCollection was originally public and annotated with VisibleForTesting because it was meant for testing code that uses OpenCensus. However, VisibleForTesting is not ideal because it adds a dependency on Guava and it does not appear in Javadocs. This commit instead describes the purpose of the method in the Javadocs. It also removes the temporary PublicForTesting annotation.
Diffstat (limited to 'api/src/main/java/io/opencensus')
-rw-r--r--api/src/main/java/io/opencensus/internal/PublicForTesting.java38
-rw-r--r--api/src/main/java/io/opencensus/trace/export/SampledSpanStore.java9
2 files changed, 5 insertions, 42 deletions
diff --git a/api/src/main/java/io/opencensus/internal/PublicForTesting.java b/api/src/main/java/io/opencensus/internal/PublicForTesting.java
deleted file mode 100644
index cfd37ff2..00000000
--- a/api/src/main/java/io/opencensus/internal/PublicForTesting.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * 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.internal;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * Indicates that an element is public instead of package-private only for the purpose of testing.
- * This annotation is only meant to be used as documentation in the source code.
- */
-// TODO(#977): All uses of this annotation should be removed or replaced with @Internal.
-@Retention(RetentionPolicy.SOURCE)
-@Target({
- ElementType.ANNOTATION_TYPE,
- ElementType.CONSTRUCTOR,
- ElementType.FIELD,
- ElementType.METHOD,
- ElementType.PACKAGE,
- ElementType.TYPE
-})
-public @interface PublicForTesting {}
diff --git a/api/src/main/java/io/opencensus/trace/export/SampledSpanStore.java b/api/src/main/java/io/opencensus/trace/export/SampledSpanStore.java
index 99bc5288..2347061b 100644
--- a/api/src/main/java/io/opencensus/trace/export/SampledSpanStore.java
+++ b/api/src/main/java/io/opencensus/trace/export/SampledSpanStore.java
@@ -17,7 +17,6 @@
package io.opencensus.trace.export;
import com.google.auto.value.AutoValue;
-import io.opencensus.internal.PublicForTesting;
import io.opencensus.internal.Utils;
import io.opencensus.trace.Span;
import io.opencensus.trace.Status;
@@ -123,13 +122,15 @@ public abstract class SampledSpanStore {
public abstract void unregisterSpanNamesForCollection(Collection<String> spanNames);
/**
- * Returns the set of unique span names registered to the library. For this set of span names the
- * library will collect latency based sampled spans and error based sampled spans.
+ * Returns the set of unique span names registered to the library, for use in tests. For this set
+ * of span names the library will collect latency based sampled spans and error based sampled
+ * spans.
+ *
+ * <p>This method is only meant for testing code that uses OpenCensus, and it is not performant.
*
* @return the set of unique span names registered to the library.
* @since 0.7
*/
- @PublicForTesting
public abstract Set<String> getRegisteredSpanNamesForCollection();
/**