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
92ef33d9
Commit
92ef33d9
authored
Jun 24, 2015
by
Péter Szilágyi
Browse files
Options
Downloads
Patches
Plain Diff
rpc/api, cmd/geth: retrievel all percentiles, add time units
parent
302187ae
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
+13
-4
13 additions, 4 deletions
cmd/geth/monitorcmd.go
rpc/api/debug.go
+22
-21
22 additions, 21 deletions
rpc/api/debug.go
with
35 additions
and
25 deletions
cmd/geth/monitorcmd.go
+
13
−
4
View file @
92ef33d9
...
@@ -76,7 +76,10 @@ func monitor(ctx *cli.Context) {
...
@@ -76,7 +76,10 @@ func monitor(ctx *cli.Context) {
termui
.
UseTheme
(
"helloworld"
)
termui
.
UseTheme
(
"helloworld"
)
rows
:=
5
rows
:=
len
(
monitored
)
if
rows
>
5
{
rows
=
5
}
cols
:=
(
len
(
monitored
)
+
rows
-
1
)
/
rows
cols
:=
(
len
(
monitored
)
+
rows
-
1
)
/
rows
for
i
:=
0
;
i
<
rows
;
i
++
{
for
i
:=
0
;
i
<
rows
;
i
++
{
termui
.
Body
.
AddRows
(
termui
.
NewRow
())
termui
.
Body
.
AddRows
(
termui
.
NewRow
())
...
@@ -207,8 +210,9 @@ func expandMetrics(metrics map[string]interface{}, path string) []string {
...
@@ -207,8 +210,9 @@ func expandMetrics(metrics map[string]interface{}, path string) []string {
// updateChart inserts a dataset into a line chart, scaling appropriately as to
// updateChart inserts a dataset into a line chart, scaling appropriately as to
// not display weird labels, also updating the chart label accordingly.
// not display weird labels, also updating the chart label accordingly.
func
updateChart
(
metric
string
,
data
[]
float64
,
chart
*
termui
.
LineChart
)
{
func
updateChart
(
metric
string
,
data
[]
float64
,
chart
*
termui
.
LineChart
)
{
units
:=
[]
string
{
""
,
"K"
,
"M"
,
"G"
,
"T"
,
"E"
,
"P"
}
dataUnits
:=
[]
string
{
""
,
"K"
,
"M"
,
"G"
,
"T"
,
"E"
}
colors
:=
[]
termui
.
Attribute
{
termui
.
ColorBlue
,
termui
.
ColorCyan
,
termui
.
ColorGreen
,
termui
.
ColorYellow
,
termui
.
ColorRed
,
termui
.
ColorRed
,
termui
.
ColorRed
}
timeUnits
:=
[]
string
{
"ns"
,
"µs"
,
"ms"
,
"s"
,
"ks"
,
"ms"
}
colors
:=
[]
termui
.
Attribute
{
termui
.
ColorBlue
,
termui
.
ColorCyan
,
termui
.
ColorGreen
,
termui
.
ColorYellow
,
termui
.
ColorRed
,
termui
.
ColorRed
}
// Find the maximum value and scale under 1K
// Find the maximum value and scale under 1K
high
:=
data
[
0
]
high
:=
data
[
0
]
...
@@ -225,7 +229,12 @@ func updateChart(metric string, data []float64, chart *termui.LineChart) {
...
@@ -225,7 +229,12 @@ func updateChart(metric string, data []float64, chart *termui.LineChart) {
}
}
// Update the chart's label with the scale units
// Update the chart's label with the scale units
chart
.
Border
.
Label
=
metric
chart
.
Border
.
Label
=
metric
if
unit
>
0
{
units
:=
dataUnits
if
strings
.
Contains
(
metric
,
"Percentiles"
)
{
units
=
timeUnits
}
if
len
(
units
[
unit
])
>
0
{
chart
.
Border
.
Label
+=
" ["
+
units
[
unit
]
+
"]"
chart
.
Border
.
Label
+=
" ["
+
units
[
unit
]
+
"]"
}
}
chart
.
LineColor
=
colors
[
unit
]
chart
.
LineColor
=
colors
[
unit
]
...
...
This diff is collapsed.
Click to expand it.
rpc/api/debug.go
+
22
−
21
View file @
92ef33d9
...
@@ -193,6 +193,11 @@ func (self *debugApi) Metrics(req *shared.Request) (interface{}, error) {
...
@@ -193,6 +193,11 @@ func (self *debugApi) Metrics(req *shared.Request) (interface{}, error) {
format
:=
func
(
total
float64
,
rate
float64
)
string
{
format
:=
func
(
total
float64
,
rate
float64
)
string
{
return
fmt
.
Sprintf
(
"%s (%s/s)"
,
round
(
total
,
0
),
round
(
rate
,
2
))
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
// Iterate over all the metrics, and just dump for now
counters
:=
make
(
map
[
string
]
interface
{})
counters
:=
make
(
map
[
string
]
interface
{})
metrics
.
DefaultRegistry
.
Each
(
func
(
name
string
,
metric
interface
{})
{
metrics
.
DefaultRegistry
.
Each
(
func
(
name
string
,
metric
interface
{})
{
...
@@ -211,29 +216,25 @@ func (self *debugApi) Metrics(req *shared.Request) (interface{}, error) {
...
@@ -211,29 +216,25 @@ func (self *debugApi) Metrics(req *shared.Request) (interface{}, error) {
switch
metric
:=
metric
.
(
type
)
{
switch
metric
:=
metric
.
(
type
)
{
case
metrics
.
Meter
:
case
metrics
.
Meter
:
root
[
name
]
=
map
[
string
]
interface
{}{
root
[
name
]
=
map
[
string
]
interface
{}{
"Avg01Min"
:
metric
.
Rate1
(),
"Avg
Rate
01Min"
:
metric
.
Rate1
(),
"Avg05Min"
:
metric
.
Rate5
(),
"Avg
Rate
05Min"
:
metric
.
Rate5
(),
"Avg15Min"
:
metric
.
Rate15
(),
"Avg
Rate
15Min"
:
metric
.
Rate15
(),
"
AvgTotal"
:
metric
.
RateMean
(),
"
MeanRate"
:
metric
.
RateMean
(),
"Total"
:
float64
(
metric
.
Count
()),
"Total"
:
float64
(
metric
.
Count
()),
}
}
case
metrics
.
Timer
:
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
{}{
root
[
name
]
=
map
[
string
]
interface
{}{
"Avg01Min"
:
metric
.
Rate1
(),
"Avg
Rate
01Min"
:
metric
.
Rate1
(),
"Avg05Min"
:
metric
.
Rate5
(),
"Avg
Rate
05Min"
:
metric
.
Rate5
(),
"Avg15Min"
:
metric
.
Rate15
(),
"Avg
Rate
15Min"
:
metric
.
Rate15
(),
"
AvgTotal"
:
metric
.
RateMean
(),
"
MeanRate"
:
metric
.
RateMean
(),
"Total"
:
float64
(
metric
.
Count
()),
"Total"
:
float64
(
metric
.
Count
()),
"Maximum"
:
metric
.
Max
(),
"Percentiles"
:
ps
,
"Minimum"
:
metric
.
Min
(),
"Percentile"
:
map
[
string
]
interface
{}{
"20"
:
metric
.
Percentile
(
0.2
),
"50"
:
metric
.
Percentile
(
0.5
),
"80"
:
metric
.
Percentile
(
0.8
),
"95"
:
metric
.
Percentile
(
0.95
),
"99"
:
metric
.
Percentile
(
0.99
),
},
}
}
default
:
default
:
...
@@ -254,10 +255,10 @@ func (self *debugApi) Metrics(req *shared.Request) (interface{}, error) {
...
@@ -254,10 +255,10 @@ func (self *debugApi) Metrics(req *shared.Request) (interface{}, error) {
"Avg01Min"
:
format
(
metric
.
Rate1
()
*
60
,
metric
.
Rate1
()),
"Avg01Min"
:
format
(
metric
.
Rate1
()
*
60
,
metric
.
Rate1
()),
"Avg05Min"
:
format
(
metric
.
Rate5
()
*
300
,
metric
.
Rate5
()),
"Avg05Min"
:
format
(
metric
.
Rate5
()
*
300
,
metric
.
Rate5
()),
"Avg15Min"
:
format
(
metric
.
Rate15
()
*
900
,
metric
.
Rate15
()),
"Avg15Min"
:
format
(
metric
.
Rate15
()
*
900
,
metric
.
Rate15
()),
"
Count
"
:
format
(
float64
(
metric
.
Count
()),
metric
.
RateMean
()),
"
Total
"
:
format
(
float64
(
metric
.
Count
()),
metric
.
RateMean
()),
"Maximum"
:
time
.
Duration
(
metric
.
Max
())
.
String
(),
"Maximum"
:
time
.
Duration
(
metric
.
Max
())
.
String
(),
"Minimum"
:
time
.
Duration
(
metric
.
Min
())
.
String
(),
"Minimum"
:
time
.
Duration
(
metric
.
Min
())
.
String
(),
"Percentile"
:
map
[
string
]
interface
{}{
"Percentile
s
"
:
map
[
string
]
interface
{}{
"20"
:
time
.
Duration
(
metric
.
Percentile
(
0.2
))
.
String
(),
"20"
:
time
.
Duration
(
metric
.
Percentile
(
0.2
))
.
String
(),
"50"
:
time
.
Duration
(
metric
.
Percentile
(
0.5
))
.
String
(),
"50"
:
time
.
Duration
(
metric
.
Percentile
(
0.5
))
.
String
(),
"80"
:
time
.
Duration
(
metric
.
Percentile
(
0.8
))
.
String
(),
"80"
:
time
.
Duration
(
metric
.
Percentile
(
0.8
))
.
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