refactor(proxy): align aggregate field names with RFC
Co-Authored-By: Virgil <virgil@lethean.io>
This commit is contained in:
parent
5ba21cb9bf
commit
187a366d74
4 changed files with 13 additions and 13 deletions
|
|
@ -141,7 +141,7 @@ func summaryResponse(p *proxy.Proxy) SummaryResponse {
|
|||
Expired: summary.Expired,
|
||||
AvgTime: summary.AvgTime,
|
||||
Latency: summary.AvgLatency,
|
||||
HashesTotal: summary.HashesTotal,
|
||||
HashesTotal: summary.Hashes,
|
||||
Best: summary.TopDiff,
|
||||
},
|
||||
}
|
||||
|
|
@ -158,7 +158,7 @@ func workersResponse(p *proxy.Proxy) WorkersResponse {
|
|||
record.Accepted,
|
||||
record.Rejected,
|
||||
record.Invalid,
|
||||
record.HashesTotal,
|
||||
record.Hashes,
|
||||
unixOrZero(record.LastHashAt),
|
||||
record.Hashrate(60),
|
||||
record.Hashrate(600),
|
||||
|
|
|
|||
|
|
@ -641,7 +641,7 @@ func (p *Proxy) summaryDocument() summaryDocumentPayload {
|
|||
Expired: summary.Expired,
|
||||
AvgTime: summary.AvgTime,
|
||||
Latency: summary.AvgLatency,
|
||||
HashesTotal: summary.HashesTotal,
|
||||
HashesTotal: summary.Hashes,
|
||||
Best: summary.TopDiff,
|
||||
},
|
||||
}
|
||||
|
|
@ -658,7 +658,7 @@ func (p *Proxy) workersDocument() workersDocumentPayload {
|
|||
record.Accepted,
|
||||
record.Rejected,
|
||||
record.Invalid,
|
||||
record.HashesTotal,
|
||||
record.Hashes,
|
||||
unixOrZero(record.LastHashAt),
|
||||
record.Hashrate(60),
|
||||
record.Hashrate(600),
|
||||
|
|
@ -1284,11 +1284,11 @@ func (s *Stats) Summary() StatsSummary {
|
|||
s.mu.Lock()
|
||||
defer s.mu.Unlock()
|
||||
summary := StatsSummary{
|
||||
Accepted: s.accepted.Load(),
|
||||
Rejected: s.rejected.Load(),
|
||||
Invalid: s.invalid.Load(),
|
||||
Expired: s.expired.Load(),
|
||||
HashesTotal: s.hashes.Load(),
|
||||
Accepted: s.accepted.Load(),
|
||||
Rejected: s.rejected.Load(),
|
||||
Invalid: s.invalid.Load(),
|
||||
Expired: s.expired.Load(),
|
||||
Hashes: s.hashes.Load(),
|
||||
}
|
||||
if summary.Accepted > 0 {
|
||||
uptime := uint64(time.Since(s.startTime).Seconds())
|
||||
|
|
@ -1307,7 +1307,7 @@ func (s *Stats) Summary() StatsSummary {
|
|||
if i == HashrateWindowAll {
|
||||
uptime := time.Since(s.startTime).Seconds()
|
||||
if uptime > 0 {
|
||||
summary.Hashrate[i] = float64(summary.HashesTotal) / uptime
|
||||
summary.Hashrate[i] = float64(summary.Hashes) / uptime
|
||||
}
|
||||
continue
|
||||
}
|
||||
|
|
@ -1445,7 +1445,7 @@ func (w *Workers) OnAccept(e Event) {
|
|||
}
|
||||
record := &w.entries[index]
|
||||
record.Accepted++
|
||||
record.HashesTotal += e.Diff
|
||||
record.Hashes += e.Diff
|
||||
record.LastHashAt = time.Now().UTC()
|
||||
record.LastIP = e.Miner.ip
|
||||
for i := range record.windows {
|
||||
|
|
|
|||
2
stats.go
2
stats.go
|
|
@ -53,7 +53,7 @@ type StatsSummary struct {
|
|||
Rejected uint64 `json:"rejected"`
|
||||
Invalid uint64 `json:"invalid"`
|
||||
Expired uint64 `json:"expired"`
|
||||
HashesTotal uint64 `json:"hashes_total"`
|
||||
Hashes uint64 `json:"hashes_total"`
|
||||
AvgTime uint32 `json:"avg_time"` // seconds per accepted share
|
||||
AvgLatency uint32 `json:"latency"` // median pool response latency in ms
|
||||
Hashrate [6]float64 `json:"hashrate"` // H/s per window (index = HashrateWindow* constants)
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ type WorkerRecord struct {
|
|||
Accepted uint64
|
||||
Rejected uint64
|
||||
Invalid uint64
|
||||
HashesTotal uint64 // sum of accepted share difficulties
|
||||
Hashes uint64 // sum of accepted share difficulties
|
||||
LastHashAt time.Time
|
||||
windows [5]tickWindow // 60s, 600s, 3600s, 12h, 24h
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue