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
4fd07fd7
Unverified
Commit
4fd07fd7
authored
Oct 05, 2020
by
Ralph Pichler
Committed by
GitHub
Oct 05, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
include rejecting if cheque rejected plus metric (#795)
parent
f96d5017
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
4 deletions
+14
-4
metrics.go
pkg/settlement/swap/metrics.go
+11
-3
swap.go
pkg/settlement/swap/swap.go
+3
-1
No files found.
pkg/settlement/swap/metrics.go
View file @
4fd07fd7
...
...
@@ -13,8 +13,9 @@ type metrics struct {
// all metrics fields must be exported
// to be able to return them by Metrics()
// using reflection
TotalReceived
prometheus
.
Counter
TotalSent
prometheus
.
Counter
TotalReceived
prometheus
.
Counter
TotalSent
prometheus
.
Counter
ChequesRejected
prometheus
.
Counter
}
func
newMetrics
()
metrics
{
...
...
@@ -32,7 +33,14 @@ func newMetrics() metrics {
Subsystem
:
subsystem
,
Name
:
"total_sent"
,
Help
:
"Amount of tokens sent to peers (costs paid by the node)"
,
})}
}),
ChequesRejected
:
prometheus
.
NewCounter
(
prometheus
.
CounterOpts
{
Namespace
:
m
.
Namespace
,
Subsystem
:
subsystem
,
Name
:
"cheques_rejected"
,
Help
:
"Number of cheques rejected"
,
}),
}
}
func
(
s
*
Service
)
Metrics
()
[]
prometheus
.
Collector
{
...
...
pkg/settlement/swap/swap.go
View file @
4fd07fd7
...
...
@@ -7,6 +7,7 @@ package swap
import
(
"context"
"errors"
"fmt"
"math/big"
"github.com/ethereum/go-ethereum/common"
...
...
@@ -88,7 +89,8 @@ func (s *Service) ReceiveCheque(ctx context.Context, peer swarm.Address, cheque
amount
,
err
:=
s
.
chequeStore
.
ReceiveCheque
(
ctx
,
cheque
)
if
err
!=
nil
{
return
err
s
.
metrics
.
ChequesRejected
.
Inc
()
return
fmt
.
Errorf
(
"rejecting cheque: %w"
,
err
)
}
if
!
known
{
...
...
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