aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBogdan Drutu <bdrutu@google.com>2017-06-07 14:23:30 -0700
committerGitHub <noreply@github.com>2017-06-07 14:23:30 -0700
commit9f0e5d3cb6b80357dabc3ee9771335096cd35437 (patch)
tree2f49d2c3d6f9045555510368076a5e481106b536
parent613278c5ee65b9b2e64ccf675daca7cc50471b92 (diff)
downloadplatform_external_opencensus-java-9f0e5d3cb6b80357dabc3ee9771335096cd35437.tar.gz
platform_external_opencensus-java-9f0e5d3cb6b80357dabc3ee9771335096cd35437.tar.bz2
platform_external_opencensus-java-9f0e5d3cb6b80357dabc3ee9771335096cd35437.zip
Move TraceConfig into its own package, extract inner class TraceParams. (#340)
-rw-r--r--api/src/main/java/io/opencensus/trace/TraceComponent.java1
-rw-r--r--api/src/main/java/io/opencensus/trace/TraceConfig.java213
-rw-r--r--api/src/main/java/io/opencensus/trace/Tracing.java1
-rw-r--r--api/src/main/java/io/opencensus/trace/config/TraceConfig.java67
-rw-r--r--api/src/main/java/io/opencensus/trace/config/TraceParams.java165
-rw-r--r--api/src/test/java/io/opencensus/trace/TraceComponentTest.java1
-rw-r--r--api/src/test/java/io/opencensus/trace/TraceParamsTest.java2
-rw-r--r--api/src/test/java/io/opencensus/trace/TracingTest.java1
-rw-r--r--core_impl/src/main/java/io/opencensus/trace/SpanFactoryImpl.java3
-rw-r--r--core_impl/src/main/java/io/opencensus/trace/SpanImpl.java2
-rw-r--r--core_impl/src/main/java/io/opencensus/trace/TraceComponentImplBase.java1
-rw-r--r--core_impl/src/main/java/io/opencensus/trace/TraceConfigImpl.java3
-rw-r--r--core_impl/src/main/java/io/opencensus/trace/TracerImpl.java1
-rw-r--r--core_impl/src/test/java/io/opencensus/trace/SpanFactoryImplTest.java3
-rw-r--r--core_impl/src/test/java/io/opencensus/trace/SpanImplTest.java2
-rw-r--r--core_impl/src/test/java/io/opencensus/trace/TraceConfigImplTest.java2
-rw-r--r--core_impl/src/test/java/io/opencensus/trace/TraceExporterImplTest.java2
17 files changed, 250 insertions, 220 deletions
diff --git a/api/src/main/java/io/opencensus/trace/TraceComponent.java b/api/src/main/java/io/opencensus/trace/TraceComponent.java
index 1829417f..bee02dae 100644
--- a/api/src/main/java/io/opencensus/trace/TraceComponent.java
+++ b/api/src/main/java/io/opencensus/trace/TraceComponent.java
@@ -15,6 +15,7 @@ package io.opencensus.trace;
import io.opencensus.common.Clock;
import io.opencensus.internal.ZeroTimeClock;
+import io.opencensus.trace.config.TraceConfig;
/**
* Class that holds the implementation instances for {@link Tracer}, {@link
diff --git a/api/src/main/java/io/opencensus/trace/TraceConfig.java b/api/src/main/java/io/opencensus/trace/TraceConfig.java
deleted file mode 100644
index 41fa75b8..00000000
--- a/api/src/main/java/io/opencensus/trace/TraceConfig.java
+++ /dev/null
@@ -1,213 +0,0 @@
-/*
- * Copyright 2017, Google Inc.
- * 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.trace;
-
-import static com.google.common.base.Preconditions.checkArgument;
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import com.google.auto.value.AutoValue;
-import javax.annotation.concurrent.Immutable;
-
-/**
- * Global configuration of the trace service. This allows users to change configs for the default
- * sampler, maximum events to be kept, etc. (see {@link TraceParams} for details).
- */
-public abstract class TraceConfig {
- private static final NoopTraceConfig noopTraceConfig = new NoopTraceConfig();
-
- /**
- * Returns the active {@code TraceParams}.
- *
- * @return the active {@code TraceParams}.
- */
- public abstract TraceParams getActiveTraceParams();
-
- /**
- * Updates the active {@link TraceParams}.
- *
- * @param traceParams the new active {@code TraceParams}.
- */
- public abstract void updateActiveTraceParams(TraceParams traceParams);
-
- /**
- * Temporary updates the active {@link TraceParams} for {@code durationNs} nanoseconds.
- *
- * @param traceParams the new active {@code TraceParams}.
- * @param durationNs the duration for how long the new params will be active.
- */
- public abstract void temporaryUpdateActiveTraceParams(TraceParams traceParams, long durationNs);
-
- /**
- * Returns the no-op implementation of the {@code TraceConfig}.
- *
- * @return the no-op implementation of the {@code TraceConfig}.
- */
- static TraceConfig getNoopTraceConfig() {
- return noopTraceConfig;
- }
-
- /** Class that holds global trace parameters. */
- @AutoValue
- @Immutable
- public abstract static class TraceParams {
- // These values are the default values for all the global parameters.
- private static final double DEFAULT_PROBABILITY = 1e-4;
- private static final Sampler DEFAULT_SAMPLER = Samplers.probabilitySampler(DEFAULT_PROBABILITY);
- private static final int DEFAULT_SPAN_MAX_NUM_ATTRIBUTES = 32;
- private static final int DEFAULT_SPAN_MAX_NUM_ANNOTATIONS = 32;
- private static final int DEFAULT_SPAN_MAX_NUM_NETWORK_EVENTS = 128;
- private static final int DEFAULT_SPAN_MAX_NUM_LINKS = 128;
-
- public static final TraceParams DEFAULT =
- TraceParams.builder()
- .setSampler(DEFAULT_SAMPLER)
- .setMaxNumberOfAttributes(DEFAULT_SPAN_MAX_NUM_ATTRIBUTES)
- .setMaxNumberOfAnnotations(DEFAULT_SPAN_MAX_NUM_ANNOTATIONS)
- .setMaxNumberOfNetworkEvents(DEFAULT_SPAN_MAX_NUM_NETWORK_EVENTS)
- .setMaxNumberOfLinks(DEFAULT_SPAN_MAX_NUM_LINKS)
- .build();
-
- /**
- * Returns the global default {@code Sampler}. Used if no {@code Sampler} is provided in {@link
- * StartSpanOptions}.
- *
- * @return the global default {@code Sampler}.
- */
- public abstract Sampler getSampler();
-
- /**
- * Returns the global default max number of attributes per {@link Span}.
- *
- * @return the global default max number of attributes per {@link Span}.
- */
- public abstract int getMaxNumberOfAttributes();
-
- /**
- * Returns the global default max number of {@link Annotation} events per {@link Span}.
- *
- * @return the global default max number of {@code Annotation} events per {@code Span}.
- */
- public abstract int getMaxNumberOfAnnotations();
-
- /**
- * Returns the global default max number of {@link NetworkEvent} events per {@link Span}.
- *
- * @return the global default max number of {@code NetworkEvent} events per {@code Span}.
- */
- public abstract int getMaxNumberOfNetworkEvents();
-
- /**
- * Returns the global default max number of {@link Link} entries per {@link Span}.
- *
- * @return the global default max number of {@code Link} entries per {@code Span}.
- */
- public abstract int getMaxNumberOfLinks();
-
- private static Builder builder() {
- return new AutoValue_TraceConfig_TraceParams.Builder();
- }
-
- /**
- * Returns a {@link Builder} initialized to the same property values as the current instance.
- *
- * @return a {@link Builder} initialized to the same property values as the current instance.
- */
- public abstract Builder toBuilder();
-
- /** A {@code Builder} class for {@link TraceParams}. */
- @AutoValue.Builder
- public abstract static class Builder {
-
- /**
- * Sets the global default {@code Sampler}. It must be not {@code null} otherwise {@link
- * #build()} will throw an exception.
- *
- * @param sampler the global default {@code Sampler}.
- * @return this.
- */
- public abstract Builder setSampler(Sampler sampler);
-
- /**
- * Sets the global default max number of attributes per {@link Span}.
- *
- * @param maxNumberOfAttributes the global default max number of attributes per {@link Span}.
- * It must be positive otherwise {@link #build()} will throw an exception.
- * @return this.
- */
- public abstract Builder setMaxNumberOfAttributes(int maxNumberOfAttributes);
-
- /**
- * Sets the global default max number of {@link Annotation} events per {@link Span}.
- *
- * @param maxNumberOfAnnotations the global default max number of {@link Annotation} events
- * per {@link Span}. It must be positive otherwise {@link #build()} will throw an
- * exception.
- * @return this.
- */
- public abstract Builder setMaxNumberOfAnnotations(int maxNumberOfAnnotations);
-
- /**
- * Sets the global default max number of {@link NetworkEvent} events per {@link Span}.
- *
- * @param maxNumberOfNetworkEvents the global default max number of {@link NetworkEvent}
- * events per {@link Span}. It must be positive otherwise {@link #build()} will throw an
- * exception.
- * @return this.
- */
- public abstract Builder setMaxNumberOfNetworkEvents(int maxNumberOfNetworkEvents);
-
- /**
- * Sets the global default max number of {@link Link} entries per {@link Span}.
- *
- * @param maxNumberOfLinks the global default max number of {@link Link} entries per {@link
- * Span}. It must be positive otherwise {@link #build()} will throw an exception.
- * @return this.
- */
- public abstract Builder setMaxNumberOfLinks(int maxNumberOfLinks);
-
- abstract TraceParams autoBuild();
-
- /**
- * Builds and returns a {@code TraceParams} with the desired values.
- *
- * @return a {@code TraceParams} with the desired values.
- * @throws NullPointerException if the sampler is {@code null}.
- * @throws IllegalArgumentException if any of the max numbers are not positive.
- */
- public TraceParams build() {
- TraceParams traceParams = autoBuild();
- checkNotNull(traceParams.getSampler(), "sampler");
- checkArgument(traceParams.getMaxNumberOfAttributes() > 0, "maxNumberOfAttributes");
- checkArgument(traceParams.getMaxNumberOfAnnotations() > 0, "maxNumberOfAnnotations");
- checkArgument(traceParams.getMaxNumberOfNetworkEvents() > 0, "maxNumberOfNetworkEvents");
- checkArgument(traceParams.getMaxNumberOfLinks() > 0, "maxNumberOfLinks");
- return traceParams;
- }
- }
- }
-
- private static final class NoopTraceConfig extends TraceConfig {
-
- @Override
- public TraceParams getActiveTraceParams() {
- return TraceParams.DEFAULT;
- }
-
- @Override
- public void updateActiveTraceParams(TraceParams traceParams) {}
-
- @Override
- public void temporaryUpdateActiveTraceParams(TraceParams traceParams, long durationNs) {}
- }
-}
diff --git a/api/src/main/java/io/opencensus/trace/Tracing.java b/api/src/main/java/io/opencensus/trace/Tracing.java
index e6d34a45..771b8553 100644
--- a/api/src/main/java/io/opencensus/trace/Tracing.java
+++ b/api/src/main/java/io/opencensus/trace/Tracing.java
@@ -16,6 +16,7 @@ package io.opencensus.trace;
import com.google.common.annotations.VisibleForTesting;
import io.opencensus.common.Clock;
import io.opencensus.internal.Provider;
+import io.opencensus.trace.config.TraceConfig;
import java.util.logging.Level;
import java.util.logging.Logger;
diff --git a/api/src/main/java/io/opencensus/trace/config/TraceConfig.java b/api/src/main/java/io/opencensus/trace/config/TraceConfig.java
new file mode 100644
index 00000000..80f206c9
--- /dev/null
+++ b/api/src/main/java/io/opencensus/trace/config/TraceConfig.java
@@ -0,0 +1,67 @@
+/*
+ * Copyright 2017, Google Inc.
+ * 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.trace.config;
+
+/**
+ * Global configuration of the trace service. This allows users to change configs for the default
+ * sampler, maximum events to be kept, etc. (see {@link TraceParams} for details).
+ */
+public abstract class TraceConfig {
+ private static final NoopTraceConfig NOOP_TRACE_CONFIG = new NoopTraceConfig();
+
+ /**
+ * Returns the active {@code TraceParams}.
+ *
+ * @return the active {@code TraceParams}.
+ */
+ public abstract TraceParams getActiveTraceParams();
+
+ /**
+ * Updates the active {@link TraceParams}.
+ *
+ * @param traceParams the new active {@code TraceParams}.
+ */
+ public abstract void updateActiveTraceParams(TraceParams traceParams);
+
+ /**
+ * Temporary updates the active {@link TraceParams} for {@code durationNs} nanoseconds.
+ *
+ * @param traceParams the new active {@code TraceParams}.
+ * @param durationNs the duration for how long the new params will be active.
+ */
+ public abstract void temporaryUpdateActiveTraceParams(TraceParams traceParams, long durationNs);
+
+ /**
+ * Returns the no-op implementation of the {@code TraceConfig}.
+ *
+ * @return the no-op implementation of the {@code TraceConfig}.
+ */
+ public static TraceConfig getNoopTraceConfig() {
+ return NOOP_TRACE_CONFIG;
+ }
+
+ private static final class NoopTraceConfig extends TraceConfig {
+
+ @Override
+ public TraceParams getActiveTraceParams() {
+ return TraceParams.DEFAULT;
+ }
+
+ @Override
+ public void updateActiveTraceParams(TraceParams traceParams) {}
+
+ @Override
+ public void temporaryUpdateActiveTraceParams(TraceParams traceParams, long durationNs) {}
+ }
+}
diff --git a/api/src/main/java/io/opencensus/trace/config/TraceParams.java b/api/src/main/java/io/opencensus/trace/config/TraceParams.java
new file mode 100644
index 00000000..c4463342
--- /dev/null
+++ b/api/src/main/java/io/opencensus/trace/config/TraceParams.java
@@ -0,0 +1,165 @@
+/*
+ * Copyright 2017, Google Inc.
+ * 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.trace.config;
+
+import static com.google.common.base.Preconditions.checkArgument;
+
+import com.google.auto.value.AutoValue;
+import io.opencensus.trace.Annotation;
+import io.opencensus.trace.Link;
+import io.opencensus.trace.NetworkEvent;
+import io.opencensus.trace.Sampler;
+import io.opencensus.trace.Samplers;
+import io.opencensus.trace.Span;
+import io.opencensus.trace.StartSpanOptions;
+import javax.annotation.concurrent.Immutable;
+
+/** Class that holds global trace parameters. */
+@AutoValue
+@Immutable
+public abstract class TraceParams {
+ // These values are the default values for all the global parameters.
+ private static final double DEFAULT_PROBABILITY = 1e-4;
+ private static final Sampler DEFAULT_SAMPLER = Samplers.probabilitySampler(DEFAULT_PROBABILITY);
+ private static final int DEFAULT_SPAN_MAX_NUM_ATTRIBUTES = 32;
+ private static final int DEFAULT_SPAN_MAX_NUM_ANNOTATIONS = 32;
+ private static final int DEFAULT_SPAN_MAX_NUM_NETWORK_EVENTS = 128;
+ private static final int DEFAULT_SPAN_MAX_NUM_LINKS = 128;
+
+ public static final TraceParams DEFAULT =
+ TraceParams.builder()
+ .setSampler(DEFAULT_SAMPLER)
+ .setMaxNumberOfAttributes(DEFAULT_SPAN_MAX_NUM_ATTRIBUTES)
+ .setMaxNumberOfAnnotations(DEFAULT_SPAN_MAX_NUM_ANNOTATIONS)
+ .setMaxNumberOfNetworkEvents(DEFAULT_SPAN_MAX_NUM_NETWORK_EVENTS)
+ .setMaxNumberOfLinks(DEFAULT_SPAN_MAX_NUM_LINKS)
+ .build();
+
+ /**
+ * Returns the global default {@code Sampler}. Used if no {@code Sampler} is provided in {@link
+ * StartSpanOptions}.
+ *
+ * @return the global default {@code Sampler}.
+ */
+ public abstract Sampler getSampler();
+
+ /**
+ * Returns the global default max number of attributes per {@link Span}.
+ *
+ * @return the global default max number of attributes per {@link Span}.
+ */
+ public abstract int getMaxNumberOfAttributes();
+
+ /**
+ * Returns the global default max number of {@link Annotation} events per {@link Span}.
+ *
+ * @return the global default max number of {@code Annotation} events per {@code Span}.
+ */
+ public abstract int getMaxNumberOfAnnotations();
+
+ /**
+ * Returns the global default max number of {@link NetworkEvent} events per {@link Span}.
+ *
+ * @return the global default max number of {@code NetworkEvent} events per {@code Span}.
+ */
+ public abstract int getMaxNumberOfNetworkEvents();
+
+ /**
+ * Returns the global default max number of {@link Link} entries per {@link Span}.
+ *
+ * @return the global default max number of {@code Link} entries per {@code Span}.
+ */
+ public abstract int getMaxNumberOfLinks();
+
+ private static Builder builder() {
+ return new AutoValue_TraceParams.Builder();
+ }
+
+ /**
+ * Returns a {@link Builder} initialized to the same property values as the current instance.
+ *
+ * @return a {@link Builder} initialized to the same property values as the current instance.
+ */
+ public abstract Builder toBuilder();
+
+ /** A {@code Builder} class for {@link TraceParams}. */
+ @AutoValue.Builder
+ public abstract static class Builder {
+
+ /**
+ * Sets the global default {@code Sampler}. It must be not {@code null} otherwise {@link
+ * #build()} will throw an exception.
+ *
+ * @param sampler the global default {@code Sampler}.
+ * @return this.
+ */
+ public abstract Builder setSampler(Sampler sampler);
+
+ /**
+ * Sets the global default max number of attributes per {@link Span}.
+ *
+ * @param maxNumberOfAttributes the global default max number of attributes per {@link Span}.
+ * It must be positive otherwise {@link #build()} will throw an exception.
+ * @return this.
+ */
+ public abstract Builder setMaxNumberOfAttributes(int maxNumberOfAttributes);
+
+ /**
+ * Sets the global default max number of {@link Annotation} events per {@link Span}.
+ *
+ * @param maxNumberOfAnnotations the global default max number of {@link Annotation} events
+ * per {@link Span}. It must be positive otherwise {@link #build()} will throw an
+ * exception.
+ * @return this.
+ */
+ public abstract Builder setMaxNumberOfAnnotations(int maxNumberOfAnnotations);
+
+ /**
+ * Sets the global default max number of {@link NetworkEvent} events per {@link Span}.
+ *
+ * @param maxNumberOfNetworkEvents the global default max number of {@link NetworkEvent}
+ * events per {@link Span}. It must be positive otherwise {@link #build()} will throw an
+ * exception.
+ * @return this.
+ */
+ public abstract Builder setMaxNumberOfNetworkEvents(int maxNumberOfNetworkEvents);
+
+ /**
+ * Sets the global default max number of {@link Link} entries per {@link Span}.
+ *
+ * @param maxNumberOfLinks the global default max number of {@link Link} entries per {@link
+ * Span}. It must be positive otherwise {@link #build()} will throw an exception.
+ * @return this.
+ */
+ public abstract Builder setMaxNumberOfLinks(int maxNumberOfLinks);
+
+ abstract TraceParams autoBuild();
+
+ /**
+ * Builds and returns a {@code TraceParams} with the desired values.
+ *
+ * @return a {@code TraceParams} with the desired values.
+ * @throws NullPointerException if the sampler is {@code null}.
+ * @throws IllegalArgumentException if any of the max numbers are not positive.
+ */
+ public TraceParams build() {
+ TraceParams traceParams = autoBuild();
+ checkArgument(traceParams.getMaxNumberOfAttributes() > 0, "maxNumberOfAttributes");
+ checkArgument(traceParams.getMaxNumberOfAnnotations() > 0, "maxNumberOfAnnotations");
+ checkArgument(traceParams.getMaxNumberOfNetworkEvents() > 0, "maxNumberOfNetworkEvents");
+ checkArgument(traceParams.getMaxNumberOfLinks() > 0, "maxNumberOfLinks");
+ return traceParams;
+ }
+ }
+}
diff --git a/api/src/test/java/io/opencensus/trace/TraceComponentTest.java b/api/src/test/java/io/opencensus/trace/TraceComponentTest.java
index 106cb965..cd42a98a 100644
--- a/api/src/test/java/io/opencensus/trace/TraceComponentTest.java
+++ b/api/src/test/java/io/opencensus/trace/TraceComponentTest.java
@@ -16,6 +16,7 @@ package io.opencensus.trace;
import static com.google.common.truth.Truth.assertThat;
import io.opencensus.internal.ZeroTimeClock;
+import io.opencensus.trace.config.TraceConfig;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
diff --git a/api/src/test/java/io/opencensus/trace/TraceParamsTest.java b/api/src/test/java/io/opencensus/trace/TraceParamsTest.java
index 60f40deb..e21485e1 100644
--- a/api/src/test/java/io/opencensus/trace/TraceParamsTest.java
+++ b/api/src/test/java/io/opencensus/trace/TraceParamsTest.java
@@ -15,7 +15,7 @@ package io.opencensus.trace;
import static com.google.common.truth.Truth.assertThat;
-import io.opencensus.trace.TraceConfig.TraceParams;
+import io.opencensus.trace.config.TraceParams;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
diff --git a/api/src/test/java/io/opencensus/trace/TracingTest.java b/api/src/test/java/io/opencensus/trace/TracingTest.java
index b7c9be25..c23e7c6f 100644
--- a/api/src/test/java/io/opencensus/trace/TracingTest.java
+++ b/api/src/test/java/io/opencensus/trace/TracingTest.java
@@ -15,6 +15,7 @@ package io.opencensus.trace;
import static com.google.common.truth.Truth.assertThat;
+import io.opencensus.trace.config.TraceConfig;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
diff --git a/core_impl/src/main/java/io/opencensus/trace/SpanFactoryImpl.java b/core_impl/src/main/java/io/opencensus/trace/SpanFactoryImpl.java
index 695a2215..703b5b3b 100644
--- a/core_impl/src/main/java/io/opencensus/trace/SpanFactoryImpl.java
+++ b/core_impl/src/main/java/io/opencensus/trace/SpanFactoryImpl.java
@@ -18,7 +18,8 @@ import static com.google.common.base.Preconditions.checkNotNull;
import io.opencensus.common.Clock;
import io.opencensus.trace.Link.Type;
import io.opencensus.trace.Span.Options;
-import io.opencensus.trace.TraceConfig.TraceParams;
+import io.opencensus.trace.config.TraceConfig;
+import io.opencensus.trace.config.TraceParams;
import java.util.EnumSet;
import java.util.List;
import java.util.Random;
diff --git a/core_impl/src/main/java/io/opencensus/trace/SpanImpl.java b/core_impl/src/main/java/io/opencensus/trace/SpanImpl.java
index 2fcb7cb7..6eab0ccc 100644
--- a/core_impl/src/main/java/io/opencensus/trace/SpanImpl.java
+++ b/core_impl/src/main/java/io/opencensus/trace/SpanImpl.java
@@ -19,7 +19,7 @@ import static com.google.common.base.Preconditions.checkState;
import com.google.common.collect.EvictingQueue;
import io.opencensus.common.Clock;
import io.opencensus.trace.SpanData.TimedEvent;
-import io.opencensus.trace.TraceConfig.TraceParams;
+import io.opencensus.trace.config.TraceParams;
import java.util.ArrayList;
import java.util.Collections;
import java.util.EnumSet;
diff --git a/core_impl/src/main/java/io/opencensus/trace/TraceComponentImplBase.java b/core_impl/src/main/java/io/opencensus/trace/TraceComponentImplBase.java
index 7e25dada..c313d1e1 100644
--- a/core_impl/src/main/java/io/opencensus/trace/TraceComponentImplBase.java
+++ b/core_impl/src/main/java/io/opencensus/trace/TraceComponentImplBase.java
@@ -15,6 +15,7 @@ package io.opencensus.trace;
import io.opencensus.common.Clock;
import io.opencensus.common.EventQueue;
+import io.opencensus.trace.config.TraceConfig;
/** Base implementation of the {@link TraceComponent}. */
class TraceComponentImplBase extends TraceComponent {
diff --git a/core_impl/src/main/java/io/opencensus/trace/TraceConfigImpl.java b/core_impl/src/main/java/io/opencensus/trace/TraceConfigImpl.java
index eef2be79..673c4c8a 100644
--- a/core_impl/src/main/java/io/opencensus/trace/TraceConfigImpl.java
+++ b/core_impl/src/main/java/io/opencensus/trace/TraceConfigImpl.java
@@ -13,6 +13,9 @@
package io.opencensus.trace;
+import io.opencensus.trace.config.TraceConfig;
+import io.opencensus.trace.config.TraceParams;
+
/**
* Global configuration of the trace service. This allows users to change configs for the default
* sampler, maximum events to be kept, etc.
diff --git a/core_impl/src/main/java/io/opencensus/trace/TracerImpl.java b/core_impl/src/main/java/io/opencensus/trace/TracerImpl.java
index 996607ce..7b550cc1 100644
--- a/core_impl/src/main/java/io/opencensus/trace/TracerImpl.java
+++ b/core_impl/src/main/java/io/opencensus/trace/TracerImpl.java
@@ -14,6 +14,7 @@
package io.opencensus.trace;
import io.opencensus.common.Clock;
+import io.opencensus.trace.config.TraceConfig;
/** Implementation of the {@link Tracer}. */
final class TracerImpl extends Tracer {
diff --git a/core_impl/src/test/java/io/opencensus/trace/SpanFactoryImplTest.java b/core_impl/src/test/java/io/opencensus/trace/SpanFactoryImplTest.java
index bc2bbfb2..e93d30c2 100644
--- a/core_impl/src/test/java/io/opencensus/trace/SpanFactoryImplTest.java
+++ b/core_impl/src/test/java/io/opencensus/trace/SpanFactoryImplTest.java
@@ -19,7 +19,8 @@ import static org.mockito.Mockito.when;
import io.opencensus.internal.TestClock;
import io.opencensus.trace.Span.Options;
import io.opencensus.trace.SpanImpl.StartEndHandler;
-import io.opencensus.trace.TraceConfig.TraceParams;
+import io.opencensus.trace.config.TraceConfig;
+import io.opencensus.trace.config.TraceParams;
import java.util.Random;
import org.junit.Before;
import org.junit.Test;
diff --git a/core_impl/src/test/java/io/opencensus/trace/SpanImplTest.java b/core_impl/src/test/java/io/opencensus/trace/SpanImplTest.java
index 6c9d57fc..81fd8316 100644
--- a/core_impl/src/test/java/io/opencensus/trace/SpanImplTest.java
+++ b/core_impl/src/test/java/io/opencensus/trace/SpanImplTest.java
@@ -20,7 +20,7 @@ import io.opencensus.common.Timestamp;
import io.opencensus.internal.TestClock;
import io.opencensus.trace.Span.Options;
import io.opencensus.trace.SpanImpl.StartEndHandler;
-import io.opencensus.trace.TraceConfig.TraceParams;
+import io.opencensus.trace.config.TraceParams;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.Map;
diff --git a/core_impl/src/test/java/io/opencensus/trace/TraceConfigImplTest.java b/core_impl/src/test/java/io/opencensus/trace/TraceConfigImplTest.java
index 6e43cbb4..9872dd61 100644
--- a/core_impl/src/test/java/io/opencensus/trace/TraceConfigImplTest.java
+++ b/core_impl/src/test/java/io/opencensus/trace/TraceConfigImplTest.java
@@ -15,7 +15,7 @@ package io.opencensus.trace;
import static com.google.common.truth.Truth.assertThat;
-import io.opencensus.trace.TraceConfig.TraceParams;
+import io.opencensus.trace.config.TraceParams;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
diff --git a/core_impl/src/test/java/io/opencensus/trace/TraceExporterImplTest.java b/core_impl/src/test/java/io/opencensus/trace/TraceExporterImplTest.java
index 4684bef8..4c181e5f 100644
--- a/core_impl/src/test/java/io/opencensus/trace/TraceExporterImplTest.java
+++ b/core_impl/src/test/java/io/opencensus/trace/TraceExporterImplTest.java
@@ -20,7 +20,7 @@ import static org.mockito.Mockito.doThrow;
import io.opencensus.common.MillisClock;
import io.opencensus.common.SimpleEventQueue;
import io.opencensus.trace.Span.Options;
-import io.opencensus.trace.TraceConfig.TraceParams;
+import io.opencensus.trace.config.TraceParams;
import io.opencensus.trace.TraceExporter.ServiceHandler;
import java.util.ArrayList;
import java.util.Collection;