Commit 3c8133aa by bergquist

add traces for datasource reverse proxy requests

parent 8c8fdadb
...@@ -15,6 +15,8 @@ import ( ...@@ -15,6 +15,8 @@ import (
"text/template" "text/template"
"time" "time"
"github.com/opentracing/opentracing-go"
"github.com/grafana/grafana/pkg/api/cloudwatch" "github.com/grafana/grafana/pkg/api/cloudwatch"
"github.com/grafana/grafana/pkg/log" "github.com/grafana/grafana/pkg/log"
"github.com/grafana/grafana/pkg/middleware" "github.com/grafana/grafana/pkg/middleware"
...@@ -85,6 +87,15 @@ func (proxy *DataSourceProxy) HandleRequest() { ...@@ -85,6 +87,15 @@ func (proxy *DataSourceProxy) HandleRequest() {
proxy.logRequest() proxy.logRequest()
span, ctx := opentracing.StartSpanFromContext(proxy.ctx.Req.Context(), "datasource reverse proxy")
proxy.ctx.Req.Request = proxy.ctx.Req.WithContext(ctx)
defer span.Finish()
span.SetTag("datasource_id", proxy.ds.Id)
span.SetTag("datasource_type", proxy.ds.Type)
span.SetTag("user_id", proxy.ctx.SignedInUser.UserId)
span.SetTag("org_id", proxy.ctx.SignedInUser.OrgId)
reverseProxy.ServeHTTP(proxy.ctx.Resp, proxy.ctx.Req.Request) reverseProxy.ServeHTTP(proxy.ctx.Resp, proxy.ctx.Req.Request)
proxy.ctx.Resp.Header().Del("Set-Cookie") proxy.ctx.Resp.Header().Del("Set-Cookie")
} }
......
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