https://github.com/ricardo-ch/go-tracing
Easy to use tracing with zipkin or jaeger tracing in golang
https://github.com/ricardo-ch/go-tracing
go tracing zipkin
Last synced: 6 months ago
JSON representation
Easy to use tracing with zipkin or jaeger tracing in golang
- Host: GitHub
- URL: https://github.com/ricardo-ch/go-tracing
- Owner: ricardo-ch
- License: mit
- Created: 2017-08-09T12:46:01.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2020-06-12T08:01:42.000Z (about 6 years ago)
- Last Synced: 2025-08-13T22:31:14.353Z (11 months ago)
- Topics: go, tracing, zipkin
- Language: Go
- Homepage:
- Size: 52.7 KB
- Stars: 33
- Watchers: 31
- Forks: 6
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# GO-TRACING
[](https://travis-ci.org/ricardo-ch/go-tracing)
[](https://coveralls.io/github/ricardo-ch/go-tracing?branch=master)
[](https://goreportcard.com/report/github.com/ricardo-ch/go-tracing)
Go-tracing provides an easy way to use jeager tracing with only four lines of code.
## Quick start
```golang
// 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
```
make run-jaeger
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:16686/search
Examples declare the envar they need in the code (e.g.: `os.Setenv("JAEGER_AGENT_HOST", "localhost")`), but technically,
if using jaeger you are supposed to properly declare envar outside of the code. See list [there](https://github.com/jaegertracing/jaeger-client-go#environment-variables)
## 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.