Created
May 20, 2016 22:29
-
-
Save bg451/237700ad2d501776bd823eb31a1f81f1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"time" | |
"golang.org/x/net/context" | |
"github.com/coreos/etcd/clientv3" | |
"github.com/opentracing/opentracing-go" | |
) | |
func main() { | |
cli, err := clientv3.New(clientv3.Config{ | |
Endpoints: []string{"localhost:12379", "localhost:22379", "localhost:32379"}, | |
DialTimeout: 5 * time.Second, | |
}) | |
if err != nil { | |
fmt.Println(err) | |
return | |
} | |
tracer := // Tracer creation goes here. | |
opentracing.InitGlobalTracer(tracer) | |
for { | |
sp, ctx := opentracing.StartSpanFromContext(context.Background(), "arbritraryWork") | |
time.Sleep(200 * time.Millisecond) | |
resp, err := cli.KV.Put(ctx, "sample_key", "sample_value") | |
if err != nil { | |
fmt.Println("swag") | |
} | |
fmt.Println(resp) | |
time.Sleep(time.Millisecond * 100) | |
sp.Finish() | |
} | |
defer cli.Close() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment