gotracer provides emitters for Sysdig tracers.
Auto-generated span identifiers:
func myFunc() {
spanID, err := tracers.Start("mytag")
handleErr(err)
defer tracers.End("mytag", spanID)
...
}
Custom span identifiers:
func myFunc(uniqueId uint64) {
err := tracers.StartInt("mytag", uniqueId)
handleErr(err)
defer tracers.End("mytag", uniqueId)
...
}
func myFunc(uniqueId string) {
spanID, err := tracers.StartStr("mytag", uniqueId)
handleErr(err)
defer tracers.End("mytag", spanID)
...
}
BenchmarkStart-8 3000000 386 ns/op 32 B/op 1 allocs/op
BenchmarkStartInt-8 5000000 329 ns/op 16 B/op 1 allocs/op
BenchmarkStartStr-8 3000000 523 ns/op 88 B/op 3 allocs/op
BenchmarkEnd-8 5000000 363 ns/op 16 B/op 1 allocs/op