add start time metric

v4
zhuzhao.cx 6 years ago
parent 85952c289c
commit 46e6ccd3eb
  1. 5
      src/redis-shake/common/common.go
  2. 1
      src/redis-shake/main/main.go
  3. 3
      src/redis-shake/metric/variables.go

@ -6,8 +6,8 @@ import(
)
const(
// GolangSecurityTime = "2006-01-02T15:04:05Z"
GolangSecurityTime = "2006-01-02 15:04:05"
GolangSecurityTime = "2006-01-02T15:04:05Z"
// GolangSecurityTime = "2006-01-02 15:04:05"
ReaderBufferSize = bytesize.MB * 32
WriterBufferSize = bytesize.MB * 8
)
@ -15,4 +15,5 @@ const(
var(
Version = "$"
LogRotater *logRotate.Logger
StartTime string
)

@ -81,6 +81,7 @@ func main() {
initFreeOS()
nimo.Profiling(int(conf.Options.SystemProfile))
utils.Welcome()
utils.StartTime = fmt.Sprintf("%v", time.Now().Format(utils.GolangSecurityTime))
if err = utils.WritePidById(conf.Options.Id); err != nil {
crash(fmt.Sprintf("write pid failed. %v", err), -5)

@ -3,9 +3,11 @@ package metric
import(
"fmt"
"redis-shake/base"
"redis-shake/common"
)
type MetricRest struct {
StartTime interface{}
PullCmdCount interface{}
PullCmdCountTotal interface{}
BypassCmdCount interface{}
@ -39,6 +41,7 @@ func NewMetricRest() *MetricRest {
sourceDbOffset := detailedInfo[3]
return &MetricRest{
StartTime: utils.StartTime,
PullCmdCount: MetricVar.GetPullCmdCount(),
PullCmdCountTotal: MetricVar.GetPullCmdCountTotal(),
BypassCmdCount: MetricVar.GetBypassCmdCount(),

Loading…
Cancel
Save