Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mybee
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
vicotor
mybee
Commits
e174373a
Unverified
Commit
e174373a
authored
Jun 04, 2021
by
acud
Committed by
GitHub
Jun 04, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(pusher): receipt depth metric (#1977)
parent
9dd380c4
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
0 deletions
+14
-0
metrics.go
pkg/pusher/metrics.go
+11
-0
pusher.go
pkg/pusher/pusher.go
+3
-0
No files found.
pkg/pusher/metrics.go
View file @
e174373a
...
...
@@ -16,6 +16,8 @@ type metrics struct {
MarkAndSweepTime
prometheus
.
Histogram
SyncTime
prometheus
.
Histogram
ErrorTime
prometheus
.
Histogram
ReceiptDepth
*
prometheus
.
CounterVec
}
func
newMetrics
()
metrics
{
...
...
@@ -61,6 +63,15 @@ func newMetrics() metrics {
Help
:
"Histogram of time spent before giving up on syncing a chunk."
,
Buckets
:
[]
float64
{
0.1
,
0.25
,
0.5
,
1
,
2.5
,
5
,
10
,
60
},
}),
ReceiptDepth
:
prometheus
.
NewCounterVec
(
prometheus
.
CounterOpts
{
Namespace
:
m
.
Namespace
,
Subsystem
:
subsystem
,
Name
:
"receipt_depth"
,
Help
:
"Counter of receipts received at different depths."
,
},
[]
string
{
"depth"
},
),
}
}
...
...
pkg/pusher/pusher.go
View file @
e174373a
...
...
@@ -13,6 +13,7 @@ import (
"crypto/ecdsa"
"errors"
"fmt"
"strconv"
"sync"
"time"
...
...
@@ -148,6 +149,8 @@ LOOP:
s
.
metrics
.
SyncTime
.
Observe
(
time
.
Since
(
startTime
)
.
Seconds
())
// only print this if there was no error while sending the chunk
logger
.
Tracef
(
"pusher: pushed chunk %s to node %s"
,
ch
.
Address
()
.
String
(),
storerPeer
.
String
())
po
:=
swarm
.
Proximity
(
ch
.
Address
()
.
Bytes
(),
storerPeer
.
Bytes
())
s
.
metrics
.
ReceiptDepth
.
WithLabelValues
(
strconv
.
Itoa
(
int
(
po
)))
.
Inc
()
}
else
{
s
.
metrics
.
TotalErrors
.
Inc
()
s
.
metrics
.
ErrorTime
.
Observe
(
time
.
Since
(
startTime
)
.
Seconds
())
...
...
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