Repository: open-telemetry/opentelemetry-go
Pull request #1325 (2020-11-12 16:24:32)

Move baggage and propagation to separate packages
One more step toward resolving #1303.

codecov[bot]: # [Codecov](https://codecov.io/gh/open-telemetry/opentelemetry-go/pull/1325?src=pr&el=h1) Report
> Merging [#1325](https://codecov.io/gh/open-telemetry/opentelemetry-go/pull/1325?src=pr&el=desc) (34bdc01) into [master](https://codecov.io/gh/open-telemetry/opentelemetry-go/commit/27aa1f601124468cde6c796935460435b6723700?el=desc) (27aa1f6) will **increase** coverage by `0.3%`.
> The diff coverage is `100.0%`.

[![Impacted file tree graph](https://codecov.io/gh/open-telemetry/opentelemetry-go/pull/1325/graphs/tree.svg?width=650&height=150&src=pr&token=8efTmh4kvf)](https://codecov.io/gh/open-telemetry/opentelemetry-go/pull/1325?src=pr&el=tree)

```diff
@@           Coverage Diff            @@
##           master   #1325     +/-   ##
========================================
+ Coverage    77.3%   77.6%   +0.3%     
========================================
  Files         122     122             
  Lines        5978    5954     -24     
========================================
  Hits         4622    4622             
+ Misses       1107    1083     -24     
  Partials      249     249             
```


| [Impacted Files](https://codecov.io/gh/open-telemetry/opentelemetry-go/pull/1325?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [baggage/baggage.go](https://codecov.io/gh/open-telemetry/opentelemetry-go/pull/1325/diff?src=pr&el=tree#diff-YmFnZ2FnZS9iYWdnYWdlLmdv) | `100.0% <ø> (ø)` | |
| [bridge/opentracing/bridge.go](https://codecov.io/gh/open-telemetry/opentelemetry-go/pull/1325/diff?src=pr&el=tree#diff-YnJpZGdlL29wZW50cmFjaW5nL2JyaWRnZS5nbw==) | `39.0% <ø> (ø)` | |
| [global/internal/state.go](https://codecov.io/gh/open-telemetry/opentelemetry-go/pull/1325/diff?src=pr&el=tree#diff-Z2xvYmFsL2ludGVybmFsL3N0YXRlLmdv) | `100.0% <ø> (ø)` | |
| [global/propagation.go](https://codecov.io/gh/open-telemetry/opentelemetry-go/pull/1325/diff?src=pr&el=tree#diff-Z2xvYmFsL3Byb3BhZ2F0aW9uLmdv) | `0.0% <ø> (ø)` | |
| [oteltest/text\_map\_propagator.go](https://codecov.io/gh/open-telemetry/opentelemetry-go/pull/1325/diff?src=pr&el=tree#diff-b3RlbHRlc3QvdGV4dF9tYXBfcHJvcGFnYXRvci5nbw==) | `74.6% <ø> (ø)` | |
| [propagation/baggage.go](https://codecov.io/gh/open-telemetry/opentelemetry-go/pull/1325/diff?src=pr&el=tree#diff-cHJvcGFnYXRpb24vYmFnZ2FnZS5nbw==) | `86.3% <ø> (ø)` | |
| [propagation/propagation.go](https://codecov.io/gh/open-telemetry/opentelemetry-go/pull/1325/diff?src=pr&el=tree#diff-cHJvcGFnYXRpb24vcHJvcGFnYXRpb24uZ28=) | `100.0% <ø> (ø)` | |
| [propagation/trace\_context.go](https://codecov.io/gh/open-telemetry/opentelemetry-go/pull/1325/diff?src=pr&el=tree#diff-cHJvcGFnYXRpb24vdHJhY2VfY29udGV4dC5nbw==) | `65.5% <ø> (ø)` | |
| [global/internal/propagator.go](https://codecov.io/gh/open-telemetry/opentelemetry-go/pull/1325/diff?src=pr&el=tree#diff-Z2xvYmFsL2ludGVybmFsL3Byb3BhZ2F0b3IuZ28=) | `100.0% <100.0%> (ø)` | |
| [metric/number/kind\_string.go](https://codecov.io/gh/open-telemetry/opentelemetry-go/pull/1325/diff?src=pr&el=tree#diff-bWV0cmljL251bWJlci9raW5kX3N0cmluZy5nbw==) | `33.3% <0.0%> (+16.6%)` | :arrow_up: |
| ... and [3 more](https://codecov.io/gh/open-telemetry/opentelemetry-go/pull/1325/diff?src=pr&el=tree-more) | |


Patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 4289ab3d..5bfd3779 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -71,13 +71,13 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
 ### Changed
 
 - Set default propagator to no-op propagator. (#1184)
-- The `HTTPSupplier`, `HTTPExtractor`, `HTTPInjector`, and `HTTPPropagator` from the `go.opentelemetry.io/otel/api/propagation` package were replaced with unified `TextMapCarrier` and `TextMapPropagator` in the `go.opentelemetry.io/otel` package. (#1212)
+- The `HTTPSupplier`, `HTTPExtractor`, `HTTPInjector`, and `HTTPPropagator` from the `go.opentelemetry.io/otel/api/propagation` package were replaced with unified `TextMapCarrier` and `TextMapPropagator` in the `go.opentelemetry.io/otel/propagation` package. (#1212) (#1325)
 - The `New` function from the `go.opentelemetry.io/otel/api/propagation` package was replaced with `NewCompositeTextMapPropagator` in the `go.opentelemetry.io/otel` package. (#1212)
 - The status codes of the `go.opentelemetry.io/otel/codes` package have been updated to match the latest OpenTelemetry specification.
    They now are `Unset`, `Error`, and `Ok`.
    They no longer track the gRPC codes. (#1214)
 - The `StatusCode` field of the `SpanData` struct in the `go.opentelemetry.io/otel/sdk/export/trace` package now uses the codes package from this package instead of the gRPC project. (#1214)
-- Move the `go.opentelemetry.io/otel/api/baggage` package into `go.opentelemetry.io/otel/propagators`. (#1217)
+- Move the `go.opentelemetry.io/otel/api/baggage` package into `go.opentelemetry.io/otel/baggage`. (#1217) (#1325)
 - A `Shutdown` method of `SpanProcessor` and all its implementations receives a context and returns an error. (#1264)
 
 ### Fixed
diff --git a/baggage.go b/baggage/baggage.go
similarity index 67%
rename from baggage.go
rename to baggage/baggage.go
index f9c4dc5c..66b8416f 100644
--- a/baggage.go
+++ b/baggage/baggage.go
@@ -12,7 +12,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-package otel // import "go.opentelemetry.io/otel"
+package baggage // import "go.opentelemetry.io/otel/baggage"
 
 import (
 	"context"
@@ -21,8 +21,8 @@ import (
 	"go.opentelemetry.io/otel/label"
 )
 
-// Baggage returns a copy of the baggage in ctx.
-func Baggage(ctx context.Context) label.Set {
+// Set returns a copy of the set of baggage key-values in ctx.
+func Set(ctx context.Context) label.Set {
 	// TODO (MrAlias, #1222): The underlying storage, the Map, shares many of
 	// the functional elements of the label.Set. These should be unified so
 	// this conversion is unnecessary and there is no performance hit calling
@@ -36,32 +36,32 @@ func Baggage(ctx context.Context) label.Set {
 	return label.NewSet(values...)
 }
 
-// BaggageValue returns the value related to key in the baggage of ctx. If no
+// Value returns the value related to key in the baggage of ctx. If no
 // value is set, the returned label.Value will be an uninitialized zero-value
 // with type INVALID.
-func BaggageValue(ctx context.Context, key label.Key) label.Value {
+func Value(ctx context.Context, key label.Key) label.Value {
 	v, _ := baggage.MapFromContext(ctx).Value(key)
 	return v
 }
 
-// ContextWithBaggageValues returns a copy of parent with pairs updated in the baggage.
-func ContextWithBaggageValues(parent context.Context, pairs ...label.KeyValue) context.Context {
+// ContextWithValues returns a copy of parent with pairs updated in the baggage.
+func ContextWithValues(parent context.Context, pairs ...label.KeyValue) context.Context {
 	m := baggage.MapFromContext(parent).Apply(baggage.MapUpdate{
 		MultiKV: pairs,
 	})
 	return baggage.ContextWithMap(parent, m)
 }
 
-// ContextWithoutBaggageValues returns a copy of parent in which the values related
+// ContextWithoutValues returns a copy of parent in which the values related
 // to keys have been removed from the baggage.
-func ContextWithoutBaggageValues(parent context.Context, keys ...label.Key) context.Context {
+func ContextWithoutValues(parent context.Context, keys ...label.Key) context.Context {
 	m := baggage.MapFromContext(parent).Apply(baggage.MapUpdate{
 		DropMultiK: keys,
 	})
 	return baggage.ContextWithMap(parent, m)
 }
 
-// ContextWithoutBaggage returns a copy of parent without baggage.
-func ContextWithoutBaggage(parent context.Context) context.Context {
+// ContextWithEmpty returns a copy of parent without baggage.
+func ContextWithEmpty(parent context.Context) context.Context {
 	return baggage.ContextWithNoCorrelationData(parent)
 }
diff --git a/bridge/opentracing/bridge.go b/bridge/opentracing/bridge.go
index 87449f5c..1eb6ee28 100644
--- a/bridge/opentracing/bridge.go
+++ b/bridge/opentracing/bridge.go
@@ -25,16 +25,15 @@ import (
 	otext "github.com/opentracing/opentracing-go/ext"
 	otlog "github.com/opentracing/opentracing-go/log"
 
-	"go.opentelemetry.io/otel"
+	"go.opentelemetry.io/otel/bridge/opentracing/migration"
 	"go.opentelemetry.io/otel/codes"
 	otelglobal "go.opentelemetry.io/otel/global"
 	"go.opentelemetry.io/otel/internal/baggage"
 	"go.opentelemetry.io/otel/internal/trace/noop"
 	otelparent "go.opentelemetry.io/otel/internal/trace/parent"
 	"go.opentelemetry.io/otel/label"
+	"go.opentelemetry.io/otel/propagation"
 	"go.opentelemetry.io/otel/trace"
-
-	"go.opentelemetry.io/otel/bridge/opentracing/migration"
 )
 
 type bridgeSpanContext struct {
@@ -294,7 +293,7 @@ type BridgeTracer struct {
 	warningHandler BridgeWarningHandler
 	warnOnce       sync.Once
 
-	propagator otel.TextMapPropagator
+	propagator propagation.TextMapPropagator
 }
 
 var _ ot.Tracer = &BridgeTracer{}
@@ -329,7 +328,7 @@ func (t *BridgeTracer) SetOpenTelemetryTracer(tracer trace.Tracer) {
 	t.setTracer.isSet = true
 }
 
-func (t *BridgeTracer) SetTextMapPropagator(propagator otel.TextMapPropagator) {
+func (t *BridgeTracer) SetTextMapPropagator(propagator propagation.TextMapPropagator) {
 	t.propagator = propagator
 }
 
@@ -651,7 +650,7 @@ func (t *BridgeTracer) Extract(format interface{}, carrier interface{}) (ot.Span
 	return bridgeSC, nil
 }
 
-func (t *BridgeTracer) getPropagator() otel.TextMapPropagator {
+func (t *BridgeTracer) getPropagator() propagation.TextMapPropagator {
 	if t.propagator != nil {
 		return t.propagator
 	}
diff --git a/example/basic/main.go b/example/basic/main.go
index 93d6fa04..41bb4fcc 100644
--- a/example/basic/main.go
+++ b/example/basic/main.go
@@ -18,12 +18,12 @@ import (
 	"context"
 	"log"
 
-	"go.opentelemetry.io/otel"
+	"go.opentelemetry.io/otel/baggage"
 	"go.opentelemetry.io/otel/exporters/stdout"
 	"go.opentelemetry.io/otel/global"
 	"go.opentelemetry.io/otel/label"
 	"go.opentelemetry.io/otel/metric"
-	"go.opentelemetry.io/otel/propagators"
+	"go.opentelemetry.io/otel/propagation"
 	"go.opentelemetry.io/otel/sdk/metric/controller/push"
 	"go.opentelemetry.io/otel/sdk/metric/processor/basic"
 	"go.opentelemetry.io/otel/sdk/metric/selector/simple"
@@ -63,7 +63,7 @@ func main() {
 	global.SetMeterProvider(pusher.MeterProvider())
 
 	// set global propagator to baggage (the default is no-op).
-	global.SetTextMapPropagator(propagators.Baggage{})
+	global.SetTextMapPropagator(propagation.Baggage{})
 	tracer := global.Tracer("ex.com/basic")
 	meter := global.Meter("ex.com/basic")
 
@@ -79,7 +79,7 @@ func main() {
 	valuerecorderTwo := metric.Must(meter).NewFloat64ValueRecorder("ex.com.two")
 
 	ctx := context.Background()
-	ctx = otel.ContextWithBaggageValues(ctx, fooKey.String("foo1"), barKey.String("bar1"))
+	ctx = baggage.ContextWithValues(ctx, fooKey.String("foo1"), barKey.String("bar1"))
 
 	valuerecorder := valuerecorderTwo.Bind(commonLabels...)
 	defer valuerecorder.Unbind()
@@ -94,7 +94,7 @@ func main() {
 
 		meter.RecordBatch(
 			// Note: call-site variables added as context Entries:
-			otel.ContextWithBaggageValues(ctx, anotherKey.String("xyz")),
+			baggage.ContextWithValues(ctx, anotherKey.String("xyz")),
 			commonLabels,
 
 			valuerecorderTwo.Measurement(2.0),
diff --git a/example/namedtracer/main.go b/example/namedtracer/main.go
index 75995ee7..ae689248 100644
--- a/example/namedtracer/main.go
+++ b/example/namedtracer/main.go
@@ -18,7 +18,7 @@ import (
 	"context"
 	"log"
 
-	"go.opentelemetry.io/otel"
+	"go.opentelemetry.io/otel/baggage"
 	"go.opentelemetry.io/otel/example/namedtracer/foo"
 	"go.opentelemetry.io/otel/exporters/stdout"
 	"go.opentelemetry.io/otel/global"
@@ -63,7 +63,7 @@ func main() {
 	tracer := tp.Tracer("example/namedtracer/main")
 	ctx := context.Background()
 	defer func() { _ = tp.Shutdown(ctx) }()
-	ctx = otel.ContextWithBaggageValues(ctx, fooKey.String("foo1"), barKey.String("bar1"))
+	ctx = baggage.ContextWithValues(ctx, fooKey.String("foo1"), barKey.String("bar1"))
 
 	var span trace.Span
 	ctx, span = tracer.Start(ctx, "operation")
diff --git a/example/otel-collector/main.go b/example/otel-collector/main.go
index 732a31e1..73709c45 100644
--- a/example/otel-collector/main.go
+++ b/example/otel-collector/main.go
@@ -29,7 +29,7 @@ import (
 	"go.opentelemetry.io/otel/global"
 	"go.opentelemetry.io/otel/label"
 	"go.opentelemetry.io/otel/metric"
-	"go.opentelemetry.io/otel/propagators"
+	"go.opentelemetry.io/otel/propagation"
 	"go.opentelemetry.io/otel/sdk/metric/controller/push"
 	"go.opentelemetry.io/otel/sdk/metric/processor/basic"
 	"go.opentelemetry.io/otel/sdk/metric/selector/simple"
@@ -81,7 +81,7 @@ func initProvider() func() {
 	)
 
 	// set global propagator to tracecontext (the default is no-op).
-	global.SetTextMapPropagator(propagators.TraceContext{})
+	global.SetTextMapPropagator(propagation.TraceContext{})
 	global.SetTracerProvider(tracerProvider)
 	global.SetMeterProvider(pusher.MeterProvider())
 	pusher.Start()
diff --git a/global/internal/propagator.go b/global/internal/propagator.go
index 05678bb0..5faf55cf 100644
--- a/global/internal/propagator.go
+++ b/global/internal/propagator.go
@@ -18,33 +18,33 @@ import (
 	"context"
 	"sync"
 
-	"go.opentelemetry.io/otel"
+	"go.opentelemetry.io/otel/propagation"
 )
 
 // textMapPropagator is a default TextMapPropagator that delegates calls to a
 // registered delegate if one is set, otherwise it defaults to delegating the
-// calls to a the default no-op otel.TextMapPropagator.
+// calls to a the default no-op propagation.TextMapPropagator.
 type textMapPropagator struct {
 	mtx      sync.Mutex
 	once     sync.Once
-	delegate otel.TextMapPropagator
-	noop     otel.TextMapPropagator
+	delegate propagation.TextMapPropagator
+	noop     propagation.TextMapPropagator
 }
 
 // Compile-time guarantee that textMapPropagator implements the
-// otel.TextMapPropagator interface.
-var _ otel.TextMapPropagator = (*textMapPropagator)(nil)
+// propagation.TextMapPropagator interface.
+var _ propagation.TextMapPropagator = (*textMapPropagator)(nil)
 
 func newTextMapPropagator() *textMapPropagator {
 	return &textMapPropagator{
-		noop: otel.NewCompositeTextMapPropagator(),
+		noop: propagation.NewCompositeTextMapPropagator(),
 	}
 }
 
-// SetDelegate sets a delegate otel.TextMapPropagator that all calls are
+// SetDelegate sets a delegate propagation.TextMapPropagator that all calls are
 // forwarded to. Delegation can only be performed once, all subsequent calls
 // perform no delegation.
-func (p *textMapPropagator) SetDelegate(delegate otel.TextMapPropagator) {
+func (p *textMapPropagator) SetDelegate(delegate propagation.TextMapPropagator) {
 	if delegate == nil {
 		return
 	}
@@ -57,7 +57,7 @@ func (p *textMapPropagator) SetDelegate(delegate otel.TextMapPropagator) {
 // effectiveDelegate returns the current delegate of p if one is set,
 // otherwise the default noop TextMapPropagator is returned. This method
 // can be called concurrently.
-func (p *textMapPropagator) effectiveDelegate() otel.TextMapPropagator {
+func (p *textMapPropagator) effectiveDelegate() propagation.TextMapPropagator {
 	p.mtx.Lock()
 	defer p.mtx.Unlock()
 	if p.delegate != nil {
@@ -67,12 +67,12 @@ func (p *textMapPropagator) effectiveDelegate() otel.TextMapPropagator {
 }
 
 // Inject set cross-cutting concerns from the Context into the carrier.
-func (p *textMapPropagator) Inject(ctx context.Context, carrier otel.TextMapCarrier) {
+func (p *textMapPropagator) Inject(ctx context.Context, carrier propagation.TextMapCarrier) {
 	p.effectiveDelegate().Inject(ctx, carrier)
 }
 
 // Extract reads cross-cutting concerns from the carrier into a Context.
-func (p *textMapPropagator) Extract(ctx context.Context, carrier otel.TextMapCarrier) context.Context {
+func (p *textMapPropagator) Extract(ctx context.Context, carrier propagation.TextMapCarrier) context.Context {
 	return p.effectiveDelegate().Extract(ctx, carrier)
 }
 
diff --git a/global/internal/state.go b/global/internal/state.go
index 8f6cc159..8db0585e 100644
--- a/global/internal/state.go
+++ b/global/internal/state.go
@@ -18,8 +18,8 @@ import (
 	"sync"
 	"sync/atomic"
 
-	"go.opentelemetry.io/otel"
 	"go.opentelemetry.io/otel/metric"
+	"go.opentelemetry.io/otel/propagation"
 	"go.opentelemetry.io/otel/trace"
 )
 
@@ -33,7 +33,7 @@ type (
 	}
 
 	propagatorsHolder struct {
-		tm otel.TextMapPropagator
+		tm propagation.TextMapPropagator
 	}
 )
 
@@ -92,12 +92,12 @@ func SetMeterProvider(mp metric.MeterProvider) {
 }
 
 // TextMapPropagator is the internal implementation for global.TextMapPropagator.
-func TextMapPropagator() otel.TextMapPropagator {
+func TextMapPropagator() propagation.TextMapPropagator {
 	return globalPropagators.Load().(propagatorsHolder).tm
 }
 
 // SetTextMapPropagator is the internal implementation for global.SetTextMapPropagator.
-func SetTextMapPropagator(p otel.TextMapPropagator) {
+func SetTextMapPropagator(p propagation.TextMapPropagator) {
 	// For the textMapPropagator already returned by TextMapPropagator
 	// delegate to p.
 	delegateTextMapPropagatorOnce.Do(func() {
diff --git a/global/propagation.go b/global/propagation.go
index 3fe10e08..6bd6bbf4 100644
--- a/global/propagation.go
+++ b/global/propagation.go
@@ -15,17 +15,17 @@
 package global // import "go.opentelemetry.io/otel/global"
 
 import (
-	"go.opentelemetry.io/otel"
 	"go.opentelemetry.io/otel/global/internal"
+	"go.opentelemetry.io/otel/propagation"
 )
 
 // TextMapPropagator returns the global TextMapPropagator. If none has been
 // set, a No-Op TextMapPropagator is returned.
-func TextMapPropagator() otel.TextMapPropagator {
+func TextMapPropagator() propagation.TextMapPropagator {
 	return internal.TextMapPropagator()
 }
 
 // SetTextMapPropagator sets propagator as the global TSetTextMapPropagator.
-func SetTextMapPropagator(propagator otel.TextMapPropagator) {
+func SetTextMapPropagator(propagator propagation.TextMapPropagator) {
 	internal.SetTextMapPropagator(propagator)
 }
diff --git a/propagators/baggage.go b/propagation/baggage.go
similarity index 91%
rename from propagators/baggage.go
rename to propagation/baggage.go
index d143f32f..2c416d7f 100644
--- a/propagators/baggage.go
+++ b/propagation/baggage.go
@@ -12,14 +12,13 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-package propagators // import "go.opentelemetry.io/otel/propagators"
+package propagation // import "go.opentelemetry.io/otel/propagation"
 
 import (
 	"context"
 	"net/url"
 	"strings"
 
-	"go.opentelemetry.io/otel"
 	"go.opentelemetry.io/otel/internal/baggage"
 	"go.opentelemetry.io/otel/label"
 )
@@ -32,10 +31,10 @@ const baggageHeader = "baggage"
 // specification is defined at https://w3c.github.io/baggage/.
 type Baggage struct{}
 
-var _ otel.TextMapPropagator = Baggage{}
+var _ TextMapPropagator = Baggage{}
 
 // Inject sets baggage key-values from ctx into the carrier.
-func (b Baggage) Inject(ctx context.Context, carrier otel.TextMapCarrier) {
+func (b Baggage) Inject(ctx context.Context, carrier TextMapCarrier) {
 	baggageMap := baggage.MapFromContext(ctx)
 	firstIter := true
 	var headerValueBuilder strings.Builder
@@ -56,7 +55,7 @@ func (b Baggage) Inject(ctx context.Context, carrier otel.TextMapCarrier) {
 }
 
 // Extract returns a copy of parent with the baggage from the carrier added.
-func (b Baggage) Extract(parent context.Context, carrier otel.TextMapCarrier) context.Context {
+func (b Baggage) Extract(parent context.Context, carrier TextMapCarrier) context.Context {
 	bVal := carrier.Get(baggageHeader)
 	if bVal == "" {
 		return parent
diff --git a/propagators/doc.go b/propagation/doc.go
similarity index 89%
rename from propagators/doc.go
rename to propagation/doc.go
index 48ff026d..89573f1b 100644
--- a/propagators/doc.go
+++ b/propagation/doc.go
@@ -13,7 +13,7 @@
 // limitations under the License.
 
 /*
-Package propagators contains OpenTelemetry context propagators.
+Package propagation contains OpenTelemetry context propagators.
 
 This package is currently in a pre-GA phase. Backwards incompatible changes
 may be introduced in subsequent minor version releases as we work to track the
@@ -25,4 +25,4 @@ package is the W3C Trace Context encoding
 (https://www.w3.org/TR/trace-context/), and W3C Baggage
 (https://w3c.github.io/baggage/).
 */
-package propagators // import "go.opentelemetry.io/otel/propagators"
+package propagation // import "go.opentelemetry.io/otel/propagation"
diff --git a/propagation.go b/propagation/propagation.go
similarity index 97%
rename from propagation.go
rename to propagation/propagation.go
index f71e3945..c867f86b 100644
--- a/propagation.go
+++ b/propagation/propagation.go
@@ -12,7 +12,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-package otel // import "go.opentelemetry.io/otel"
+package propagation // import "go.opentelemetry.io/otel/propagation"
 
 import "context"
 
diff --git a/propagators/trace_context.go b/propagation/trace_context.go
similarity index 90%
rename from propagators/trace_context.go
rename to propagation/trace_context.go
index 0e25da78..ec99e096 100644
--- a/propagators/trace_context.go
+++ b/propagation/trace_context.go
@@ -12,7 +12,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-package propagators // import "go.opentelemetry.io/otel/propagators"
+package propagation // import "go.opentelemetry.io/otel/propagation"
 
 import (
 	"context"
@@ -20,7 +20,6 @@ import (
 	"fmt"
 	"regexp"
 
-	"go.opentelemetry.io/otel"
 	"go.opentelemetry.io/otel/trace"
 )
 
@@ -47,11 +46,11 @@ const (
 // their proprietary information.
 type TraceContext struct{}
 
-var _ otel.TextMapPropagator = TraceContext{}
+var _ TextMapPropagator = TraceContext{}
 var traceCtxRegExp = regexp.MustCompile("^(?P<version>[0-9a-f]{2})-(?P<traceID>[a-f0-9]{32})-(?P<spanID>[a-f0-9]{16})-(?P<traceFlags>[a-f0-9]{2})(?:-.*)?$")
 
 // Inject set tracecontext from the Context into the carrier.
-func (tc TraceContext) Inject(ctx context.Context, carrier otel.TextMapCarrier) {
+func (tc TraceContext) Inject(ctx context.Context, carrier TextMapCarrier) {
 	tracestate := ctx.Value(tracestateKey)
 	if state, ok := tracestate.(string); tracestate != nil && ok {
 		carrier.Set(tracestateHeader, state)
@@ -70,7 +69,7 @@ func (tc TraceContext) Inject(ctx context.Context, carrier otel.TextMapCarrier)
 }
 
 // Extract reads tracecontext from the carrier into a returned Context.
-func (tc TraceContext) Extract(ctx context.Context, carrier otel.TextMapCarrier) context.Context {
+func (tc TraceContext) Extract(ctx context.Context, carrier TextMapCarrier) context.Context {
 	state := carrier.Get(tracestateHeader)
 	if state != "" {
 		ctx = context.WithValue(ctx, tracestateKey, state)
@@ -83,7 +82,7 @@ func (tc TraceContext) Extract(ctx context.Context, carrier otel.TextMapCarrier)
 	return trace.ContextWithRemoteSpanContext(ctx, sc)
 }
 
-func (tc TraceContext) extract(carrier otel.TextMapCarrier) trace.SpanContext {
+func (tc TraceContext) extract(carrier TextMapCarrier) trace.SpanContext {
 	h := carrier.Get(traceparentHeader)
 	if h == "" {
 		return trace.SpanContext{}


Test patch:
diff --git a/baggage_test.go b/baggage/baggage_test.go
similarity index 66%
rename from baggage_test.go
rename to baggage/baggage_test.go
index 3d53b24d..f87c3b2b 100644
--- a/baggage_test.go
+++ b/baggage/baggage_test.go
@@ -12,7 +12,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-package otel
+package baggage
 
 import (
 	"context"
@@ -26,59 +26,59 @@ func TestBaggage(t *testing.T) {
 	ctx := context.Background()
 	ctx = baggage.ContextWithMap(ctx, baggage.NewEmptyMap())
 
-	b := Baggage(ctx)
+	b := Set(ctx)
 	if b.Len() != 0 {
 		t.Fatalf("empty baggage returned a set with %d elements", b.Len())
 	}
 
 	first, second, third := label.Key("first"), label.Key("second"), label.Key("third")
-	ctx = ContextWithBaggageValues(ctx, first.Bool(true), second.String("2"))
+	ctx = ContextWithValues(ctx, first.Bool(true), second.String("2"))
 	m := baggage.MapFromContext(ctx)
 	v, ok := m.Value(first)
 	if !ok {
-		t.Fatal("WithBaggageValues failed to set first value")
+		t.Fatal("WithValues failed to set first value")
 	}
 	if !v.AsBool() {
-		t.Fatal("WithBaggageValues failed to set first correct value")
+		t.Fatal("WithValues failed to set first correct value")
 	}
 	v, ok = m.Value(second)
 	if !ok {
-		t.Fatal("WithBaggageValues failed to set second value")
+		t.Fatal("WithValues failed to set second value")
 	}
 	if v.AsString() != "2" {
-		t.Fatal("WithBaggageValues failed to set second correct value")
+		t.Fatal("WithValues failed to set second correct value")
 	}
 	_, ok = m.Value(third)
 	if ok {
-		t.Fatal("WithBaggageValues set an unexpected third value")
+		t.Fatal("WithValues set an unexpected third value")
 	}
 
-	b = Baggage(ctx)
+	b = Set(ctx)
 	if b.Len() != 2 {
 		t.Fatalf("Baggage returned a set with %d elements, want 2", b.Len())
 	}
 
-	v = BaggageValue(ctx, first)
+	v = Value(ctx, first)
 	if v.Type() != label.BOOL || !v.AsBool() {
-		t.Fatal("BaggageValue failed to get correct first value")
+		t.Fatal("Value failed to get correct first value")
 	}
-	v = BaggageValue(ctx, second)
+	v = Value(ctx, second)
 	if v.Type() != label.STRING || v.AsString() != "2" {
-		t.Fatal("BaggageValue failed to get correct second value")
+		t.Fatal("Value failed to get correct second value")
 	}
 
-	ctx = ContextWithoutBaggageValues(ctx, first)
+	ctx = ContextWithoutValues(ctx, first)
 	m = baggage.MapFromContext(ctx)
 	_, ok = m.Value(first)
 	if ok {
-		t.Fatal("WithoutBaggageValues failed to remove a baggage value")
+		t.Fatal("WithoutValues failed to remove a baggage value")
 	}
 	_, ok = m.Value(second)
 	if !ok {
-		t.Fatal("WithoutBaggageValues removed incorrect value")
+		t.Fatal("WithoutValues removed incorrect value")
 	}
 
-	ctx = ContextWithoutBaggage(ctx)
+	ctx = ContextWithEmpty(ctx)
 	m = baggage.MapFromContext(ctx)
 	if m.Len() != 0 {
 		t.Fatal("WithoutBaggage failed to clear baggage")
diff --git a/oteltest/text_map_propagator.go b/oteltest/text_map_propagator.go
index 7fe901e2..6a765d0d 100644
--- a/oteltest/text_map_propagator.go
+++ b/oteltest/text_map_propagator.go
@@ -22,7 +22,7 @@ import (
 	"sync"
 	"testing"
 
-	"go.opentelemetry.io/otel"
+	"go.opentelemetry.io/otel/propagation"
 )
 
 type ctxKeyType string
@@ -167,12 +167,12 @@ func (p *TextMapPropagator) stateFromContext(ctx context.Context) state {
 	return state{}
 }
 
-func (p *TextMapPropagator) stateFromCarrier(carrier otel.TextMapCarrier) state {
+func (p *TextMapPropagator) stateFromCarrier(carrier propagation.TextMapCarrier) state {
 	return newState(carrier.Get(p.Name))
 }
 
 // Inject set cross-cutting concerns for p from the Context into the carrier.
-func (p *TextMapPropagator) Inject(ctx context.Context, carrier otel.TextMapCarrier) {
+func (p *TextMapPropagator) Inject(ctx context.Context, carrier propagation.TextMapCarrier) {
 	s := p.stateFromContext(ctx)
 	s.Injections++
 	carrier.Set(p.Name, s.String())
@@ -188,7 +188,7 @@ func (p *TextMapPropagator) InjectedN(t *testing.T, carrier *TextMapCarrier, n i
 }
 
 // Extract reads cross-cutting concerns for p from the carrier into a Context.
-func (p *TextMapPropagator) Extract(ctx context.Context, carrier otel.TextMapCarrier) context.Context {
+func (p *TextMapPropagator) Extract(ctx context.Context, carrier propagation.TextMapCarrier) context.Context {
 	s := p.stateFromCarrier(carrier)
 	s.Extractions++
 	return context.WithValue(ctx, p.ctxKey, s)
diff --git a/propagators/baggage_test.go b/propagation/baggage_test.go
similarity index 95%
rename from propagators/baggage_test.go
rename to propagation/baggage_test.go
index 267b47e3..a8742bf4 100644
--- a/propagators/baggage_test.go
+++ b/propagation/baggage_test.go
@@ -12,7 +12,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-package propagators_test
+package propagation_test
 
 import (
 	"context"
@@ -22,14 +22,13 @@ import (
 
 	"github.com/google/go-cmp/cmp"
 
-	"go.opentelemetry.io/otel"
 	"go.opentelemetry.io/otel/internal/baggage"
 	"go.opentelemetry.io/otel/label"
-	"go.opentelemetry.io/otel/propagators"
+	"go.opentelemetry.io/otel/propagation"
 )
 
 func TestExtractValidBaggageFromHTTPReq(t *testing.T) {
-	prop := otel.TextMapPropagator(propagators.Baggage{})
+	prop := propagation.TextMapPropagator(propagation.Baggage{})
 	tests := []struct {
 		name    string
 		header  string
@@ -118,7 +117,7 @@ func TestExtractValidBaggageFromHTTPReq(t *testing.T) {
 }
 
 func TestExtractInvalidDistributedContextFromHTTPReq(t *testing.T) {
-	prop := otel.TextMapPropagator(propagators.Baggage{})
+	prop := propagation.TextMapPropagator(propagation.Baggage{})
 	tests := []struct {
 		name   string
 		header string
@@ -176,7 +175,7 @@ func TestExtractInvalidDistributedContextFromHTTPReq(t *testing.T) {
 }
 
 func TestInjectBaggageToHTTPReq(t *testing.T) {
-	propagator := propagators.Baggage{}
+	propagator := propagation.Baggage{}
 	tests := []struct {
 		name         string
 		kvs          []label.KeyValue
@@ -250,7 +249,7 @@ func TestInjectBaggageToHTTPReq(t *testing.T) {
 }
 
 func TestBaggagePropagatorGetAllKeys(t *testing.T) {
-	var propagator propagators.Baggage
+	var propagator propagation.Baggage
 	want := []string{"baggage"}
 	got := propagator.Fields()
 	if diff := cmp.Diff(got, want); diff != "" {
diff --git a/propagation_test.go b/propagation/propagation_test.go
similarity index 81%
rename from propagation_test.go
rename to propagation/propagation_test.go
index 14d20582..477938de 100644
--- a/propagation_test.go
+++ b/propagation/propagation_test.go
@@ -12,12 +12,14 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-package otel
+package propagation_test
 
 import (
 	"context"
 	"strings"
 	"testing"
+
+	"go.opentelemetry.io/otel/propagation"
 )
 
 type ctxKeyType uint
@@ -38,11 +40,11 @@ type propagator struct {
 	Name string
 }
 
-func (p propagator) Inject(ctx context.Context, carrier TextMapCarrier) {
+func (p propagator) Inject(ctx context.Context, carrier propagation.TextMapCarrier) {
 	carrier.Set(p.Name, "")
 }
 
-func (p propagator) Extract(ctx context.Context, carrier TextMapCarrier) context.Context {
+func (p propagator) Extract(ctx context.Context, carrier propagation.TextMapCarrier) context.Context {
 	v := ctx.Value(ctxKey)
 	if v == nil {
 		ctx = context.WithValue(ctx, ctxKey, []string{p.Name})
@@ -62,7 +64,7 @@ func TestCompositeTextMapPropagatorFields(t *testing.T) {
 		"a": {},
 		"b": {},
 	}
-	got := NewCompositeTextMapPropagator(a, b1, b2).Fields()
+	got := propagation.NewCompositeTextMapPropagator(a, b1, b2).Fields()
 	if len(got) != len(want) {
 		t.Fatalf("invalid fields from composite: %v (want %v)", got, want)
 	}
@@ -77,7 +79,7 @@ func TestCompositeTextMapPropagatorInject(t *testing.T) {
 	a, b := propagator{"a"}, propagator{"b"}
 
 	c := make(carrier, 0, 2)
-	NewCompositeTextMapPropagator(a, b).Inject(context.Background(), &c)
+	propagation.NewCompositeTextMapPropagator(a, b).Inject(context.Background(), &c)
 
 	if got := strings.Join([]string(c), ","); got != "a,b" {
 		t.Errorf("invalid inject order: %s", got)
@@ -88,7 +90,7 @@ func TestCompositeTextMapPropagatorExtract(t *testing.T) {
 	a, b := propagator{"a"}, propagator{"b"}
 
 	ctx := context.Background()
-	ctx = NewCompositeTextMapPropagator(a, b).Extract(ctx, nil)
+	ctx = propagation.NewCompositeTextMapPropagator(a, b).Extract(ctx, nil)
 
 	v := ctx.Value(ctxKey)
 	if v == nil {
diff --git a/propagators/propagators_test.go b/propagation/propagators_test.go
similarity index 85%
rename from propagators/propagators_test.go
rename to propagation/propagators_test.go
index 03af3ca0..df392b51 100644
--- a/propagators/propagators_test.go
+++ b/propagation/propagators_test.go
@@ -12,7 +12,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-package propagators_test
+package propagation_test
 
 import (
 	"context"
@@ -21,8 +21,7 @@ import (
 	"github.com/stretchr/testify/assert"
 	"github.com/stretchr/testify/require"
 
-	"go.opentelemetry.io/otel"
-	"go.opentelemetry.io/otel/propagators"
+	"go.opentelemetry.io/otel/propagation"
 	"go.opentelemetry.io/otel/trace"
 )
 
@@ -58,9 +57,9 @@ type outOfThinAirPropagator struct {
 	t *testing.T
 }
 
-var _ otel.TextMapPropagator = outOfThinAirPropagator{}
+var _ propagation.TextMapPropagator = outOfThinAirPropagator{}
 
-func (p outOfThinAirPropagator) Extract(ctx context.Context, carrier otel.TextMapCarrier) context.Context {
+func (p outOfThinAirPropagator) Extract(ctx context.Context, carrier propagation.TextMapCarrier) context.Context {
 	sc := trace.SpanContext{
 		TraceID:    traceID,
 		SpanID:     spanID,
@@ -70,7 +69,7 @@ func (p outOfThinAirPropagator) Extract(ctx context.Context, carrier otel.TextMa
 	return trace.ContextWithRemoteSpanContext(ctx, sc)
 }
 
-func (outOfThinAirPropagator) Inject(context.Context, otel.TextMapCarrier) {}
+func (outOfThinAirPropagator) Inject(context.Context, propagation.TextMapCarrier) {}
 
 func (outOfThinAirPropagator) Fields() []string {
 	return nil
@@ -78,7 +77,7 @@ func (outOfThinAirPropagator) Fields() []string {
 
 type nilCarrier struct{}
 
-var _ otel.TextMapCarrier = nilCarrier{}
+var _ propagation.TextMapCarrier = nilCarrier{}
 
 func (nilCarrier) Get(key string) string {
 	return ""
@@ -89,8 +88,8 @@ func (nilCarrier) Set(key string, value string) {}
 func TestMultiplePropagators(t *testing.T) {
 	ootaProp := outOfThinAirPropagator{t: t}
 	ns := nilCarrier{}
-	testProps := []otel.TextMapPropagator{
-		propagators.TraceContext{},
+	testProps := []propagation.TextMapPropagator{
+		propagation.TraceContext{},
 	}
 	bg := context.Background()
 	// sanity check of oota propagator, ensuring that it really
@@ -109,7 +108,7 @@ func TestMultiplePropagators(t *testing.T) {
 		require.Falsef(t, sc.IsValid(), "%#v failed sanity check", prop)
 	}
 	for _, prop := range testProps {
-		props := otel.NewCompositeTextMapPropagator(ootaProp, prop)
+		props := propagation.NewCompositeTextMapPropagator(ootaProp, prop)
 		ctx := props.Extract(bg, ns)
 		sc := trace.RemoteSpanContextFromContext(ctx)
 		assert.Truef(t, sc.IsValid(), "%#v clobbers span context", prop)
diff --git a/propagators/trace_context_benchmark_test.go b/propagation/trace_context_benchmark_test.go
similarity index 95%
rename from propagators/trace_context_benchmark_test.go
rename to propagation/trace_context_benchmark_test.go
index ba029cb4..0f2d5fce 100644
--- a/propagators/trace_context_benchmark_test.go
+++ b/propagation/trace_context_benchmark_test.go
@@ -12,7 +12,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-package propagators_test
+package propagation_test
 
 import (
 	"context"
@@ -20,12 +20,12 @@ import (
 	"testing"
 
 	"go.opentelemetry.io/otel/oteltest"
-	"go.opentelemetry.io/otel/propagators"
+	"go.opentelemetry.io/otel/propagation"
 	"go.opentelemetry.io/otel/trace"
 )
 
 func BenchmarkInject(b *testing.B) {
-	var t propagators.TraceContext
+	var t propagation.TraceContext
 
 	injectSubBenchmarks(b, func(ctx context.Context, b *testing.B) {
 		req, _ := http.NewRequest("GET", "http://example.com", nil)
@@ -62,7 +62,7 @@ func injectSubBenchmarks(b *testing.B, fn func(context.Context, *testing.B)) {
 
 func BenchmarkExtract(b *testing.B) {
 	extractSubBenchmarks(b, func(b *testing.B, req *http.Request) {
-		var propagator propagators.TraceContext
+		var propagator propagation.TraceContext
 		ctx := context.Background()
 		b.ResetTimer()
 		for i := 0; i < b.N; i++ {
diff --git a/propagators/trace_context_example_test.go b/propagation/trace_context_example_test.go
similarity index 88%
rename from propagators/trace_context_example_test.go
rename to propagation/trace_context_example_test.go
index e871b66f..d2ddcd82 100644
--- a/propagators/trace_context_example_test.go
+++ b/propagation/trace_context_example_test.go
@@ -12,15 +12,15 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-package propagators_test
+package propagation_test
 
 import (
 	"go.opentelemetry.io/otel/global"
-	"go.opentelemetry.io/otel/propagators"
+	"go.opentelemetry.io/otel/propagation"
 )
 
 func ExampleTraceContext() {
-	tc := propagators.TraceContext{}
+	tc := propagation.TraceContext{}
 	// Register the TraceContext propagator globally.
 	global.SetTextMapPropagator(tc)
 }
diff --git a/propagators/trace_context_test.go b/propagation/trace_context_test.go
similarity index 96%
rename from propagators/trace_context_test.go
rename to propagation/trace_context_test.go
index b32460ed..1fc3ba15 100644
--- a/propagators/trace_context_test.go
+++ b/propagation/trace_context_test.go
@@ -12,7 +12,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-package propagators_test
+package propagation_test
 
 import (
 	"context"
@@ -22,12 +22,12 @@ import (
 	"github.com/google/go-cmp/cmp"
 
 	"go.opentelemetry.io/otel/oteltest"
-	"go.opentelemetry.io/otel/propagators"
+	"go.opentelemetry.io/otel/propagation"
 	"go.opentelemetry.io/otel/trace"
 )
 
 func TestExtractValidTraceContextFromHTTPReq(t *testing.T) {
-	prop := propagators.TraceContext{}
+	prop := propagation.TraceContext{}
 	tests := []struct {
 		name   string
 		header string
@@ -122,7 +122,7 @@ func TestExtractValidTraceContextFromHTTPReq(t *testing.T) {
 
 func TestExtractInvalidTraceContextFromHTTPReq(t *testing.T) {
 	wantSc := trace.SpanContext{}
-	prop := propagators.TraceContext{}
+	prop := propagation.TraceContext{}
 	tests := []struct {
 		name   string
 		header string
@@ -210,7 +210,7 @@ func TestExtractInvalidTraceContextFromHTTPReq(t *testing.T) {
 
 func TestInjectTraceContextToHTTPReq(t *testing.T) {
 	mockTracer := oteltest.DefaultTracer()
-	prop := propagators.TraceContext{}
+	prop := propagation.TraceContext{}
 	tests := []struct {
 		name       string
 		sc         trace.SpanContext
@@ -267,7 +267,7 @@ func TestInjectTraceContextToHTTPReq(t *testing.T) {
 }
 
 func TestTraceContextPropagator_GetAllKeys(t *testing.T) {
-	var propagator propagators.TraceContext
+	var propagator propagation.TraceContext
 	want := []string{"traceparent", "tracestate"}
 	got := propagator.Fields()
 	if diff := cmp.Diff(got, want); diff != "" {
@@ -276,7 +276,7 @@ func TestTraceContextPropagator_GetAllKeys(t *testing.T) {
 }
 
 func TestTraceStatePropagation(t *testing.T) {
-	prop := propagators.TraceContext{}
+	prop := propagation.TraceContext{}
 	want := "opaquevalue"
 	headerName := "tracestate"