yurishkuro / opentracing-tutorial

A collection of tutorials for the OpenTracing API
Apache License 2.0
1.57k stars 407 forks source link

Set error spans when formatter or publisher not up #66

Closed Amiedeep closed 4 years ago

Amiedeep commented 4 years ago

When either publisher or formatter are not running - the examples doesn't report error span. Reporting error spans is a good feature of Jaeger and should be highlighted in the tutorial. I added error spans for go tutorial for now, if it looks good, I will go ahead and do same for other services, and will update readme as well.

yurishkuro commented 4 years ago

Thanks, this does make sense to add. Should there be a corresponding change in the README files?

Amiedeep commented 4 years ago

I am considering adding a note section after the running instructions on the error span. It could be a separate section or skipped altogether. Thoughts?

yurishkuro commented 4 years ago

I would add a sub-section Handling Errors under Instrumenting the Client, something like this:

Handling Errors

Since we turned our single-binary program into a distributed application that makes remote calls, we need to handle errors that may occur during communications. It is a good practice to tag the span with the tag error=true if the operation represented by this span failed. We use one of the standard helpers defined in the ext package in the OpenTracing API for Go:

    import "github.com/opentracing/opentracing-go/ext"

    resp, err := xhttp.Do(req)
    if err != nil {
        ext.Error.Set(span, true)
        panic(err.Error())
    }
Amiedeep commented 4 years ago

Code pushed for all the services except csharp. I am facing few issues on csharp side and will need some help. @yurishkuro