Skip to content

Commit

Permalink
debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
clD11 committed Dec 13, 2023
1 parent 30ad746 commit c64206a
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 9 deletions.
6 changes: 6 additions & 0 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,12 @@ func Execute(version, commit, buildTime string) {

// execute the root cmd
if err := RootCmd.ExecuteContext(ctx); err != nil {
if r := recover(); r != nil {
logging.FromContext(context.Background()).Error().
Str("panic", fmt.Sprintf("%+v", r)).
Str("stacktrace", string(debug.Stack())).
Msg("panic recovered")
}
logger.Error().Err(err).Msg("./bat-go command encountered an error")
os.Exit(1)
}
Expand Down
6 changes: 5 additions & 1 deletion services/grant/cmd/grant.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"net/http"
_ "net/http/pprof" // Enable profiling.
"os"
"runtime/debug"
"strconv"
"strings"
"time"
Expand Down Expand Up @@ -590,7 +591,10 @@ func GrantServer(

defer func() {
if r := recover(); r != nil {
logging.FromContext(context.Background()).Error().Str("panicked", fmt.Sprintf("%+v", r)).Msg("panicked")
logging.FromContext(context.Background()).Error().
Str("panic", fmt.Sprintf("%+v", r)).
Str("stacktrace", string(debug.Stack())).
Msg("panic recovered")
}
}()

Expand Down
15 changes: 7 additions & 8 deletions services/wallet/metric/metric.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,16 @@ type Metric struct {

// New returns a new metric.Metric.
func New() (*Metric, error) {
clzp := prometheus.NewCounterVec(prometheus.CounterOpts{
Name: "count_link_zebpay",
Help: "Counts the number of successful and failed ZebPay linkings partitioned by country code",
},
[]string{status, countryCode},
)
//clzp := prometheus.NewCounterVec(prometheus.CounterOpts{
// Name: "count_link_zebpay",
// Help: "Counts the number of successful and failed ZebPay linkings partitioned by country code",
//},
// []string{status, countryCode},
//)
//if err := prometheus.Register(clzp); err != nil {
// return nil, fmt.Errorf("error registering count_link_zebpay: %w", err)
//}

return &Metric{cntLinkZP: clzp}, nil
return &Metric{cntLinkZP: prometheus.NewCounterVec(prometheus.CounterOpts{}, []string{})}, nil
}

func (m *Metric) LinkSuccessZP(cc string) {
Expand Down

0 comments on commit c64206a

Please sign in to comment.