Declare the environment variable ZIPKIN_URL with the protocol://host:port of the Zipkin collector.
Example: http://127.0.0.1:9411
Otherwise, it will use http://127.0.0.1:9411
as default value.
func Handlers() http.Handler {
r := mux.NewRouter()
tracing.StartTracing("localhost:8080", "users")
r.HandleFunc("/healthcheck", handlers.HealthcheckHandler()).Name("/healthcheck")
return r
}
err := http.ListenAndServe(":8080", tracing.TrackerHandler(Handlers()))
trace := tracing.Trace("My API")
[YOUR CODE]
defer trace.Finish()
parent := tracing.Trace("Other API")
[YOUR CODE]
span := tracing.TraceParent("Get Another API", parent)
defer span.Finish()
defer parent.Finish()