forked from TrueCloudLab/frostfs-node
[#371] ir: Add morph cache metrics
Signed-off-by: Airat Arifullin a.arifullin@yadro.com
This commit is contained in:
parent
4f83ab0fb4
commit
90e9247b69
11 changed files with 154 additions and 27 deletions
|
@ -5,6 +5,7 @@ import (
|
|||
"fmt"
|
||||
"math/big"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-contract/nns"
|
||||
"github.com/nspcc-dev/neo-go/pkg/core/transaction"
|
||||
|
@ -81,6 +82,13 @@ func (c *Client) NNSHash() (util.Uint160, error) {
|
|||
return util.Uint160{}, ErrConnectionLost
|
||||
}
|
||||
|
||||
success := false
|
||||
startedAt := time.Now()
|
||||
|
||||
defer func() {
|
||||
c.cache.metrics.AddNNSContractHashDuration(success, time.Since(startedAt))
|
||||
}()
|
||||
|
||||
nnsHash := c.cache.nns()
|
||||
|
||||
if nnsHash == nil {
|
||||
|
@ -92,6 +100,7 @@ func (c *Client) NNSHash() (util.Uint160, error) {
|
|||
c.cache.setNNSHash(cs.Hash)
|
||||
nnsHash = &cs.Hash
|
||||
}
|
||||
success = true
|
||||
return *nnsHash, nil
|
||||
}
|
||||
|
||||
|
@ -221,7 +230,14 @@ func (c *Client) SetGroupSignerScope() error {
|
|||
|
||||
// contractGroupKey returns public key designating FrostFS contract group.
|
||||
func (c *Client) contractGroupKey() (*keys.PublicKey, error) {
|
||||
success := false
|
||||
startedAt := time.Now()
|
||||
defer func() {
|
||||
c.cache.metrics.AddGroupKeyDuration(success, time.Since(startedAt))
|
||||
}()
|
||||
|
||||
if gKey := c.cache.groupKey(); gKey != nil {
|
||||
success = true
|
||||
return gKey, nil
|
||||
}
|
||||
|
||||
|
@ -251,5 +267,7 @@ func (c *Client) contractGroupKey() (*keys.PublicKey, error) {
|
|||
}
|
||||
|
||||
c.cache.setGroupKey(pub)
|
||||
|
||||
success = true
|
||||
return pub, nil
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue