Package list golang-github-go-kit-kit / 8df4980
[WiP] tracing/opentracing: bugfixes Bas van Beek 5 years ago
2 changed file(s) with 10 addition(s) and 12 deletion(s). Raw diff Collapse all Expand all
1919 return func(ctx context.Context, md *metadata.MD) context.Context {
2020 if span := opentracing.SpanFromContext(ctx); span != nil {
2121 // There's nothing we can do with an error here.
22 err := tracer.Inject(span, opentracing.TextMap, metadataReaderWriter{md})
23 if err != nil && logger != nil {
24 logger.Log("msg", "Inject failed", "err", err)
22 if err := tracer.Inject(span, opentracing.TextMap, metadataReaderWriter{md}); err != nil {
23 logger.Log("err", err)
2524 }
2625 }
2726 return ctx
4039 span, err := tracer.Join(operationName, opentracing.TextMap, metadataReaderWriter{md})
4140 if err != nil {
4241 span = tracer.StartSpan(operationName)
43 if logger != nil {
44 logger.Log("msg", "Join failed", "err", err)
42 if err != opentracing.ErrTraceNotFound {
43 logger.Log("err", err)
4544 }
4645 }
4746 return opentracing.ContextWithSpan(ctx, span)
2626 host, portString, err := net.SplitHostPort(req.URL.Host)
2727 if err == nil {
2828 ext.PeerHostname.Set(span, host)
29 if port, err := strconv.Atoi(portString); err != nil {
29 if port, _ := strconv.Atoi(portString); err != nil {
3030 ext.PeerPort.Set(span, uint16(port))
3131 }
3232 } else {
3434 }
3535
3636 // There's nothing we can do with any errors here.
37 err = tracer.Inject(
37 if err = tracer.Inject(
3838 span,
3939 opentracing.TextMap,
4040 opentracing.HTTPHeaderTextMapCarrier(req.Header),
41 )
42 if err != nil && logger != nil {
43 logger.Log("msg", "Join failed", "err", err)
41 ); err != nil {
42 logger.Log("err", err)
4443 }
4544 }
4645 return ctx
6463 )
6564 if err != nil {
6665 span = tracer.StartSpan(operationName)
67 if logger != nil {
68 logger.Log("msg", "Join failed", "err", err)
66 if err != opentracing.ErrTraceNotFound {
67 logger.Log("err", err)
6968 }
7069 }
7170 return opentracing.ContextWithSpan(ctx, span)