move out tracers

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
2020-09-10 00:06:29 +03:00
parent f1fde75567
commit caec730248
12 changed files with 125 additions and 356 deletions

34
tracer/options.go Normal file
View File

@@ -0,0 +1,34 @@
package tracer
type Options struct {
// Size is the size of ring buffer
Size int
}
type Option func(o *Options)
type ReadOptions struct {
// Trace id
Trace string
}
type ReadOption func(o *ReadOptions)
// Read the given trace
func ReadTrace(t string) ReadOption {
return func(o *ReadOptions) {
o.Trace = t
}
}
const (
// DefaultSize of the buffer
DefaultSize = 64
)
// DefaultOptions returns default options
func DefaultOptions() Options {
return Options{
Size: DefaultSize,
}
}