merge graph timestamps into single array, use seconds
This commit is contained in:
15
lib/app.js
15
lib/app.js
@ -41,18 +41,19 @@ class App {
|
||||
if (config.logToDatabase) {
|
||||
client.on('message', (message) => {
|
||||
if (message === 'requestHistoryGraph') {
|
||||
// Send historical graphData built from all serverRegistrations
|
||||
const graphData = {}
|
||||
// FIXME: update schema, remove timestamp
|
||||
// Since all history graph updates share timestamps, pull the timestamps from a single ServerRegistration
|
||||
const timestamps = this.serverRegistrations[0].graphData.map(point => Math.floor(point[0] / 1000))
|
||||
|
||||
this.serverRegistrations.forEach((serverRegistration) => {
|
||||
graphData[serverRegistration.serverId] = serverRegistration.graphData
|
||||
})
|
||||
// Send historical graphData built from all serverRegistrations
|
||||
const graphData = this.serverRegistrations.map(serverRegistration => serverRegistration.graphData.map(point => point[1]))
|
||||
|
||||
// Send graphData in object wrapper to avoid needing to explicity filter
|
||||
// any header data being appended by #MessageOf since the graph data is fed
|
||||
// directly into the graphing system
|
||||
client.send(MessageOf('historyGraph', {
|
||||
graphData: graphData
|
||||
timestamps,
|
||||
graphData
|
||||
}))
|
||||
}
|
||||
})
|
||||
@ -77,7 +78,7 @@ class App {
|
||||
}
|
||||
})(),
|
||||
mojangServices: this.mojangUpdater.getLastUpdate(),
|
||||
timestampPoints: this.timeTracker.getPoints(),
|
||||
timestampPoints: this.timeTracker.getPointsSeconds(),
|
||||
servers: this.serverRegistrations.map(serverRegistration => serverRegistration.getPingHistory())
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user