Skip to content

Commit

Permalink
tweak librato event names
Browse files Browse the repository at this point in the history
  • Loading branch information
nicpottier committed Sep 21, 2018
1 parent 530b4fa commit 5356ee2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
3 changes: 2 additions & 1 deletion campaigns/cron.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,8 @@ func fireCampaignEvents(ctx context.Context, db *sqlx.DB, rp *redis.Pool, lockNa
return errors.Annotatef(err, "error queueing task")
}

librato.Gauge("mr.campaign_event_queue", float64(time.Since(start)))
librato.Gauge("mr.campaign_event_cron_elapsed", float64(time.Since(start)/time.Second))
librato.Gauge("mr.campaign_event_cron_count", float64(queued))
log.WithField("elapsed", time.Since(start)).WithField("queued", queued).Info("campaign event fire queuing complete")
return nil
}
Expand Down
14 changes: 5 additions & 9 deletions runner/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,8 @@ func FireCampaignEvent(
}

// log both our total and average
librato.Gauge("mr.campaign_event_batch", float64(time.Since(start)))
if len(sessions) > 0 {
librato.Gauge("mr.campaign_event_avg", float64(time.Since(start))/float64(len(sessions)))
}
librato.Gauge("mr.campaign_event_elapsed", float64(time.Since(start)/time.Second))
librato.Gauge("mr.campaign_event_count", float64(len(sessions)))

return sessions, nil
}
Expand All @@ -100,7 +98,7 @@ func StartFlow(ctx context.Context, db *sqlx.DB, rp *redis.Pool, org *models.Org
logrus.WithField("contact_id", trigger.Contact().ID()).WithError(err).Errorf("error starting flow: %s", trigger.Flow().UUID)
continue
}
librato.Gauge("mr.flow_start_execution", float64(time.Since(start)))
librato.Gauge("mr.flow_start_elapsed", float64(time.Since(start)))

sessions = append(sessions, session)
}
Expand Down Expand Up @@ -177,10 +175,8 @@ func StartFlow(ctx context.Context, db *sqlx.DB, rp *redis.Pool, org *models.Org
}

// figure out both average and total for total execution and commit time for our flows
librato.Gauge("mr.flow_start_batch", float64(time.Since(start)))
if len(dbSessions) > 0 {
librato.Gauge("mr.flow_start_avg", float64(time.Since(start))/float64(len(dbSessions)))
}
librato.Gauge("mr.flow_start_elapsed", float64(time.Since(start)/time.Second))
librato.Gauge("mr.flow_start_count", float64(len(dbSessions)))

return dbSessions, nil
}
Expand Down

0 comments on commit 5356ee2

Please sign in to comment.