Skip to content

Commit

Permalink
o/state,timings: fix some cosmetics (thanks @bboozzoo)
Browse files Browse the repository at this point in the history
  • Loading branch information
pedronis committed Mar 19, 2020
1 parent 617b09f commit ca0e358
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
6 changes: 5 additions & 1 deletion overlord/state/timings.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,11 @@ import (
// Returned Timings tree has "task-id", "change-id" and "task-kind"
// tags set automatically from the respective task.
func TimingsForTask(task *Task) *timings.Timings {
tags := map[string]string{"task-id": task.ID(), "task-kind": task.Kind(), "task-status": task.Status().String()}
tags := map[string]string{
"task-id": task.ID(),
"task-kind": task.Kind(),
"task-status": task.Status().String(),
}
if chg := task.Change(); chg != nil {
tags["change-id"] = chg.ID()
}
Expand Down
6 changes: 4 additions & 2 deletions timings/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,11 @@ func (t *Timings) Save(s GetSaver) {
s.SaveTimings(stateTimings)
}

// Get returns timings for which filter predicate is true and filters out nested timings whose level is greater than maxLevel.
// Get returns timings for which filter predicate is true and filters
// out nested timings whose level is greater than maxLevel.
// Negative maxLevel value disables filtering by level.
// If GetSaver is a state.State, it's responsibility of the caller to lock the state before calling this function.
// If GetSaver is a state.State, it's responsibility of the caller to
// lock the state before calling this function.
func Get(s GetSaver, maxLevel int, filter func(tags map[string]string) bool) ([]*TimingsInfo, error) {
var stateTimings []rootTimingsJSON
if err := s.GetMaybeTimings(&stateTimings); err != nil {
Expand Down

0 comments on commit ca0e358

Please sign in to comment.