adds custom tags from settings

This commit is contained in:
bergquist
2017-09-14 19:01:22 +02:00
parent e3211f6e48
commit ec29b469e4
5 changed files with 68 additions and 8 deletions

View File

@@ -14,11 +14,9 @@ func RequestTracing(handler string) macaron.Handler {
return func(res http.ResponseWriter, req *http.Request, c *macaron.Context) {
rw := res.(macaron.ResponseWriter)
var span opentracing.Span
tracer := opentracing.GlobalTracer()
wireContext, _ := tracer.Extract(opentracing.HTTPHeaders, opentracing.HTTPHeadersCarrier(req.Header))
spanName := fmt.Sprintf("HTTP %s", handler)
span = tracer.StartSpan(spanName, ext.RPCServerOption(wireContext))
span := tracer.StartSpan(fmt.Sprintf("HTTP %s", handler), ext.RPCServerOption(wireContext))
defer span.Finish()
ctx := opentracing.ContextWithSpan(req.Context(), span)