Name | Date | Size | #Lines | LOC | ||
---|---|---|---|---|---|---|
.. | 03-May-2022 | - | ||||
.gitignore | H A D | 19-Jul-2017 | 289 | |||
LICENSE | H A D | 19-Jul-2017 | 1.5 KiB | |||
README.md | H A D | 19-Jul-2017 | 1.6 KiB | |||
glide.yaml | H A D | 19-Jul-2017 | 707 | |||
options.go | H A D | 19-Jul-2017 | 478 | |||
recorder.go | H A D | 19-Jul-2017 | 5.3 KiB | |||
recorder_test.go | H A D | 19-Jul-2017 | 5.2 KiB |
README.md
1[![GoDoc](https://godoc.org/github.com/lovoo/gcloud-opentracing?status.svg)](http://godoc.org/github.com/lovoo/gcloud-opentracing) 2# gcloud-opentracing 3 OpenTracing Tracer implementation for GCloud StackDriver in Go. Based on [basictracer](https://github.com/opentracing/basictracer-go) and implemented `Recorder` for this propose. 4 5### Getting Started 6------------------- 7To install gcloud-opentracing, use `go get`: 8 9```bash 10go get github.com/lovoo/gcloud-opentracing 11``` 12or `govendor`: 13 14```bash 15govendor fetch github.com/lovoo/gcloud-opentracing 16``` 17or other tool for vendoring. 18 19### Sample Usage 20------------------- 21First of all, you need to init Global Tracer with GCloud Tracer: 22```go 23package main 24 25import ( 26 "log" 27 28 trace "cloud.google.com/go/trace/apiv1" 29 gcloudtracer "github.com/lovoo/gcloud-opentracing" 30 opentracing "github.com/opentracing/opentracing-go" 31 basictracer "github.com/opentracing/basictracer-go" 32 "golang.org/x/net/context" 33) 34 35func main() { 36 // ... 37 client, err := trace.NewClient(context.Background() /*auth options here if necessary*/) 38 if err != nil { 39 log.Fatalf("error creating a tracing client: %v", err) 40 } 41 42 recorder, err := gcloudtracer.NewRecorder(context.Background(), "gcp-project-id", client) 43 if err != nil { 44 log.Fatalf("error creating a recorder: %v", err) 45 } 46 defer recorder.Close() 47 48 opentracing.InitGlobalTracer(basictracer.New(recorder)) 49 // ... 50} 51``` 52 53Then you can create traces as decribed [here](https://github.com/opentracing/opentracing-go). More information you can find on [OpenTracing project](http://opentracing.io) website. 54