mirror of
https://github.com/fnproject/fn.git
synced 2022-10-28 21:29:17 +03:00
created metrics func
This commit is contained in:
27
api/runner/metrics.go
Normal file
27
api/runner/metrics.go
Normal file
@@ -0,0 +1,27 @@
|
||||
package runner
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/Sirupsen/logrus"
|
||||
titancommon "github.com/iron-io/titan/common"
|
||||
"golang.org/x/net/context"
|
||||
)
|
||||
|
||||
func LogMetricGauge(ctx context.Context, name string, value int) {
|
||||
log := titancommon.Logger(ctx)
|
||||
log.WithFields(logrus.Fields{
|
||||
"metric": name, "type": "count", "value": value}).Info()
|
||||
}
|
||||
|
||||
func LogMetricCount(ctx context.Context, name string, value int) {
|
||||
log := titancommon.Logger(ctx)
|
||||
log.WithFields(logrus.Fields{
|
||||
"metric": name, "type": "count", "value": value}).Info()
|
||||
}
|
||||
|
||||
func LogMetricTime(ctx context.Context, name string, time time.Duration) {
|
||||
log := titancommon.Logger(ctx)
|
||||
log.WithFields(logrus.Fields{
|
||||
"metric": name, "type": "time", "value": time}).Info()
|
||||
}
|
||||
Reference in New Issue
Block a user