Skip to content

Commit

Permalink
fix metrics callbacks
Browse files Browse the repository at this point in the history
  • Loading branch information
dbrajovic committed Jul 5, 2024
1 parent b747ed6 commit 1e0a4b9
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 7 deletions.
3 changes: 2 additions & 1 deletion orchestrator/batch_creator.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ func (l *batchCreator) Log() log.Logger {

func (l *batchCreator) requestTokenBatches(ctx context.Context) error {
metrics.ReportFuncCall(l.svcTags)
defer metrics.ReportFuncTiming(l.svcTags)
doneFn := metrics.ReportFuncTiming(l.svcTags)
defer doneFn()

fees, err := l.getUnbatchedTokenFees(ctx)
if err != nil {
Expand Down
3 changes: 2 additions & 1 deletion orchestrator/oracle.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ func (l *oracle) Log() log.Logger {

func (l *oracle) observeEthEvents(ctx context.Context) error {
metrics.ReportFuncCall(l.svcTags)
defer metrics.ReportFuncTiming(l.svcTags)
doneFn := metrics.ReportFuncTiming(l.svcTags)
defer doneFn()

// check if validator is in the active set since claims will fail otherwise
vs, err := l.injective.CurrentValset(ctx)
Expand Down
12 changes: 8 additions & 4 deletions orchestrator/relayer.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ func (l *relayer) Log() log.Logger {

func (l *relayer) relay(ctx context.Context) error {
metrics.ReportFuncCall(l.svcTags)
defer metrics.ReportFuncTiming(l.svcTags)
doneFn := metrics.ReportFuncTiming(l.svcTags)
defer doneFn()

ethValset, err := l.getLatestEthValset(ctx)
if err != nil {
Expand Down Expand Up @@ -82,7 +83,8 @@ func (l *relayer) relay(ctx context.Context) error {

func (l *relayer) getLatestEthValset(ctx context.Context) (*peggytypes.Valset, error) {
metrics.ReportFuncCall(l.svcTags)
defer metrics.ReportFuncTiming(l.svcTags)
doneFn := metrics.ReportFuncTiming(l.svcTags)
defer doneFn()

var latestEthValset *peggytypes.Valset
fn := func() error {
Expand All @@ -104,7 +106,8 @@ func (l *relayer) getLatestEthValset(ctx context.Context) (*peggytypes.Valset, e

func (l *relayer) relayValset(ctx context.Context, latestEthValset *peggytypes.Valset) error {
metrics.ReportFuncCall(l.svcTags)
defer metrics.ReportFuncTiming(l.svcTags)
doneFn := metrics.ReportFuncTiming(l.svcTags)
defer doneFn()

latestInjectiveValsets, err := l.injective.LatestValsets(ctx)
if err != nil {
Expand Down Expand Up @@ -183,7 +186,8 @@ func (l *relayer) shouldRelayValset(ctx context.Context, vs *peggytypes.Valset)

func (l *relayer) relayTokenBatch(ctx context.Context, latestEthValset *peggytypes.Valset) error {
metrics.ReportFuncCall(l.svcTags)
defer metrics.ReportFuncTiming(l.svcTags)
doneFn := metrics.ReportFuncTiming(l.svcTags)
defer doneFn()

batches, err := l.injective.LatestTransactionBatches(ctx)
if err != nil {
Expand Down
3 changes: 2 additions & 1 deletion orchestrator/signer.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ func (l *signer) Log() log.Logger {

func (l *signer) sign(ctx context.Context) error {
metrics.ReportFuncCall(l.svcTags)
defer metrics.ReportFuncTiming(l.svcTags)
doneFn := metrics.ReportFuncTiming(l.svcTags)
defer doneFn()

if err := l.signValidatorSets(ctx); err != nil {
return err
Expand Down

0 comments on commit 1e0a4b9

Please sign in to comment.