If ochttp.NewSpanAnnotator is used, I cannot see any outgoing spans in the trace. I was expecting to see a client span with some annotations representing the networking events.
Program to reproduce:
// Package contains a small demo that records
// network event details as a part of HTTP traces.
package main
import (
"fmt"
"log"
"net/http"
"contrib.go.opencensus.io/exporter/stackdriver"
"contrib.go.opencensus.io/exporter/stackdriver/propagation"
"go.opencensus.io/plugin/ochttp"
"go.opencensus.io/trace"
"go.opencensus.io/zpages"
)
func main() {
se, err := stackdriver.NewExporter(stackdriver.Options{
ProjectID: "bamboo-shift-504",
})
if err != nil {
log.Fatal(err)
}
trace.RegisterExporter(se)
client := &http.Client{
Transport: &ochttp.Transport{
NewClientTrace: ochttp.NewSpanAnnotator,
},
}
mux := http.NewServeMux()
zpages.Handle(mux, "/debug")
mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
req, _ := http.NewRequest("GET", "http://google.com", nil)
req = req.WithContext(r.Context())
client.Do(req)
fmt.Fprint(w, "Welcome!")
})
http.ListenAndServe(":8080", &ochttp.Handler{
Handler: mux,
Propagation: &propagation.HTTPFormat{},
StartOptions: trace.StartOptions{
Sampler: trace.AlwaysSample(),
},
})
}
If ochttp.NewSpanAnnotator is used, I cannot see any outgoing spans in the trace. I was expecting to see a client span with some annotations representing the networking events.
Program to reproduce:
/cc @basvanbeek