Wiring new context with initial span

This commit is contained in:
Denis Makogon
2017-09-06 21:55:52 +03:00
parent 9a89366d1b
commit 57a577dfc9
2 changed files with 5 additions and 4 deletions

View File

@@ -223,7 +223,8 @@ func (a *agent) Submit(callI Call) error {
a.stats.Complete() a.stats.Complete()
// TODO if the context is timed out here we need to allocate new one // TODO if the context is timed out here we need to allocate new one
call.End(context.Background(), err) ctx = opentracing.ContextWithSpan(context.Background(), span)
call.End(ctx, err)
return err return err
} }

View File

@@ -103,10 +103,10 @@ func FromRequest(appName, path string, req *http.Request) CallOpt {
envVars[toEnvName("PARAM", param.Key)] = param.Value envVars[toEnvName("PARAM", param.Key)] = param.Value
} }
headerVars := make(map[string]string,len(req.Header)) headerVars := make(map[string]string, len(req.Header))
for k, v := range req.Header { for k, v := range req.Header {
headerVars[toEnvName("HEADER",k)] = strings.Join(v, ", ") headerVars[toEnvName("HEADER", k)] = strings.Join(v, ", ")
} }
// add all the env vars we build to the request headers // add all the env vars we build to the request headers
@@ -115,7 +115,7 @@ func FromRequest(appName, path string, req *http.Request) CallOpt {
req.Header.Add(k, v) req.Header.Add(k, v)
} }
for k,v := range headerVars { for k, v := range headerVars {
envVars[k] = v envVars[k] = v
} }