From 46e6ccd3eb4de6c5cebed527d7097463c5a89810 Mon Sep 17 00:00:00 2001 From: "zhuzhao.cx" Date: Tue, 19 Mar 2019 21:27:45 +0800 Subject: [PATCH] add start time metric --- src/redis-shake/common/common.go | 5 +++-- src/redis-shake/main/main.go | 1 + src/redis-shake/metric/variables.go | 3 +++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/redis-shake/common/common.go b/src/redis-shake/common/common.go index 7fed11f..6bfd69f 100644 --- a/src/redis-shake/common/common.go +++ b/src/redis-shake/common/common.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 ) \ No newline at end of file diff --git a/src/redis-shake/main/main.go b/src/redis-shake/main/main.go index 6b2456b..373584f 100644 --- a/src/redis-shake/main/main.go +++ b/src/redis-shake/main/main.go @@ -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) diff --git a/src/redis-shake/metric/variables.go b/src/redis-shake/metric/variables.go index e9969b4..619e7d3 100644 --- a/src/redis-shake/metric/variables.go +++ b/src/redis-shake/metric/variables.go @@ -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(),