• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

.gitignoreH A D19-Jul-2017289

LICENSEH A D19-Jul-20171.5 KiB

README.mdH A D19-Jul-20171.6 KiB

glide.yamlH A D19-Jul-2017707

options.goH A D19-Jul-2017478

recorder.goH A D19-Jul-20175.3 KiB

recorder_test.goH A D19-Jul-20175.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