Skip to content

tkanos/go-tracing

 
 

Repository files navigation

GO-TRACING

Build Status Coverage Status

Go-tracing provides an easy way to use zipkin tracing with only four lines of code.

Quick start

// import the library
import "github.com/ricardo-ch/go-tracing"

// set your tracer
tracing.SetGlobalTracer(appName, "{zipkin_url}")
defer tracing.FlushCollector()

// define a trace
span, ctx := tracing.CreateSpan(ctx, "{span_name}", nil)
defer span.Finish()

Examples

docker run -d -p 9411:9411 openzipkin/zipkin
go run examples/basic/main.go
go run examples/httpServer/main.go
go run examples/httpServer-middleware/main.go
go run examples/httpGoKit-middleware/main.go

To watch traces you just have to hit http://localhost:9411/

Features

  • Create span from nothing
  • Create span from context
  • Extract/Inject span from/to httpRequest
  • Extract/Inject span from/to a map[string]string (textMapCarrier)
  • Declare an error span

License

go-tracing is licensed under the MIT license. (http://opensource.org/licenses/MIT)

Contributing

Pull requests are the way to help us here. We will be really grateful.

About

It's easy to use zipkin tracing in go

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 98.2%
  • Makefile 1.8%