diff --git a/orchestrator/batch_creator.go b/orchestrator/batch_creator.go index 232ae2d5..928c785b 100644 --- a/orchestrator/batch_creator.go +++ b/orchestrator/batch_creator.go @@ -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 { diff --git a/orchestrator/oracle.go b/orchestrator/oracle.go index 59bea617..686667e0 100644 --- a/orchestrator/oracle.go +++ b/orchestrator/oracle.go @@ -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) diff --git a/orchestrator/relayer.go b/orchestrator/relayer.go index ab34920a..f769760f 100644 --- a/orchestrator/relayer.go +++ b/orchestrator/relayer.go @@ -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 { @@ -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 { @@ -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 { @@ -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 { diff --git a/orchestrator/signer.go b/orchestrator/signer.go index 4f0dacc9..979303f3 100644 --- a/orchestrator/signer.go +++ b/orchestrator/signer.go @@ -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