Skip to content
This repository has been archived by the owner on Oct 29, 2021. It is now read-only.

Commit

Permalink
Merge pull request #116 from chris-ramon/d3timeline-improvements
Browse files Browse the repository at this point in the history
Adds emptiness time checking.
  • Loading branch information
slimsag committed Mar 15, 2016
2 parents f35f982 + 6f70b13 commit 6900838
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
6 changes: 5 additions & 1 deletion traceapp/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@ import (
"errors"
htmpl "html/template"
"io/ioutil"
"log"
"net/http"
"net/url"
"os"
"path"
"sort"
"strings"
Expand All @@ -39,6 +41,8 @@ type App struct {

tmplLock sync.Mutex
tmpls map[string]*htmpl.Template

Log *log.Logger
}

// New creates a new application handler. If r is nil, a new router is
Expand All @@ -48,7 +52,7 @@ func New(r *Router) *App {
r = NewRouter(nil)
}

app := &App{Router: r}
app := &App{Router: r, Log: log.New(os.Stderr, "appdash: ", log.LstdFlags)}

r.r.Get(RootRoute).Handler(handlerFunc(app.serveRoot))
r.r.Get(TraceRoute).Handler(handlerFunc(app.serveTrace))
Expand Down
9 changes: 9 additions & 0 deletions traceapp/vis.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,15 @@ func (a *App) d3timelineInner(t *appdash.Trace, depth int) ([]timelineItem, erro
}
for _, e := range events {
if e, ok := e.(appdash.TimespanEvent); ok {
// Continue to next iteration
// if e.Start() or e.End() are empty time values.
if e.Start() == (time.Time{}) || e.End() == (time.Time{}) {
if a.Log != nil {
a.Log.Printf("Found a TimespanEvent: %+v with invalid/zero times.", e)
}
// Continuing so frontend does not break due to current event missing start/end time values.
continue
}
start := e.Start().UnixNano() / int64(time.Millisecond)
end := e.End().UnixNano() / int64(time.Millisecond)
ts := timelineItemTimespan{
Expand Down

0 comments on commit 6900838

Please sign in to comment.