Skip to content

Commit 42b27f1

Browse files
feat:added recovery counter (#5124)
* added recovery counter * updated common lib commit * go mod updated * updted common lib commit --------- Co-authored-by: ShashwatDadhich <dadhichshashwat1808@gmail.com>
1 parent c85c9b6 commit 42b27f1

File tree

9 files changed

+7
-1
lines changed

9 files changed

+7
-1
lines changed

util/cron/CronLogger.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,12 @@ package cron
22

33
import (
44
"github.com/devtron-labs/common-lib/constants"
5+
"github.com/devtron-labs/common-lib/pubsub-lib/metrics"
56
"go.uber.org/zap"
67
)
78

9+
const PANIC = "panic"
10+
811
type CronLoggerImpl struct {
912
logger *zap.SugaredLogger
1013
}
@@ -14,6 +17,9 @@ func (impl *CronLoggerImpl) Info(msg string, keysAndValues ...interface{}) {
1417
}
1518

1619
func (impl *CronLoggerImpl) Error(err error, msg string, keysAndValues ...interface{}) {
20+
if msg == PANIC {
21+
metrics.IncPanicRecoveryCount("cron", "", "", "")
22+
}
1723
keysAndValues = append([]interface{}{"err", err}, keysAndValues...)
1824
impl.logger.Errorw(constants.PanicLogIdentifier+": "+msg, keysAndValues...)
1925
}

wire_gen.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)