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
dbfd7452
Unverified
Commit
dbfd7452
authored
May 18, 2021
by
Alok Nerurkar
Committed by
GitHub
May 18, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor: change FailedCacheHits to Counter (#1748)
parent
cf386c9d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
11 deletions
+8
-11
metrics.go
pkg/pushsync/metrics.go
+7
-10
pushsync.go
pkg/pushsync/pushsync.go
+1
-1
No files found.
pkg/pushsync/metrics.go
View file @
dbfd7452
...
...
@@ -17,7 +17,7 @@ type metrics struct {
TotalReplicatedError
prometheus
.
Counter
TotalSendAttempts
prometheus
.
Counter
TotalFailedSendAttempts
prometheus
.
Counter
FailedCacheHits
*
prometheus
.
CounterVec
TotalFailedCacheHits
prometheus
.
Counter
}
func
newMetrics
()
metrics
{
...
...
@@ -66,15 +66,12 @@ func newMetrics() metrics {
Name
:
"total_failed_send_attempts"
,
Help
:
"Total no of failed attempts to push chunk."
,
}),
FailedCacheHits
:
prometheus
.
NewCounterVec
(
prometheus
.
CounterOpts
{
Namespace
:
m
.
Namespace
,
Subsystem
:
subsystem
,
Name
:
"failed_cache_hits"
,
Help
:
"FailedRequestCache hits"
,
},
[]
string
{
"peer"
,
"chunk"
},
),
TotalFailedCacheHits
:
prometheus
.
NewCounter
(
prometheus
.
CounterOpts
{
Namespace
:
m
.
Namespace
,
Subsystem
:
subsystem
,
Name
:
"total_failed_cache_hits"
,
Help
:
"Total FailedRequestCache hits"
,
}),
}
}
...
...
pkg/pushsync/pushsync.go
View file @
dbfd7452
...
...
@@ -364,7 +364,7 @@ func (ps *PushSync) pushToClosest(ctx context.Context, ch swarm.Chunk, retryAllo
}
if
!
ps
.
failedRequests
.
Useful
(
peer
,
ch
.
Address
())
{
skipPeers
=
append
(
skipPeers
,
peer
)
ps
.
metrics
.
FailedCacheHits
.
WithLabelValues
(
peer
.
String
(),
ch
.
Address
()
.
String
())
.
Inc
()
ps
.
metrics
.
TotalFailedCacheHits
.
Inc
()
continue
}
skipPeers
=
append
(
skipPeers
,
peer
)
...
...
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