diff --git a/app/lib/components/benchmark_grid.dart b/app/lib/components/benchmark_grid.dart index 9ef4b9fa89..74f948f8e1 100644 --- a/app/lib/components/benchmark_grid.dart +++ b/app/lib/components/benchmark_grid.dart @@ -55,6 +55,7 @@ class BenchmarkGrid implements OnInit, OnDestroy { @Component( selector: 'benchmark-card', template: r''' +{{taskName}}
{{latestValue}} {{unit}} @@ -75,6 +76,7 @@ class BenchmarkCard implements AfterViewInit { } String get id => _data.timeseries.timeseries.id; + String get taskName => _data.timeseries.timeseries.taskName; String get label => _data.timeseries.timeseries.label; String get unit => _data.timeseries.timeseries.unit; String get latestValue { @@ -102,7 +104,7 @@ class BenchmarkCard implements AfterViewInit { for (TimeseriesValue value in _data.values.reversed) { DivElement bar = new DivElement() ..classes.add('metric-value-bar') - ..style.height = '${80 * value.value / maxValue}px'; + ..style.height = '${100 * value.value / maxValue}px'; DivElement tooltip; bar.onMouseOver.listen((_) { diff --git a/app/lib/model.dart b/app/lib/model.dart index e2140b39aa..6c390ae052 100644 --- a/app/lib/model.dart +++ b/app/lib/model.dart @@ -253,6 +253,7 @@ class Timeseries extends Entity { (Map props) => new Timeseries(props), { 'ID': string(), + 'TaskName': string(), 'Label': string(), 'Unit': string(), } @@ -261,6 +262,7 @@ class Timeseries extends Entity { Timeseries([Map props]) : super(_serializer, props); String get id => this['ID']; + String get taskName => this['TaskName']; String get label => this['Label']; String get unit => this['Unit']; } diff --git a/app/web/benchmarks.css b/app/web/benchmarks.css index 0374f8e037..e9bcb62672 100644 --- a/app/web/benchmarks.css +++ b/app/web/benchmarks.css @@ -25,7 +25,7 @@ benchmark-card { display: inline-block; position: relative; width: 250px; - height: 80px; + height: 100px; padding: 0; margin: 5px; @@ -42,7 +42,7 @@ benchmark-card { .metric { position: absolute; - top: 5px; + top: 25px; left: 5px; pointer-events: none; } @@ -72,6 +72,13 @@ benchmark-card { color: #CCC; } +.metric-task-name { + position: absolute; + top: 5px; + left: 5px; + pointer-events: none; +} + .metric-label { position: absolute; bottom: 5px; diff --git a/commands/update_task_status.go b/commands/update_task_status.go index cf55a90146..b62c0ae5b8 100644 --- a/commands/update_task_status.go +++ b/commands/update_task_status.go @@ -74,7 +74,7 @@ func UpdateTaskStatus(c *db.Cocoon, inputJSON []byte) (interface{}, error) { if newStatus == db.TaskSucceeded && len(command.BenchmarkScoreKeys) > 0 { for _, scoreKey := range command.BenchmarkScoreKeys { - series, err := c.GetOrCreateTimeseries(scoreKey) + series, err := c.GetOrCreateTimeseries(task.Task.Name, scoreKey) if err != nil { return nil, err diff --git a/db/db.go b/db/db.go index 24fe77a81d..2111526ea9 100644 --- a/db/db.go +++ b/db/db.go @@ -585,8 +585,9 @@ func (t *Task) AgeInMillis() int64 { // GetOrCreateTimeseries fetches an existing timeseries, or creates and returns // a new one if one with the given scoreKey does not yet exist. -func (c *Cocoon) GetOrCreateTimeseries(scoreKey string) (*TimeseriesEntity, error) { - key := datastore.NewKey(c.Ctx, "Timeseries", scoreKey, 0, nil) +func (c *Cocoon) GetOrCreateTimeseries(taskName string, scoreKey string) (*TimeseriesEntity, error) { + id := fmt.Sprintf("%v.%v", taskName, scoreKey) + key := datastore.NewKey(c.Ctx, "Timeseries", id, 0, nil) series := new(Timeseries) err := datastore.Get(c.Ctx, key, series) @@ -606,7 +607,8 @@ func (c *Cocoon) GetOrCreateTimeseries(scoreKey string) (*TimeseriesEntity, erro // By default use scoreKey as label and "ms" as unit. It can be tweaked // manually later using the datastore UI. series = &Timeseries{ - ID: scoreKey, + ID: id, + TaskName: taskName, Label: scoreKey, Unit: "ms", } diff --git a/db/schema.go b/db/schema.go index 18087d149d..a3a0eadb15 100644 --- a/db/schema.go +++ b/db/schema.go @@ -85,6 +85,8 @@ type Task struct { type Timeseries struct { // Unique ID for computer consumption. ID string + // Name of task that submits values for this series. + TaskName string // A name used to display the series to humans. Label string // The unit used for the values, e.g. "ms", "kg", "pumpkins".