mirror of
https://github.com/Retropex/apolloapi-v2.git
synced 2025-05-21 09:32:36 +02:00
New minerstats ready
This commit is contained in:
parent
4a78471ab9
commit
ccbfa24726
@ -1 +1 @@
|
||||
-host us-east.stratum.slushpool.com -port 3333 -user jstefanop.worker1 -brd_ocp 45 -osc 35 -fan_temp_hi 40 -fan_temp_low 60
|
||||
-host us-east.stratum.slushpool.com -port 3333 -user jstefanop.worker1 -brd_ocp 50 -osc 46 -fan_temp_hi 50 -fan_temp_low 80
|
@ -4,12 +4,16 @@ module.exports.typeDefs = `
|
||||
}
|
||||
|
||||
type MinerStatsOutput {
|
||||
result: MinerStatsResult!
|
||||
result: MinerStatsResult
|
||||
error: Error
|
||||
}
|
||||
|
||||
type MinerStatsResult {
|
||||
date: Date
|
||||
stats: MinerStats!
|
||||
}
|
||||
|
||||
type MinerStats {
|
||||
date: String
|
||||
statVersion: String
|
||||
versions: MinerStatsVersion
|
||||
master: MinerStatsMaster
|
||||
@ -83,9 +87,9 @@ module.exports.typeDefs = `
|
||||
sharesAccepted: Int
|
||||
sharesRejected: Int
|
||||
solutionsAccepted: Int
|
||||
minRespTime: Int
|
||||
avgRespTime: Int
|
||||
maxRespTime: Int
|
||||
minRespTime: Float
|
||||
avgRespTime: Float
|
||||
maxRespTime: Float
|
||||
shareLoss: Float
|
||||
poolTotal: Int
|
||||
inService: Int
|
||||
|
@ -1,8 +1,8 @@
|
||||
const { join } = require('path')
|
||||
const { exec } = require('child_process')
|
||||
const normalize = require('normalize-object')
|
||||
const fs =require('fs');
|
||||
const path = require('path')
|
||||
const _ = require('lodash')
|
||||
|
||||
module.exports = ({ define }) => {
|
||||
define('stats', async (payload, { knex, errors, utils }) => {
|
||||
@ -30,10 +30,23 @@ function getMinerStats (errors) {
|
||||
|
||||
received = JSON.parse(received);
|
||||
|
||||
// Normalize object keys to fit GraphQL and be code-friendly
|
||||
const results = normalize(received, 'camel');
|
||||
received.master.intervals = _.mapKeys(received.master.intervals, (value, name) => {
|
||||
return `int_${name}`
|
||||
});
|
||||
|
||||
resolve(results)
|
||||
received.pool.intervals = _.mapKeys(received.pool.intervals, (value, name) => {
|
||||
return `int_${name}`
|
||||
});
|
||||
|
||||
received.fans = _.mapKeys(received.fans, (value, name) => {
|
||||
return `int_${name}`
|
||||
});
|
||||
|
||||
received.slots = _.mapKeys(received.slots, (value, name) => {
|
||||
return `int_${name}`
|
||||
});
|
||||
|
||||
resolve(received)
|
||||
} catch (err) {
|
||||
reject(new errors.InternalError(err.toString()));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user