data insertion v2 electric boogaloo
This commit is contained in:
parent
7cd549c46b
commit
637a06e985
1 changed files with 6 additions and 2 deletions
|
@ -72,11 +72,15 @@ export default class App extends Component {
|
||||||
|
|
||||||
handleLatency (name, data) {
|
handleLatency (name, data) {
|
||||||
const { metrics } = this.state
|
const { metrics } = this.state
|
||||||
const graph = metrics.graph[name].slice(1)
|
|
||||||
const newGraph = [data, ...graph]
|
|
||||||
|
|
||||||
log('adding latency entry:', data)
|
log('adding latency entry:', data)
|
||||||
|
|
||||||
|
// latency entries come in newest to oldest, so remove the oldest entry
|
||||||
|
const graph = metrics.graph[name].slice(0, metrics.graph[name].length - 1)
|
||||||
|
|
||||||
|
// make new data come in first
|
||||||
|
const newGraph = [data, ...graph]
|
||||||
|
|
||||||
this.setState(({ metrics: old }, _props) => {
|
this.setState(({ metrics: old }, _props) => {
|
||||||
const metrics = { ...old }
|
const metrics = { ...old }
|
||||||
metrics.graph[name] = newGraph
|
metrics.graph[name] = newGraph
|
||||||
|
|
Loading…
Reference in a new issue