Search code examples
google-cloud-stackdriveropencensus

Not able populating the method and etc for Stackdriver Trace


I am new to Stackdriver Trace. I am not sure what I am doing wrong if can somebody point me to right direction. I would really appreciate. Basicall I am not able populate methods and such from Request

        ...
        var ctx context.Context
        var span *trace.Span
        if sc, ok := hf.SpanContextFromRequest(r); ok {
            ctx, span = trace.StartSpanWithRemoteParent(r.Context(), "internal.platform.web", sc)
        } else {
            ctx, span = trace.StartSpan(r.Context(), "internal.platform.web")
        }
        defer span.End()
        ...
        ...

Here is what I see at Dashboard View.

enter image description here

I can see my midleware can logging.

2019/02/17 20:39:41.976194 logger.go:25: 277f1b2d7d870603d5693333e7594a81 : (200) : GET /dev/v1/health -> 10.28.0.1:60580 (127.269µs)
2019/02/17 20:39:45.148052 logger.go:25: 98efb55e9c5dc093e107cf356668099a : (200) : GET /dev/v1/health -> 10.28.0.1:44956 (93.801µs)
2019/02/17 20:40:58.019661 logger.go:25: 1b714a54e80cef85bec6c5b65d25cebb : (200) : GET /dev/v1/health -> 10.28.0.1:49086 (99.875µs)
2019/02/17 20:41:29.917161 logger.go:25: 0826c046716a1f333eab9d1c762e1561 : (200) : GET /dev/v1/health -> 10.28.0.1:52910 (98.377µs)
2019/02/17 20:42:11.988756 logger.go:25: 6870a9ea2cac0493aab1e472ce895bbf : (200) : GET /dev/v1/health -> 10.28.0.1:57362 (113.634µs)
2019/02/17 20:42:15.165058 logger.go:25: f7b77d80452ae686f15001e663187004 : (200) : GET /dev/v1/health -> 10.28.0.1:42420 (142.178µs)

Solution

  • Apparently, I need to use ochttp plugin for OpenCensus instrumentation for net/http package. That covers all attributes on the span.