return t.complete() && t.duration() <= lat
})
}
+ if text := r.FormValue("logtext"); text != "" {
+ name = append(name, fmt.Sprintf("log contains %q", text))
+ conditions = append(conditions, func(t *taskDesc) bool {
+ return taskMatches(t, text)
+ })
+ }
return &taskFilter{name: strings.Join(name, ","), cond: conditions}, nil
}
+func taskMatches(t *taskDesc, text string) bool {
+ for _, ev := range t.events {
+ switch ev.Type {
+ case trace.EvUserTaskCreate, trace.EvUserSpan, trace.EvUserLog:
+ for _, s := range ev.SArgs {
+ if strings.Contains(s, text) {
+ return true
+ }
+ }
+ }
+ }
+ return false
+}
+
type durationHistogram struct {
Count int
Buckets []int
</style>
<body>
+Search log text: <form action="/usertask"><input name="logtext" type="text"><input type="submit"></form><br>
<table border="1" sortable="1">
<tr>
<th>Task type</th>
<h2>User Task: {{.Name}}</h2>
+Search log text: <form onsubmit="window.location.search+='&logtext='+window.logtextinput.value; return false">
+<input name="logtext" id="logtextinput" type="text"><input type="submit">
+</form><br>
+
<table id="reqs">
<tr><th>When</th><th>Elapsed</th><th>Goroutine ID</th><th>Events</th></tr>
{{range $el := $.Entry}}