WIP: Named tracer prototype#227
Conversation
| } | ||
|
|
||
| func BenchmarkTraceID_DotString(b *testing.B) { | ||
| getTracer(b, "Benchmark traceID to string") |
There was a problem hiding this comment.
yes. Without this tracer doesn't have a reference to the provider which has the config.
There was a problem hiding this comment.
It just doesn't look like the tracer is used in this benchmark. No big deal.
There was a problem hiding this comment.
I was looking in the wrong place. Yes, it is not needed. I have removed it.
| } | ||
|
|
||
| func BenchmarkSpanID_DotString(b *testing.B) { | ||
| getTracer(b, "Benchmark spanID to string") |
| // GetTracer creates a named tracer that implements Tracer interface. | ||
| // If name is an empty string then default name from the manager | ||
| // is used. | ||
| GetTracer(name string) Tracer |
There was a problem hiding this comment.
I wonder if this should just be Get(name string) Tracer.
There was a problem hiding this comment.
I'll fix this in another PR when I move the provider interface to global package.
|
My concern about naming is that is fairly long. Renaming the |
|
|
||
| func main() { | ||
| initTracer() | ||
| tr := trace.GlobalProvider().GetTracer("stackdriver/example/server") |
| // For the example, use sdktrace.AlwaysSample sampler to sample all traces. | ||
| // In a production application, use sdktrace.ProbabilitySampler with a desired probability. | ||
| sdktrace.ApplyConfig(sdktrace.Config{DefaultSampler: sdktrace.AlwaysSample()}) | ||
| //import sdktrace "go.opentelemetry.io/sdk/trace" |
There was a problem hiding this comment.
This comment doesn't make sense anymore.
| t.Errorf("%s: Error creating new instance of BatchSpanProcessor, error: %v\n", option.name, err) | ||
| } | ||
| sdktrace.RegisterSpanProcessor(ssp) | ||
| //sdktrace.RegisterSpanProcessor(ssp) |
| } | ||
|
|
||
| // UnregisterSpanProcessor removes from the list of SpanProcessors the SpanProcessor that was | ||
| // registered with the given name. |
There was a problem hiding this comment.
This comment is quite stuttery.
Suggestion:
UnregisterSpanProcessor removes the given SpanProcessor from the list of SpanProcessors
| func TestRegisterSpanProcessort(t *testing.T) { | ||
| name := "Register span processor before span starts" | ||
| tp, _ := sdktrace.NewProvider( | ||
| sdktrace.WithConfig(sdktrace.Config{DefaultSampler: sdktrace.AlwaysSample()})) |
There was a problem hiding this comment.
This line is repeated a lot.
suggestion:
Set var testConfig = sdktrace.Config{DefaultSampler: sdktrace.AlwaysSample()} and use that in WithConfig
| @@ -0,0 +1,24 @@ | |||
| // Copyright 2019, OpenTelemetry Authors | |||
There was a problem hiding this comment.
Should this file be named noop_trace_provider.go?
I'll take care of this in another PR. |
| } | ||
|
|
||
| func BenchmarkTraceID_DotString(b *testing.B) { | ||
| getTracer(b, "Benchmark traceID to string") |
There was a problem hiding this comment.
It just doesn't look like the tracer is used in this benchmark. No big deal.
This is a prototype for named tracer. What is in here?