Skip to content

Commit

Permalink
Log execution time
Browse files Browse the repository at this point in the history
  • Loading branch information
Kyaw Myint Thein committed Sep 27, 2021
1 parent dcb5fb4 commit a988175
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions twirp.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"strconv"
"strings"
"sync"
"time"

"github.com/google/martian"
"github.com/google/martian/parse"
Expand Down Expand Up @@ -88,6 +89,11 @@ func NewConfiguredBackendFactory(l logging.Logger, ref func(*config.Backend) cli
re := ref(remote)
_, isTwirpCall := remote.ExtraConfig[TwirpServiceIdentifierConst]
if isTwirpCall {
start := time.Now()
defer func(logger logging.Logger) {
elapsed := time.Since(start)
logger.Info("NewConfiguredBackendFactory time : %s", elapsed)
}(l)
twirpOpt := getTwirpOptions(remote)
if twirpOpt == nil {
log.Println("twirp: client factory is not used for", remote)
Expand Down

0 comments on commit a988175

Please sign in to comment.