From db419a308e6618eb52d0df6193fbbce482417311 Mon Sep 17 00:00:00 2001 From: rao yunkun Date: Thu, 28 Jun 2018 16:12:27 +0800 Subject: [PATCH] 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 73f02cdaea24dee88c47674dceed4f2513abac87. * Replace amino unsafe tag for float fields. --- tm-monitor/eventmeter/eventmeter.go | 18 +++++++++--------- tm-monitor/monitor/network.go | 8 ++++---- tm-monitor/monitor/node.go | 2 +- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/tm-monitor/eventmeter/eventmeter.go b/tm-monitor/eventmeter/eventmeter.go index 494273af4..731b38123 100644 --- a/tm-monitor/eventmeter/eventmeter.go +++ b/tm-monitor/eventmeter/eventmeter.go @@ -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(), } } diff --git a/tm-monitor/monitor/network.go b/tm-monitor/monitor/network.go index 2a2e4f0c8..9b147c06b 100644 --- a/tm-monitor/monitor/network.go +++ b/tm-monitor/monitor/network.go @@ -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"` diff --git a/tm-monitor/monitor/node.go b/tm-monitor/monitor/node.go index 5a47baa06..7a597bef5 100644 --- a/tm-monitor/monitor/node.go +++ b/tm-monitor/monitor/node.go @@ -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