-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
UI: Showed host reservations and allocation utilization by task on existing stats charts #10208
Merged
Merged
Changes from all commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
febecbb
Pass the LineChart named blocks through to callers of StatsTimeSeries
DingoEatingFuzz ce7f6d0
Compute and render reserved annotations for client stats
DingoEatingFuzz d6b72c1
Refactor PrimaryMetric into parts/purposes
DingoEatingFuzz a6a9df5
Simple bind helper
DingoEatingFuzz 8ae7645
Stacked percentages of tasks for alloc charts
DingoEatingFuzz 8ab3014
Sort and index multi-series data correctly in line chart
DingoEatingFuzz d72eaa1
Refactor stats-time-series to allow for multiple series
DingoEatingFuzz 4f27bee
Refactored multi-series allocation variant of the primary metric comp…
DingoEatingFuzz df11688
Memoize the tracker and the series properties to avoid repeat computa…
DingoEatingFuzz 745a55b
Apply the new multi-line primary metric to the alloc index page
DingoEatingFuzz 7b73460
New PrimaryMetric::Task component
DingoEatingFuzz 17cf4ad
Improved language around what the client stat charts represent
DingoEatingFuzz 2953542
Remove now unused chartClass arg from LineChart
DingoEatingFuzz 2ed5b28
Tests for PrimaryMetric::Node
DingoEatingFuzz e3a1106
Tests for PrimaryMetric::Allocation
DingoEatingFuzz ead08e2
Tests for PrimaryMetric::Task
DingoEatingFuzz 91521d6
Updated old tests
DingoEatingFuzz 5191693
Update topology info box primary metric
DingoEatingFuzz b009fc1
Remove old primary metric
DingoEatingFuzz 2b1449c
Use more explicit branching of reserved amounts based on metric type
DingoEatingFuzz ebd91a9
Fix line-wrapping issue with chart tooltips
DingoEatingFuzz 1d8bc39
Guard against empty data when determining active linechart data
DingoEatingFuzz d9426df
Correctly sort tasks in alloc stat tracker so the main task takes pre…
DingoEatingFuzz c15bf65
Remove errant log line
DingoEatingFuzz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
<div data-test-chart-tooltip class="chart-tooltip {{if @active "active" "inactive"}}" style={{@style}} ...attributes> | ||
<ol> | ||
{{#each @data as |props|}} | ||
{{yield props.series props.datum (inc props.index)}} | ||
{{yield props.series props.datum (inc props.index)}} | ||
{{/each}} | ||
</ol> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<div data-test-primary-metric class="primary-metric" ...attributes | ||
{{did-insert this.start}} | ||
{{did-update this.start}}> | ||
<h4 data-test-primary-metric-title class="title is-5"> | ||
{{#if (eq this.metric "cpu")}} CPU | ||
{{else if (eq this.metric "memory")}} Memory | ||
{{else}} {{this.metric}} {{/if}} | ||
</h4> | ||
<div class="primary-graphic"> | ||
<StatsTimeSeries @data={{this.series}} @dataProp="data" > | ||
<:svg as |c|> | ||
{{#each (reverse this.series) as |series idx|}} | ||
<c.Area @data={{series.data}} @colorScale={{this.colorScale}} @index={{idx}} /> | ||
{{/each}} | ||
</:svg> | ||
<:after as |c|> | ||
<c.Tooltip class="is-snappy" as |series datum idx|> | ||
<li> | ||
<span class="label"><span class="color-swatch swatch-{{this.colorScale}} swatch-{{this.colorScale}}-{{idx}}" />{{series.name}}</span> | ||
{{#if (eq this.metric "cpu")}} | ||
<span class="value">{{datum.datum.used}} MHz</span> | ||
{{else if (eq this.metric "memory")}} | ||
<span class="value">{{format-bytes datum.datum.used}}</span> | ||
{{else}} | ||
<span class="value">{{datum.formatttedY}}</span> | ||
{{/if}} | ||
</li> | ||
</c.Tooltip> | ||
</:after> | ||
</StatsTimeSeries> | ||
</div> | ||
<PrimaryMetric::CurrentValue @chartClass={{this.chartClass}} @percent={{this.data.lastObject.percent}} /> | ||
<div class="annotation" data-test-absolute-value> | ||
{{#if (eq this.metric "cpu")}} | ||
<strong>{{this.data.lastObject.used}} MHz</strong> / {{this.reservedAmount}} MHz Total | ||
{{else if (eq this.metric "memory")}} | ||
<strong>{{format-bytes this.data.lastObject.used}}</strong> / {{this.reservedAmount}} MiB Total | ||
{{else}} | ||
<strong>{{this.data.lastObject.used}}</strong> / {{this.reservedAmount}} Total | ||
{{/if}} | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
import Ember from 'ember'; | ||
import Component from '@glimmer/component'; | ||
import { task, timeout } from 'ember-concurrency'; | ||
import { assert } from '@ember/debug'; | ||
import { inject as service } from '@ember/service'; | ||
import { action, get, computed } from '@ember/object'; | ||
|
||
export default class AllocationPrimaryMetric extends Component { | ||
@service('stats-trackers-registry') statsTrackersRegistry; | ||
|
||
/** Args | ||
allocation = null; | ||
metric null; (one of 'cpu' or 'memory' | ||
*/ | ||
|
||
get metric() { | ||
assert('metric is a required argument', this.args.metric); | ||
return this.args.metric; | ||
} | ||
|
||
get allocation() { | ||
return this.args.allocation; | ||
} | ||
|
||
@computed('allocation') | ||
get tracker() { | ||
return this.statsTrackersRegistry.getTracker(this.allocation); | ||
} | ||
|
||
get data() { | ||
if (!this.tracker) return []; | ||
return get(this, `tracker.${this.metric}`); | ||
} | ||
|
||
@computed('tracker.tasks.[]', 'metric') | ||
get series() { | ||
const ret = this.tracker.tasks | ||
.map(task => ({ | ||
name: task.task, | ||
data: task[this.metric], | ||
})) | ||
.reverse(); | ||
|
||
return ret; | ||
} | ||
|
||
get reservedAmount() { | ||
if (this.metric === 'cpu') return this.tracker.reservedCPU; | ||
if (this.metric === 'memory') return this.tracker.reservedMemory; | ||
return null; | ||
} | ||
|
||
get chartClass() { | ||
if (this.metric === 'cpu') return 'is-info'; | ||
if (this.metric === 'memory') return 'is-danger'; | ||
return 'is-primary'; | ||
} | ||
|
||
get colorScale() { | ||
if (this.metric === 'cpu') return 'blues'; | ||
if (this.metric === 'memory') return 'reds'; | ||
return 'ordinal'; | ||
} | ||
|
||
@task(function*() { | ||
do { | ||
this.tracker.poll.perform(); | ||
yield timeout(100); | ||
} while (!Ember.testing); | ||
}) | ||
poller; | ||
|
||
@action | ||
start() { | ||
if (this.tracker) this.poller.perform(); | ||
} | ||
|
||
willDestroy() { | ||
this.poller.cancelAll(); | ||
this.tracker.signalPause.perform(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<div class="columns secondary-graphic"> | ||
<div class="column"> | ||
<div class="inline-chart" data-test-percentage-bar> | ||
<progress | ||
data-test-current-value | ||
class="progress {{@chartClass}} is-small" | ||
value="{{@percent}}" | ||
max="1"> | ||
{{@percent}} | ||
</progress> | ||
</div> | ||
</div> | ||
<div class="column is-minimum"> | ||
<span class="nowrap" data-test-percentage>{{format-percentage @percent total=1}}</span> | ||
</div> | ||
</div> |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I’m not sure what it is but there’s something broken in allocation chart tooltips when I run locally:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm. Looks like this happens for allocs with lifecycle tasks that haven't started yet. Is that when you encountered it too?