tracing: support dynamic reloading, more aggressive envoy restart (#2262)

* tracing: support dynamic reloading, more aggressive envoy restart

* set exporter to nil

* actually register tracer
This commit is contained in:
Caleb Doxsey 2021-06-02 09:58:07 -06:00 committed by GitHub
parent 40ddc2c4b3
commit 513859665a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 164 additions and 83 deletions

View file

@ -5,7 +5,7 @@ import (
"testing"
)
func TestRegisterTracing(t *testing.T) {
func TestGetProvider(t *testing.T) {
tests := []struct {
name string
opts *TracingOptions
@ -13,13 +13,13 @@ func TestRegisterTracing(t *testing.T) {
}{
{"jaeger", &TracingOptions{JaegerAgentEndpoint: "localhost:6831", Service: "all", Provider: "jaeger"}, false},
{"jaeger with debug", &TracingOptions{JaegerAgentEndpoint: "localhost:6831", Service: "all", Provider: "jaeger", Debug: true}, false},
{"jaeger no endpoint", &TracingOptions{JaegerAgentEndpoint: "", Service: "all", Provider: "jaeger"}, true},
{"jaeger no endpoint", &TracingOptions{JaegerAgentEndpoint: "", Service: "all", Provider: "jaeger"}, false},
{"unknown provider", &TracingOptions{JaegerAgentEndpoint: "localhost:0", Service: "all", Provider: "Lucius Cornelius Sulla"}, true},
{"zipkin with debug", &TracingOptions{ZipkinEndpoint: &url.URL{Host: "localhost"}, Service: "all", Provider: "zipkin", Debug: true}, false},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if _, err := RegisterTracing(tt.opts); (err != nil) != tt.wantErr {
if _, err := GetProvider(tt.opts); (err != nil) != tt.wantErr {
t.Errorf("RegisterTracing() error = %v, wantErr %v", err, tt.wantErr)
}
})