Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Geth-Modification
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张蕾
Geth-Modification
Commits
13614f4e
Unverified
Commit
13614f4e
authored
Dec 11, 2016
by
Péter Szilágyi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ethstats: fix timestamps and add custom proto support
parent
4f9ccdd7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
1 deletion
+8
-1
ethstats.go
ethstats/ethstats.go
+8
-1
No files found.
ethstats/ethstats.go
View file @
13614f4e
...
...
@@ -25,6 +25,7 @@ import (
"regexp"
"runtime"
"strconv"
"strings"
"time"
"github.com/ethereum/go-ethereum/common"
...
...
@@ -115,7 +116,11 @@ func (s *Service) loop() {
// Loop reporting until termination
for
{
// Establish a websocket connection to the server and authenticate the node
conn
,
err
:=
websocket
.
Dial
(
fmt
.
Sprintf
(
"wss://%s/api"
,
s
.
host
),
""
,
"http://localhost/"
)
url
:=
fmt
.
Sprintf
(
"%s/api"
,
s
.
host
)
if
!
strings
.
Contains
(
url
,
"://"
)
{
url
=
"wss://"
+
url
}
conn
,
err
:=
websocket
.
Dial
(
url
,
""
,
"http://localhost/"
)
if
err
!=
nil
{
glog
.
V
(
logger
.
Warn
)
.
Infof
(
"Stats server unreachable: %v"
,
err
)
time
.
Sleep
(
10
*
time
.
Second
)
...
...
@@ -297,6 +302,7 @@ func (s *Service) reportLatency(in *json.Decoder, out *json.Encoder) error {
type
blockStats
struct
{
Number
*
big
.
Int
`json:"number"`
Hash
common
.
Hash
`json:"hash"`
Timestamp
*
big
.
Int
`json:"timestamp"`
Miner
common
.
Address
`json:"miner"`
GasUsed
*
big
.
Int
`json:"gasUsed"`
GasLimit
*
big
.
Int
`json:"gasLimit"`
...
...
@@ -362,6 +368,7 @@ func (s *Service) reportBlock(out *json.Encoder, block *types.Block) error {
"block"
:
&
blockStats
{
Number
:
head
.
Number
,
Hash
:
head
.
Hash
(),
Timestamp
:
head
.
Time
,
Miner
:
head
.
Coinbase
,
GasUsed
:
new
(
big
.
Int
)
.
Set
(
head
.
GasUsed
),
GasLimit
:
new
(
big
.
Int
)
.
Set
(
head
.
GasLimit
),
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment