Commit e3211f6e by bergquist

use route as span name

parent ee2e4c65
...@@ -21,7 +21,7 @@ func (hs *HttpServer) registerRoutes() { ...@@ -21,7 +21,7 @@ func (hs *HttpServer) registerRoutes() {
// automatically set HEAD for every GET // automatically set HEAD for every GET
macaronR.SetAutoHead(true) macaronR.SetAutoHead(true)
r := newRouteRegister(middleware.RequestMetrics) r := newRouteRegister(middleware.RequestMetrics, middleware.RequestTracing)
// not logged in views // not logged in views
r.Get("/", reqSignedIn, Index) r.Get("/", reqSignedIn, Index)
......
...@@ -170,7 +170,6 @@ func (hs *HttpServer) newMacaron() *macaron.Macaron { ...@@ -170,7 +170,6 @@ func (hs *HttpServer) newMacaron() *macaron.Macaron {
m.Use(hs.metricsEndpoint) m.Use(hs.metricsEndpoint)
m.Use(middleware.GetContextHandler()) m.Use(middleware.GetContextHandler())
m.Use(middleware.Sessioner(&setting.SessionOptions)) m.Use(middleware.Sessioner(&setting.SessionOptions))
m.Use(middleware.RequestTracing())
m.Use(middleware.OrgRedirect()) m.Use(middleware.OrgRedirect())
// needs to be after context handler // needs to be after context handler
......
...@@ -10,14 +10,14 @@ import ( ...@@ -10,14 +10,14 @@ import (
"gopkg.in/macaron.v1" "gopkg.in/macaron.v1"
) )
func RequestTracing() macaron.Handler { func RequestTracing(handler string) macaron.Handler {
return func(res http.ResponseWriter, req *http.Request, c *macaron.Context) { return func(res http.ResponseWriter, req *http.Request, c *macaron.Context) {
rw := res.(macaron.ResponseWriter) rw := res.(macaron.ResponseWriter)
var span opentracing.Span var span opentracing.Span
tracer := opentracing.GlobalTracer() tracer := opentracing.GlobalTracer()
wireContext, _ := tracer.Extract(opentracing.HTTPHeaders, opentracing.HTTPHeadersCarrier(req.Header)) wireContext, _ := tracer.Extract(opentracing.HTTPHeaders, opentracing.HTTPHeadersCarrier(req.Header))
spanName := fmt.Sprintf("HTTP %s %s", req.Method, req.URL.Path) spanName := fmt.Sprintf("HTTP %s", handler)
span = tracer.StartSpan(spanName, ext.RPCServerOption(wireContext)) span = tracer.StartSpan(spanName, ext.RPCServerOption(wireContext))
defer span.Finish() defer span.Finish()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment