Skip to content

Commit

Permalink
use version of ancla with context trace fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
joe94 committed May 19, 2021
1 parent 228163a commit 919442d
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 20 deletions.
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ require (
github.com/spf13/pflag v1.0.5
github.com/spf13/viper v1.7.1
github.com/stretchr/testify v1.7.0
github.com/xmidt-org/ancla v0.1.4
github.com/xmidt-org/ancla v0.1.5-0.20210519194134-18ba3cafd98f
github.com/xmidt-org/bascule v0.9.0
github.com/xmidt-org/candlelight v0.0.4
github.com/xmidt-org/candlelight v0.0.5
github.com/xmidt-org/webpa-common v1.11.6
github.com/xmidt-org/wrp-go/v3 v3.0.1
go.opentelemetry.io/contrib/instrumentation/github.com/gorilla/mux/otelmux v0.19.0
Expand Down
8 changes: 8 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -687,13 +687,17 @@ github.com/vmware/govmomi v0.18.0/go.mod h1:URlwyTFZX72RmxtxuaFL2Uj3fD1JTvZdx59b
github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU=
github.com/xmidt-org/ancla v0.1.4 h1:cSD1g5wVSjhaMr3AtHJXJeo+u80sHaR1lOfXEPi5IS0=
github.com/xmidt-org/ancla v0.1.4/go.mod h1:WEdSgtmhVaaP573W/yQz3TYDU7A8q6zh5LvbEiSf9Og=
github.com/xmidt-org/ancla v0.1.5-0.20210519194134-18ba3cafd98f h1:zBV3Vb4RKioZqKCYFu7Qr2huTEN70npAFOPfTpjGglc=
github.com/xmidt-org/ancla v0.1.5-0.20210519194134-18ba3cafd98f/go.mod h1:1Lnuy2pVuZ5Noh0BYJF/C+zM7+E5pUqyS5fKg7QVsb4=
github.com/xmidt-org/argus v0.3.9 h1:zmKDRq5e3Gy/hPxym3U4S1aba4ehNnTYGmmsJYIClKU=
github.com/xmidt-org/argus v0.3.9/go.mod h1:mDFS44R704gl9Fif3gkfAyvnZa53SvMepmXjYWABPvk=
github.com/xmidt-org/argus v0.3.10-0.20201105190057-402fede05764/go.mod h1:lnMCVB/i0gOlUOOd2WbzDDgzTEqP5TipzQ8xKIw+N/I=
github.com/xmidt-org/argus v0.3.10-0.20201217204602-66f69b12c498 h1:Hs6xX7RLCB1YHdwVSfutQw/xxfawOf/C1Mi93Cjo3dk=
github.com/xmidt-org/argus v0.3.10-0.20201217204602-66f69b12c498/go.mod h1:lnMCVB/i0gOlUOOd2WbzDDgzTEqP5TipzQ8xKIw+N/I=
github.com/xmidt-org/argus v0.3.14 h1:XtMIqBHdRoFs1eaudPsZrIa+xWXYAqHDJN0ZPWQCSqQ=
github.com/xmidt-org/argus v0.3.14/go.mod h1:Xn5ZMLNBvY6QSAEG3sLehLLa+YVOdd3hJlyGsy7tve4=
github.com/xmidt-org/argus v0.3.16-0.20210519193503-0408fd8c99ed h1:CE7yjOq49BW17Jx0mlNwh50itkRr4jENyy6JtDWNSa8=
github.com/xmidt-org/argus v0.3.16-0.20210519193503-0408fd8c99ed/go.mod h1:XW8O8+mxkBkaziX3462DLmvNFgcOetRZsDDofW+XimY=
github.com/xmidt-org/arrange v0.1.9 h1:MgMCRH7uMg+LZWvuo3c+63UmEV73LRMyrYmm267E8oM=
github.com/xmidt-org/arrange v0.1.9/go.mod h1:PRA8iEZ11L93NsEkDP56x1mZyfDcWxzDULgHj56TaEk=
github.com/xmidt-org/bascule v0.8.0 h1:xk/c8zqqNjoSW4b4oSrUwemm786Bs5DabmX7AgUgNPw=
Expand All @@ -704,10 +708,14 @@ github.com/xmidt-org/bascule v0.9.0 h1:CsMtwiDO4jjoOIh4pWe2U9tXA9A73CfohDsSvwzXm
github.com/xmidt-org/bascule v0.9.0/go.mod h1:C64nSBtUTTK/f2/mCvvp/qJhav5raD0T+by68DCp/gU=
github.com/xmidt-org/candlelight v0.0.4 h1:ANyWzFA6ixldopLW+LIWoh9gZZRdUcKbfWjm3CqJWTg=
github.com/xmidt-org/candlelight v0.0.4/go.mod h1:f5aC01FCH/KTT9j4zGrrzaV9vRmtTSDwdS4jrREZAW4=
github.com/xmidt-org/candlelight v0.0.5 h1:2qsfD7Uubz08LQZSaBIYXaQe9qXijr/U8lIDgkU7UFM=
github.com/xmidt-org/candlelight v0.0.5/go.mod h1:j9Q2tzrOAywm+JvvVJjlOmlPJvdlRrOyFjLz33SaU1Y=
github.com/xmidt-org/httpaux v0.1.3 h1:RiA4pCwlZfu6a3CBzbvJy3F+5no1ou2UB2XLmNxzzUs=
github.com/xmidt-org/httpaux v0.1.3/go.mod h1:mviIlg5fHGb3lAv3l0sbiwVG/q9rqvXaudEYxVrzXdE=
github.com/xmidt-org/themis v0.4.4 h1:KewitRxStW1xOehDBi0YyGZyRv3PjFdYUEDvQFf1Nmk=
github.com/xmidt-org/themis v0.4.4/go.mod h1:0qRYFvKdrQhwjxH/1nAiTgBGT4cegJR76gfEYF5P7so=
github.com/xmidt-org/themis v0.4.7 h1:QAbutfysHG/UhVNzPAvWsEQIdZY0oNz9KYIkAaK7aus=
github.com/xmidt-org/themis v0.4.7/go.mod h1:GlsC/hO9lpZKs6mJNZtbDOf/yDT8tS6NN0k3C+YsWFc=
github.com/xmidt-org/webpa-common v1.1.0/go.mod h1:oCpKzOC+9h2vYHVzAU/06tDTQuBN4RZz+rhgIXptpOI=
github.com/xmidt-org/webpa-common v1.3.2/go.mod h1:oCpKzOC+9h2vYHVzAU/06tDTQuBN4RZz+rhgIXptpOI=
github.com/xmidt-org/webpa-common v1.10.2-0.20200604164000-f07406b4eb63/go.mod h1:Fmt3wIxBzwJY0KeRHX6RaLZx2xpKTbXCLEA3Xtd6kq8=
Expand Down
27 changes: 9 additions & 18 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ import (
"github.com/xmidt-org/tr1d1um/translation"
"go.opentelemetry.io/contrib/instrumentation/github.com/gorilla/mux/otelmux"
"go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp"
"go.opentelemetry.io/otel/propagation"
"go.opentelemetry.io/otel/trace"

"github.com/go-kit/kit/log"
"github.com/go-kit/kit/log/level"
Expand Down Expand Up @@ -139,7 +137,7 @@ func tr1d1um(arguments []string) (exitCode int) {
fmt.Fprintf(os.Stderr, "Unable to build tracing component: %v \n", err)
return 1
}
infoLogger.Log(logging.MessageKey(), "tracing status", "enabled", tracing.Enabled)
infoLogger.Log(logging.MessageKey(), "tracing status", "enabled", !tracing.IsNoop())
authenticate, err = authenticationHandler(v, logger, metricsRegistry)
if err != nil {
fmt.Fprintf(os.Stderr, "Unable to build authentication handler: %s\n", err.Error())
Expand All @@ -148,10 +146,10 @@ func tr1d1um(arguments []string) (exitCode int) {

rootRouter := mux.NewRouter()
otelMuxOptions := []otelmux.Option{
otelmux.WithPropagators(tracing.Propagator),
otelmux.WithTracerProvider(tracing.TracerProvider),
otelmux.WithPropagators(tracing.Propagator()),
otelmux.WithTracerProvider(tracing.TracerProvider()),
}
rootRouter.Use(otelmux.Middleware("mainSpan", otelMuxOptions...), candlelight.EchoFirstTraceNodeInfo(tracing.Propagator))
rootRouter.Use(otelmux.Middleware("mainSpan", otelMuxOptions...), candlelight.EchoFirstTraceNodeInfo(tracing.Propagator()))

APIRouter := rootRouter.PathPrefix(fmt.Sprintf("/%s/", apiBase)).Subrouter()

Expand Down Expand Up @@ -339,25 +337,18 @@ func newArgusClientTimeout(v *viper.Viper) (httpClientTimeout, error) {
}

func loadTracing(v *viper.Viper, appName string) (candlelight.Tracing, error) {
var tracing = candlelight.Tracing{
Enabled: false,
Propagator: propagation.TraceContext{},
TracerProvider: trace.NewNoopTracerProvider(),
}
var traceConfig candlelight.Config
err := v.UnmarshalKey(tracingConfigKey, &traceConfig)
if err != nil {
return candlelight.Tracing{}, err
}
traceConfig.ApplicationName = appName
tracerProvider, err := candlelight.ConfigureTracerProvider(traceConfig)

tracing, err := candlelight.New(traceConfig)
if err != nil {
return candlelight.Tracing{}, err
}
if len(traceConfig.Provider) != 0 && traceConfig.Provider != candlelight.DefaultTracerProvider {
tracing.Enabled = true
}
tracing.TracerProvider = tracerProvider

return tracing, nil
}

Expand All @@ -368,8 +359,8 @@ func newHTTPClient(timeouts httpClientTimeout, tracing candlelight.Tracing) *htt
}).Dial,
}
transport = otelhttp.NewTransport(transport,
otelhttp.WithPropagators(tracing.Propagator),
otelhttp.WithTracerProvider(tracing.TracerProvider),
otelhttp.WithPropagators(tracing.Propagator()),
otelhttp.WithTracerProvider(tracing.TracerProvider()),
)

return &http.Client{
Expand Down

0 comments on commit 919442d

Please sign in to comment.