update service latency metric upon ws data
This commit is contained in:
parent
7ec0ff79f8
commit
155f96c218
1 changed files with 12 additions and 14 deletions
|
@ -51,18 +51,23 @@ export default class App extends Component {
|
||||||
|
|
||||||
const [, name] = channel.split(':');
|
const [, name] = channel.split(':');
|
||||||
|
|
||||||
|
log('updating from channel:', channel);
|
||||||
|
|
||||||
const { metrics } = this.state;
|
const { metrics } = this.state;
|
||||||
const graph = metrics.graph[name].slice(1);
|
const graph = metrics.graph[name].slice(1);
|
||||||
const newGraph = [data, ...graph];
|
const newGraph = [data, ...graph];
|
||||||
|
|
||||||
log('adding data:', data);
|
log('adding data:', data);
|
||||||
|
|
||||||
this.setState((prevState, _props) => {
|
this.setState(({ metrics: oldMetrics }, _props) => {
|
||||||
const clone = Object.assign({}, prevState.metrics);
|
const newMetrics = { ...oldMetrics };
|
||||||
clone.graph[name] = newGraph;
|
newMetrics.graph[name] = newGraph;
|
||||||
|
|
||||||
|
const [, latency] = data;
|
||||||
|
newMetrics.status[name].latency = latency;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
metrics: clone,
|
metrics: newMetrics,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -128,19 +133,12 @@ export default class App extends Component {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="dashboard">
|
<div className="dashboard">
|
||||||
<h1>
|
<h1>elstatus</h1>
|
||||||
elstatus
|
|
||||||
</h1>
|
|
||||||
{this.state.loading ? (
|
{this.state.loading ? (
|
||||||
<div>
|
<div>Loading metrics...</div>
|
||||||
Loading metrics...
|
|
||||||
</div>
|
|
||||||
) : null}
|
) : null}
|
||||||
{this.state.error ? (
|
{this.state.error ? (
|
||||||
<div>
|
<div>Error: {this.state.error}</div>
|
||||||
Error:
|
|
||||||
{this.state.error}
|
|
||||||
</div>
|
|
||||||
) : null}
|
) : null}
|
||||||
{metrics}
|
{metrics}
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in a new issue