good morning!!!!
Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
bor
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Harbor Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
open
bor
Commits
fdbf8be7
Commit
fdbf8be7
authored
Jun 25, 2015
by
Péter Szilágyi
Browse files
Options
Downloads
Patches
Plain Diff
cmd/geth, rpc/api: fix reported metrics issues
parent
c0343c8f
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
cmd/geth/monitorcmd.go
+8
-12
8 additions, 12 deletions
cmd/geth/monitorcmd.go
rpc/api/debug.go
+12
-15
12 additions, 15 deletions
rpc/api/debug.go
with
20 additions
and
27 deletions
cmd/geth/monitorcmd.go
+
8
−
12
View file @
fdbf8be7
...
...
@@ -4,6 +4,7 @@ import (
"fmt"
"math"
"reflect"
"runtime"
"sort"
"strings"
"time"
...
...
@@ -72,15 +73,7 @@ func monitor(ctx *cli.Context) {
}
monitored
:=
resolveMetrics
(
metrics
,
ctx
.
Args
())
if
len
(
monitored
)
==
0
{
list
:=
[]
string
{}
for
_
,
metric
:=
range
expandMetrics
(
metrics
,
""
)
{
switch
{
case
strings
.
HasSuffix
(
metric
,
"/0"
)
:
list
=
append
(
list
,
strings
.
Replace
(
metric
,
"/0"
,
"/[0-100]"
,
-
1
))
case
!
strings
.
Contains
(
metric
,
"Percentiles"
)
:
list
=
append
(
list
,
metric
)
}
}
list
:=
expandMetrics
(
metrics
,
""
)
sort
.
Strings
(
list
)
utils
.
Fatalf
(
"No metrics specified.
\n\n
Available:
\n
- %s"
,
strings
.
Join
(
list
,
"
\n
- "
))
}
...
...
@@ -116,11 +109,14 @@ func monitor(ctx *cli.Context) {
}
for
i
,
metric
:=
range
monitored
{
charts
[
i
]
=
termui
.
NewLineChart
()
if
runtime
.
GOOS
==
"windows"
{
charts
[
i
]
.
Mode
=
"dot"
}
charts
[
i
]
.
Data
=
make
([]
float64
,
512
)
charts
[
i
]
.
DataLabels
=
[]
string
{
""
}
charts
[
i
]
.
Height
=
(
termui
.
TermHeight
()
-
footer
.
Height
)
/
rows
charts
[
i
]
.
AxesColor
=
termui
.
ColorWhite
charts
[
i
]
.
PaddingBottom
=
-
1
charts
[
i
]
.
PaddingBottom
=
-
2
charts
[
i
]
.
Border
.
Label
=
metric
charts
[
i
]
.
Border
.
LabelFgColor
=
charts
[
i
]
.
Border
.
FgColor
|
termui
.
AttrBold
...
...
@@ -141,7 +137,7 @@ func monitor(ctx *cli.Context) {
for
{
select
{
case
event
:=
<-
termui
.
EventCh
()
:
if
event
.
Type
==
termui
.
EventKey
&&
event
.
Ch
==
'q'
{
if
event
.
Type
==
termui
.
EventKey
&&
event
.
Key
==
termui
.
KeyCtrlC
{
return
}
if
event
.
Type
==
termui
.
EventResize
{
...
...
@@ -302,7 +298,7 @@ func updateChart(metric string, data []float64, chart *termui.LineChart, err err
func
updateFooter
(
ctx
*
cli
.
Context
,
err
error
,
footer
*
termui
.
Par
)
{
// Generate the basic footer
refresh
:=
time
.
Duration
(
ctx
.
Int
(
monitorCommandRefreshFlag
.
Name
))
*
time
.
Second
footer
.
Text
=
fmt
.
Sprintf
(
"Press
q
to quit. Refresh interval: %v."
,
refresh
)
footer
.
Text
=
fmt
.
Sprintf
(
"Press
Ctrl+C
to quit. Refresh interval: %v."
,
refresh
)
footer
.
TextFgColor
=
termui
.
Theme
()
.
ParTextFg
|
termui
.
AttrBold
// Append any encountered errors
...
...
This diff is collapsed.
Click to expand it.
rpc/api/debug.go
+
12
−
15
View file @
fdbf8be7
...
...
@@ -193,11 +193,6 @@ func (self *debugApi) Metrics(req *shared.Request) (interface{}, error) {
format
:=
func
(
total
float64
,
rate
float64
)
string
{
return
fmt
.
Sprintf
(
"%s (%s/s)"
,
round
(
total
,
0
),
round
(
rate
,
2
))
}
// Create the percentile units
percentiles
:=
make
([]
float64
,
101
)
for
i
:=
0
;
i
<=
100
;
i
++
{
percentiles
[
i
]
=
float64
(
i
)
/
100
}
// Iterate over all the metrics, and just dump for now
counters
:=
make
(
map
[
string
]
interface
{})
metrics
.
DefaultRegistry
.
Each
(
func
(
name
string
,
metric
interface
{})
{
...
...
@@ -220,21 +215,23 @@ func (self *debugApi) Metrics(req *shared.Request) (interface{}, error) {
"AvgRate05Min"
:
metric
.
Rate5
(),
"AvgRate15Min"
:
metric
.
Rate15
(),
"MeanRate"
:
metric
.
RateMean
(),
"
Tota
l"
:
float64
(
metric
.
Count
()),
"
Overal
l"
:
float64
(
metric
.
Count
()),
}
case
metrics
.
Timer
:
ps
:=
make
(
map
[
string
]
interface
{})
for
i
,
p
:=
range
metric
.
Percentiles
(
percentiles
)
{
ps
[
fmt
.
Sprintf
(
"%d"
,
i
)]
=
p
}
root
[
name
]
=
map
[
string
]
interface
{}{
"AvgRate01Min"
:
metric
.
Rate1
(),
"AvgRate05Min"
:
metric
.
Rate5
(),
"AvgRate15Min"
:
metric
.
Rate15
(),
"MeanRate"
:
metric
.
RateMean
(),
"Total"
:
float64
(
metric
.
Count
()),
"Percentiles"
:
ps
,
"Overall"
:
float64
(
metric
.
Count
()),
"Percentiles"
:
map
[
string
]
interface
{}{
"5"
:
metric
.
Percentile
(
0.05
),
"20"
:
metric
.
Percentile
(
0.2
),
"50"
:
metric
.
Percentile
(
0.5
),
"80"
:
metric
.
Percentile
(
0.8
),
"95"
:
metric
.
Percentile
(
0.95
),
},
}
default
:
...
...
@@ -247,7 +244,7 @@ func (self *debugApi) Metrics(req *shared.Request) (interface{}, error) {
"Avg01Min"
:
format
(
metric
.
Rate1
()
*
60
,
metric
.
Rate1
()),
"Avg05Min"
:
format
(
metric
.
Rate5
()
*
300
,
metric
.
Rate5
()),
"Avg15Min"
:
format
(
metric
.
Rate15
()
*
900
,
metric
.
Rate15
()),
"
Tota
l"
:
format
(
float64
(
metric
.
Count
()),
metric
.
RateMean
()),
"
Overal
l"
:
format
(
float64
(
metric
.
Count
()),
metric
.
RateMean
()),
}
case
metrics
.
Timer
:
...
...
@@ -255,15 +252,15 @@ func (self *debugApi) Metrics(req *shared.Request) (interface{}, error) {
"Avg01Min"
:
format
(
metric
.
Rate1
()
*
60
,
metric
.
Rate1
()),
"Avg05Min"
:
format
(
metric
.
Rate5
()
*
300
,
metric
.
Rate5
()),
"Avg15Min"
:
format
(
metric
.
Rate15
()
*
900
,
metric
.
Rate15
()),
"
Tota
l"
:
format
(
float64
(
metric
.
Count
()),
metric
.
RateMean
()),
"
Overal
l"
:
format
(
float64
(
metric
.
Count
()),
metric
.
RateMean
()),
"Maximum"
:
time
.
Duration
(
metric
.
Max
())
.
String
(),
"Minimum"
:
time
.
Duration
(
metric
.
Min
())
.
String
(),
"Percentiles"
:
map
[
string
]
interface
{}{
"5"
:
time
.
Duration
(
metric
.
Percentile
(
0.05
))
.
String
(),
"20"
:
time
.
Duration
(
metric
.
Percentile
(
0.2
))
.
String
(),
"50"
:
time
.
Duration
(
metric
.
Percentile
(
0.5
))
.
String
(),
"80"
:
time
.
Duration
(
metric
.
Percentile
(
0.8
))
.
String
(),
"95"
:
time
.
Duration
(
metric
.
Percentile
(
0.95
))
.
String
(),
"99"
:
time
.
Duration
(
metric
.
Percentile
(
0.99
))
.
String
(),
},
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment