Skip to content

Commit

Permalink
zrok office hours miscellany (#771)
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelquigley committed Nov 1, 2024
1 parent a7e1c45 commit a0e7b5a
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 434 deletions.
14 changes: 7 additions & 7 deletions canary/looper.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,20 +28,20 @@ type LooperResults struct {
}

func ReportLooperResults(results []*LooperResults) {
totalXfer := uint64(0)
totalBytes := uint64(0)
totalXferRate := uint64(0)
totalErrors := uint(0)
totalMismatches := uint(0)
totalLoops := uint(0)
for i, result := range results {
totalBytes += result.Bytes
deltaSeconds := result.StopTime.Sub(result.StartTime).Seconds()
xfer := uint64(float64(result.Bytes) / deltaSeconds)
totalXfer += xfer
xferRate := uint64(float64(result.Bytes) / deltaSeconds)
totalXferRate += xferRate
totalErrors += result.Errors
totalMismatches += result.Mismatches
xferSec := util.BytesToSize(int64(xfer))
totalLoops += result.Loops
logrus.Infof("looper #%d: %d loops, %d errors, %d mismatches, %s/sec", i, result.Loops, result.Errors, result.Mismatches, xferSec)
logrus.Infof("looper #%d: %d loops, %v, %d errors, %d mismatches, %s/sec", i, result.Loops, util.BytesToSize(int64(result.Bytes)), result.Errors, result.Mismatches, util.BytesToSize(int64(xferRate)))
}
totalXferSec := util.BytesToSize(int64(totalXfer))
logrus.Infof("total: %d loops, %d errors, %d mismatches, %s/sec", totalLoops, totalErrors, totalMismatches, totalXferSec)
logrus.Infof("total: %d loops, %v, %d errors, %d mismatches, %s/sec", totalLoops, util.BytesToSize(int64(totalBytes)), totalErrors, totalMismatches, util.BytesToSize(int64(totalXferRate)))
}
8 changes: 1 addition & 7 deletions canary/publicHttpLooper.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,6 @@ func NewPublicHttpLooper(id uint, frontend string, opt *LooperOptions, root env_
func (l *PublicHttpLooper) Run() {
defer close(l.done)
defer logrus.Infof("#%d stopping", l.id)
defer func() {
if r := recover(); r != nil {
logrus.Errorf("#%d: %v", l.id, r)
panic(r)
}
}()
logrus.Infof("#%d starting", l.id)

if err := l.startup(); err != nil {
Expand Down Expand Up @@ -122,7 +116,7 @@ func (l *PublicHttpLooper) bindListener() error {

go func() {
if err := http.Serve(l.listener, l); err != nil {
logrus.Errorf("#%d error starting http listener: %v", l.id, err)
logrus.Errorf("#%d error in http listener: %v", l.id, err)
}
}()

Expand Down
7 changes: 0 additions & 7 deletions cmd/zrok/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ func init() {
adminCmd.AddCommand(adminListCmd)
adminCmd.AddCommand(adminUpdateCmd)
testCmd.AddCommand(testCanaryCmd)
testCmd.AddCommand(testLoopCmd)
rootCmd.AddCommand(adminCmd)
rootCmd.AddCommand(configCmd)
rootCmd.AddCommand(modifyCmd)
Expand Down Expand Up @@ -104,12 +103,6 @@ var testCanaryCmd = &cobra.Command{
Short: "Utilities for performance management",
}

var testLoopCmd = &cobra.Command{
Use: "loopback",
Aliases: []string{"loop"},
Short: "Loopback testing utilities",
}

func main() {
if err := rootCmd.Execute(); err != nil {
if panicInstead {
Expand Down
1 change: 1 addition & 0 deletions cmd/zrok/testCanaryPeriodic.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ func (cmd *testCanaryPeriodicCommand) run(_ *cobra.Command, _ []string) {
looper.Abort()
}
}()

for _, l := range loopers {
<-l.Done()
}
Expand Down
292 changes: 0 additions & 292 deletions cmd/zrok/testLoopPublic.go

This file was deleted.

Loading

0 comments on commit a0e7b5a

Please sign in to comment.