Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing PR fixes #503

Merged
merged 4 commits into from
Mar 2, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions api/correlation/correlation_context_propagator.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ import (
"go.opentelemetry.io/otel/api/propagation"
)

// CorrelationContextHeader is specified by W3C.
//nolint:golint
var CorrelationContextHeader = "Correlation-Context"
const correlationContextHeader = "Correlation-Context"

// CorrelationContext propagates Key:Values in W3C CorrelationContext
// format.
Expand Down Expand Up @@ -44,13 +42,13 @@ func (CorrelationContext) Inject(ctx context.Context, supplier propagation.HTTPS
})
if headerValueBuilder.Len() > 0 {
headerString := headerValueBuilder.String()
supplier.Set(CorrelationContextHeader, headerString)
supplier.Set(correlationContextHeader, headerString)
}
}

// Extract implements HTTPExtractor.
func (CorrelationContext) Extract(ctx context.Context, supplier propagation.HTTPSupplier) context.Context {
correlationContext := supplier.Get(CorrelationContextHeader)
correlationContext := supplier.Get(correlationContextHeader)
if correlationContext == "" {
return ContextWithMap(ctx, NewEmptyMap())
}
Expand Down Expand Up @@ -95,5 +93,5 @@ func (CorrelationContext) Extract(ctx context.Context, supplier propagation.HTTP

// GetAllKeys implements HTTPPropagator.
func (CorrelationContext) GetAllKeys() []string {
return []string{CorrelationContextHeader}
return []string{correlationContextHeader}
}
4 changes: 1 addition & 3 deletions api/global/internal/meter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ func TestDirect(t *testing.T) {
func TestBound(t *testing.T) {
internal.ResetForTest()

// Note: this test uses oppsite Float64/Int64 number kinds
// Note: this test uses opposite Float64/Int64 number kinds
// vs. the above, to cover all the instruments.
ctx := context.Background()
glob := global.MeterProvider().Meter("test")
Expand Down Expand Up @@ -229,8 +229,6 @@ func TestDefaultSDK(t *testing.T) {
func TestUnbindThenRecordOne(t *testing.T) {
internal.ResetForTest()

// Note: this test uses oppsite Float64/Int64 number kinds
// vs. the above, to cover all the instruments.
ctx := context.Background()
sdk := metrictest.NewProvider()
meter := global.MeterProvider().Meter("test")
Expand Down
12 changes: 6 additions & 6 deletions api/metric/api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ func checkOptions(t *testing.T, got *metric.Options, expected *metric.Options) {
func TestCounter(t *testing.T) {
{
meter := mock.NewMeter()
c := meter.NewFloat64Counter("ajwaj")
c := meter.NewFloat64Counter("test.counter.float")
ctx := context.Background()
labels := meter.Labels()
c.Add(ctx, 42, labels)
Expand All @@ -382,7 +382,7 @@ func TestCounter(t *testing.T) {
}
{
meter := mock.NewMeter()
c := meter.NewInt64Counter("ajwaj")
c := meter.NewInt64Counter("test.counter.int")
ctx := context.Background()
labels := meter.Labels()
c.Add(ctx, 42, labels)
Expand All @@ -397,7 +397,7 @@ func TestCounter(t *testing.T) {
func TestGauge(t *testing.T) {
{
meter := mock.NewMeter()
g := meter.NewFloat64Gauge("ajwaj")
g := meter.NewFloat64Gauge("test.gauge.float")
ctx := context.Background()
labels := meter.Labels()
g.Set(ctx, 42, labels)
Expand All @@ -409,7 +409,7 @@ func TestGauge(t *testing.T) {
}
{
meter := mock.NewMeter()
g := meter.NewInt64Gauge("ajwaj")
g := meter.NewInt64Gauge("test.gauge.int")
ctx := context.Background()
labels := meter.Labels()
g.Set(ctx, 42, labels)
Expand All @@ -424,7 +424,7 @@ func TestGauge(t *testing.T) {
func TestMeasure(t *testing.T) {
{
meter := mock.NewMeter()
m := meter.NewFloat64Measure("ajwaj")
m := meter.NewFloat64Measure("test.measure.float")
ctx := context.Background()
labels := meter.Labels()
m.Record(ctx, 42, labels)
Expand All @@ -436,7 +436,7 @@ func TestMeasure(t *testing.T) {
}
{
meter := mock.NewMeter()
m := meter.NewInt64Measure("ajwaj")
m := meter.NewInt64Measure("test.measure.int")
ctx := context.Background()
labels := meter.Labels()
m.Record(ctx, 42, labels)
Expand Down
8 changes: 4 additions & 4 deletions api/trace/trace_context_propagator.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import (
const (
supportedVersion = 0
maxVersion = 254
TraceparentHeader = "Traceparent"
traceparentHeader = "Traceparent"
)

// TraceContext propagates SpanContext in W3C TraceContext format.
Expand All @@ -51,7 +51,7 @@ func (TraceContext) Inject(ctx context.Context, supplier propagation.HTTPSupplie
sc.TraceIDString(),
sc.SpanID,
sc.TraceFlags&core.TraceFlagsSampled)
supplier.Set(TraceparentHeader, h)
supplier.Set(traceparentHeader, h)
}
}

Expand All @@ -60,7 +60,7 @@ func (tc TraceContext) Extract(ctx context.Context, supplier propagation.HTTPSup
}

func (TraceContext) extract(supplier propagation.HTTPSupplier) core.SpanContext {
h := supplier.Get(TraceparentHeader)
h := supplier.Get(traceparentHeader)
if h == "" {
return core.EmptySpanContext()
}
Expand Down Expand Up @@ -127,5 +127,5 @@ func (TraceContext) extract(supplier propagation.HTTPSupplier) core.SpanContext
}

func (TraceContext) GetAllKeys() []string {
return []string{TraceparentHeader}
return []string{traceparentHeader}
}
4 changes: 1 addition & 3 deletions plugin/othttp/handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ import (
"net/http/httptest"
"testing"

"go.opentelemetry.io/otel/api/trace"

mocktrace "go.opentelemetry.io/otel/internal/trace"
)

Expand All @@ -47,7 +45,7 @@ func TestBasics(t *testing.T) {
if got, expected := rr.Result().StatusCode, http.StatusOK; got != expected {
t.Fatalf("got %d, expected %d", got, expected)
}
if got := rr.Header().Get(trace.TraceparentHeader); got == "" {
if got := rr.Header().Get("Traceparent"); got == "" {
t.Fatal("expected non empty trace header")
}
if got, expected := id, uint64(1); got != expected {
Expand Down