Browse Source

Fix unable to query status endpoint issue. (#103)

* Fix unable to query status endpoint issue.

* Revert "Fix unable to query status endpoint issue."

This reverts commit 73f02cdaea.

* Replace amino unsafe tag for float fields.
pull/1943/head
rao yunkun 7 years ago
committed by Anton Kaliaev
parent
commit
db419a308e
3 changed files with 14 additions and 14 deletions
  1. +9
    -9
      tm-monitor/eventmeter/eventmeter.go
  2. +4
    -4
      tm-monitor/monitor/network.go
  3. +1
    -1
      tm-monitor/monitor/node.go

+ 9
- 9
tm-monitor/eventmeter/eventmeter.go View File

@ -35,10 +35,10 @@ type EventMetric struct {
// filled in from the Meter
Count int64 `json:"count"`
Rate1 float64 `json:"rate_1" wire:"unsafe"`
Rate5 float64 `json:"rate_5" wire:"unsafe"`
Rate15 float64 `json:"rate_15" wire:"unsafe"`
RateMean float64 `json:"rate_mean" wire:"unsafe"`
Rate1 float64 `json:"rate_1" amino:"unsafe"`
Rate5 float64 `json:"rate_5" amino:"unsafe"`
Rate15 float64 `json:"rate_15" amino:"unsafe"`
RateMean float64 `json:"rate_mean" amino:"unsafe"`
// so the event can have effects in the eventmeter's consumer. runs in a go
// routine.
@ -80,7 +80,7 @@ type DisconnectCallbackFunc func()
type EventMeter struct {
wsc *client.WSClient
mtx sync.Mutex
mtx sync.Mutex
queryToMetricMap map[string]*EventMetric
unmarshalEvent EventUnmarshalFunc
@ -95,10 +95,10 @@ type EventMeter struct {
func NewEventMeter(addr string, unmarshalEvent EventUnmarshalFunc) *EventMeter {
return &EventMeter{
wsc: client.NewWSClient(addr, "/websocket", client.PingPeriod(1*time.Second)),
queryToMetricMap: make(map[string]*EventMetric),
unmarshalEvent: unmarshalEvent,
logger: log.NewNopLogger(),
wsc: client.NewWSClient(addr, "/websocket", client.PingPeriod(1*time.Second)),
queryToMetricMap: make(map[string]*EventMetric),
unmarshalEvent: unmarshalEvent,
logger: log.NewNopLogger(),
}
}


+ 4
- 4
tm-monitor/monitor/network.go View File

@ -11,7 +11,7 @@ import (
// UptimeData stores data for how long network has been running.
type UptimeData struct {
StartTime time.Time `json:"start_time"`
Uptime float64 `json:"uptime" wire:"unsafe"` // percentage of time we've been healthy, ever
Uptime float64 `json:"uptime" amino:"unsafe"` // percentage of time we've been healthy, ever
totalDownTime time.Duration // total downtime (only updated when we come back online)
wentDown time.Time
@ -35,11 +35,11 @@ const (
type Network struct {
Height int64 `json:"height"`
AvgBlockTime float64 `json:"avg_block_time" wire:"unsafe"` // ms (avg over last minute)
AvgBlockTime float64 `json:"avg_block_time" amino:"unsafe"` // ms (avg over last minute)
blockTimeMeter metrics.Meter
AvgTxThroughput float64 `json:"avg_tx_throughput" wire:"unsafe"` // tx/s (avg over last minute)
AvgTxThroughput float64 `json:"avg_tx_throughput" amino:"unsafe"` // tx/s (avg over last minute)
txThroughputMeter metrics.Meter
AvgBlockLatency float64 `json:"avg_block_latency" wire:"unsafe"` // ms (avg over last minute)
AvgBlockLatency float64 `json:"avg_block_latency" amino:"unsafe"` // ms (avg over last minute)
blockLatencyMeter metrics.Meter
NumValidators int `json:"num_validators"`


+ 1
- 1
tm-monitor/monitor/node.go View File

@ -26,7 +26,7 @@ type Node struct {
Name string `json:"name"`
Online bool `json:"online"`
Height int64 `json:"height"`
BlockLatency float64 `json:"block_latency" wire:"unsafe"` // ms, interval between block commits
BlockLatency float64 `json:"block_latency" amino:"unsafe"` // ms, interval between block commits
// em holds the ws connection. Each eventMeter callback is called in a separate go-routine.
em eventMeter


Loading…
Cancel
Save