Documentation
¶
Overview ¶
Package sysdigtracers let you add easily sysdig tracers (https://github.com/draios/sysdig/wiki/Tracers) in your Go code.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Tracer ¶
type Tracer struct {
Id string // Id string should be a 64bit integer or t, p, pp or empty (see: https://github.com/draios/sysdig/wiki/Tracers#fields-explanation).
Tags string // Tags string should be a list of one or more strings separated by periods. if empty, name of caller function is set.
Args string // Args string is a list of key-value pairs to be associated with the tracer (optionnal).
}
Tracer represents a tracer
func Entry ¶
Entry emits an entry event in /dev/null and returns a tracer struct. id and elements can be empty strings. first string in elements will be used as tags, other strings will be arguments. if elements is empty (no tag), name of caller function is set.
Example ¶
Idiomatic way to add a tracer.
package main
import (
"sysdigtracers"
)
func main() {
t := sysdigtracers.Entry("id", "tags", "args")
defer t.Exit("args")
}
Example (Goroutine) ¶
Add a tracer in a sublevel goroutine.
package main
import (
"sysdigtracers"
)
func main() {
//... some stuff ...
t := sysdigtracers.Entry("", "root")
go func() {
u := sysdigtracers.Entry("", "root.goroutine")
defer u.Exit()
//... some stuff ...
}()
t.Exit()
//... some stuff ...
}
Example (Other) ¶
Add a tracer anywhere.
package main
import (
"sysdigtracers"
)
func main() {
//... some stuff ...
t := sysdigtracers.Entry("", "")
//... some stuff ...
t.Exit()
//... some stuff ...
}
Click to show internal directories.
Click to hide internal directories.