Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion app/lib/components/benchmark_grid.dart
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ class BenchmarkGrid implements OnInit, OnDestroy {
@Component(
selector: 'benchmark-card',
template: r'''
<span class="metric-task-name">{{taskName}}</span>
<div class="metric" *ngIf="latestValue != null">
<span class="metric-value">{{latestValue}}</span>
<span class="metric-unit">{{unit}}</span>
Expand All @@ -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 {
Expand Down Expand Up @@ -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((_) {
Expand Down
2 changes: 2 additions & 0 deletions app/lib/model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,7 @@ class Timeseries extends Entity {
(Map<String, dynamic> props) => new Timeseries(props),
<String, JsonSerializer>{
'ID': string(),
'TaskName': string(),
'Label': string(),
'Unit': string(),
}
Expand All @@ -261,6 +262,7 @@ class Timeseries extends Entity {
Timeseries([Map<String, dynamic> props]) : super(_serializer, props);

String get id => this['ID'];
String get taskName => this['TaskName'];
String get label => this['Label'];
String get unit => this['Unit'];
}
Expand Down
11 changes: 9 additions & 2 deletions app/web/benchmarks.css
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ benchmark-card {
display: inline-block;
position: relative;
width: 250px;
height: 80px;
height: 100px;
padding: 0;
margin: 5px;

Expand All @@ -42,7 +42,7 @@ benchmark-card {

.metric {
position: absolute;
top: 5px;
top: 25px;
left: 5px;
pointer-events: none;
}
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion commands/update_task_status.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 5 additions & 3 deletions db/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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",
}
Expand Down
2 changes: 2 additions & 0 deletions db/schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -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".
Expand Down