Skip to content

Commit

Permalink
SIGUSR debug level toggle
Browse files Browse the repository at this point in the history
  • Loading branch information
mkobetic committed Aug 29, 2023
1 parent 8dc8d57 commit a5b29fc
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
11 changes: 11 additions & 0 deletions cmd/xmtpd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
"github.com/jessevdk/go-flags"
"github.com/pkg/errors"
"github.com/status-im/go-waku/waku/v2/utils"
"github.com/xmtp/xmtp-node-go/pkg/logging"
"github.com/xmtp/xmtp-node-go/pkg/server"
"github.com/xmtp/xmtp-node-go/pkg/tracing"
"go.uber.org/zap"
Expand Down Expand Up @@ -150,6 +151,16 @@ func main() {
doneC <- true
})

// Toggle debug level on SIGUSR1
sigToggleC := make(chan os.Signal, 1)
signal.Notify(sigToggleC, syscall.SIGUSR1)
go func() {
for range sigToggleC {
log.Info("toggling debug level")
logging.ToggleDebugLevel()
}
}()

sigC := make(chan os.Signal, 1)
signal.Notify(sigC,
syscall.SIGHUP,
Expand Down
2 changes: 1 addition & 1 deletion dev/aws-shell
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

region="${REGION:-us-east-2}"
cluster="${ENV:-dev}"
task="${TASK:-node-0}"
task="${TASK:-group1-node-0}"
container="${CONTAINER:-$task}"
task=$(aws --region "$region" \
--query 'taskArns[0]' \
Expand Down
2 changes: 1 addition & 1 deletion pkg/metrics/api-limits.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ var ratelimiterBucketsDeletedCounterView = &view.View{
}

func EmitRatelimiterDeletedEntries(ctx context.Context, name string, count int) {
err := recordWithTags(ctx, []tag.Mutator{tag.Insert(bucketsNameKey, name)}, ratelimiterBucketsGaugeMeasure.M(int64(count)))
err := recordWithTags(ctx, []tag.Mutator{tag.Insert(bucketsNameKey, name)}, ratelimiterBucketsDeletedCounterMeasure.M(int64(count)))
if err != nil {
logging.From(ctx).Warn("recording metric",
zap.String("metric", ratelimiterBucketsDeletedCounterMeasure.Name()),
Expand Down

0 comments on commit a5b29fc

Please sign in to comment.