* wip: backup * wip: backup * wip: backup * backup * backup * backup * add more tests * fix wrong dependency * fix lint errors * remove test due to data race * add tests * fix test error * add mon.Model * add mon.Model unmarshal * add monc * add more tests for monc * add more tests for monc * add docs for mon and monc packages * fix doc errors * chhore: add comment * chore: fix test bug * chore: refine tests * chore: remove primitive.NewObjectID in test code * chore: rename test files for typo
30 lines
496 B
Go
30 lines
496 B
Go
package mon
|
|
|
|
import (
|
|
"time"
|
|
|
|
"github.com/zeromicro/go-zero/core/syncx"
|
|
)
|
|
|
|
var slowThreshold = syncx.ForAtomicDuration(defaultSlowThreshold)
|
|
|
|
type (
|
|
options struct {
|
|
timeout time.Duration
|
|
}
|
|
|
|
// Option defines the method to customize a mongo model.
|
|
Option func(opts *options)
|
|
)
|
|
|
|
// SetSlowThreshold sets the slow threshold.
|
|
func SetSlowThreshold(threshold time.Duration) {
|
|
slowThreshold.Set(threshold)
|
|
}
|
|
|
|
func defaultOptions() *options {
|
|
return &options{
|
|
timeout: defaultTimeout,
|
|
}
|
|
}
|