Skip to content

Commit

Permalink
Add timestamps during bulk/live load (#3287)
Browse files Browse the repository at this point in the history
* Add timetamp to load logs to make it easier to correlate to server logs.

* Add timezone to timestamp since client and server may be using different ones.
  • Loading branch information
codexnull authored Apr 18, 2019
1 parent c89560b commit b11cac2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
10 changes: 7 additions & 3 deletions dgraph/cmd/bulk/progress.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,16 @@ func (p *progress) report() {

func (p *progress) reportOnce() {
mapEdgeCount := atomic.LoadInt64(&p.mapEdgeCount)
timestamp := time.Now().Format("15:04:05Z0700")
switch phase(atomic.LoadInt32((*int32)(&p.phase))) {
case nothing:
case mapPhase:
rdfCount := atomic.LoadInt64(&p.nquadCount)
errCount := atomic.LoadInt64(&p.errCount)
elapsed := time.Since(p.start)
fmt.Printf("MAP %s nquad_count:%s err_count:%s nquad_speed:%s/sec edge_count:%s edge_speed:%s/sec\n",
fmt.Printf("[%s] MAP %s nquad_count:%s err_count:%s nquad_speed:%s/sec "+
"edge_count:%s edge_speed:%s/sec\n",
timestamp,
x.FixedDuration(elapsed),
niceFloat(float64(rdfCount)),
niceFloat(float64(errCount)),
Expand All @@ -101,10 +104,11 @@ func (p *progress) reportOnce() {
reduceEdgeCount := atomic.LoadInt64(&p.reduceEdgeCount)
pct := ""
if mapEdgeCount != 0 {
pct = fmt.Sprintf("[%.2f%%] ", 100*float64(reduceEdgeCount)/float64(mapEdgeCount))
pct = fmt.Sprintf("%.2f%% ", 100*float64(reduceEdgeCount)/float64(mapEdgeCount))
}
fmt.Printf("REDUCE %s %sedge_count:%s edge_speed:%s/sec "+
fmt.Printf("[%s] REDUCE %s %sedge_count:%s edge_speed:%s/sec "+
"plist_count:%s plist_speed:%s/sec\n",
timestamp,
x.FixedDuration(now.Sub(p.start)),
pct,
niceFloat(float64(reduceEdgeCount)),
Expand Down
5 changes: 3 additions & 2 deletions dgraph/cmd/live/batch.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,9 @@ func (l *loader) printCounters() {
counter := l.Counter()
rate := float64(counter.Nquads-last.Nquads) / period.Seconds()
elapsed := time.Since(start).Round(time.Second)
fmt.Printf("[%6s] Txns: %d N-Quads: %d N-Quads/s [last 5s]: %5.0f Aborts: %d\n",
elapsed, counter.TxnsDone, counter.Nquads, rate, counter.Aborts)
timestamp := time.Now().Format("15:04:05Z0700")
fmt.Printf("[%s] Elapsed: %s Txns: %d N-Quads: %d N-Quads/s [last 5s]: %5.0f Aborts: %d\n",
timestamp, x.FixedDuration(elapsed), counter.TxnsDone, counter.Nquads, rate, counter.Aborts)
last = counter
}
}
Expand Down

0 comments on commit b11cac2

Please sign in to comment.