Skip to content

Commit

Permalink
added a more metrics
Browse files Browse the repository at this point in the history
Signed-off-by: Shashank <shashanksingh819@gmail.com>
  • Loading branch information
moki1202 committed Mar 2, 2023
1 parent f7fef68 commit f5b13a8
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pkg/updater/updater.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,15 @@ const componentName = "updater"
type Metrics struct {
UpdateState metrics.Cyclic
DelaySeconds metrics.Duration
MoreCounter metrics.Counter
}

// CreateMetrics creates metrics for this controller
func CreateMetrics(factory metrics.Factory) *Metrics {
return &Metrics{
UpdateState: factory.NewCyclic(componentName),
DelaySeconds: factory.NewDuration("delay", "Seconds updater is behind schedule", "component"),
MoreCounter: factory.NewCounter("counter", "number of unread columns"),
}
}

Expand Down Expand Up @@ -567,7 +569,7 @@ var (
)

// InflateDropAppend updates groups by downloading the existing grid, dropping old rows and appending new ones.
func InflateDropAppend(ctx context.Context, alog logrus.FieldLogger, client gcs.Client, tg *configpb.TestGroup, gridPath gcs.Path, write bool, readCols ColumnReader, reprocess time.Duration) (bool, error) {
func InflateDropAppend(ctx context.Context, alog logrus.FieldLogger, client gcs.Client, tg *configpb.TestGroup, gridPath gcs.Path, write bool, readCols ColumnReader, reprocess time.Duration, mets *Metrics) (bool, error) {
log := alog.(logrus.Ext1FieldLogger) // Add trace method
ctx, cancel := context.WithCancel(ctx)
defer cancel()
Expand Down Expand Up @@ -731,6 +733,7 @@ func InflateDropAppend(ctx context.Context, alog logrus.FieldLogger, client gcs.
}
if unreadColumns {
log = log.WithField("more", true)
mets.MoreCounter.Add(1)
}
log.WithFields(logrus.Fields{
"cols": len(grid.Columns),
Expand Down

0 comments on commit f5b13a8

Please sign in to comment.