Skip to content

Commit a0e7b5a

Browse files
zrok office hours miscellany (#771)
1 parent a7e1c45 commit a0e7b5a

6 files changed

+9
-434
lines changed

canary/looper.go

+7-7
Original file line numberDiff line numberDiff line change
@@ -28,20 +28,20 @@ type LooperResults struct {
2828
}
2929

3030
func ReportLooperResults(results []*LooperResults) {
31-
totalXfer := uint64(0)
31+
totalBytes := uint64(0)
32+
totalXferRate := uint64(0)
3233
totalErrors := uint(0)
3334
totalMismatches := uint(0)
3435
totalLoops := uint(0)
3536
for i, result := range results {
37+
totalBytes += result.Bytes
3638
deltaSeconds := result.StopTime.Sub(result.StartTime).Seconds()
37-
xfer := uint64(float64(result.Bytes) / deltaSeconds)
38-
totalXfer += xfer
39+
xferRate := uint64(float64(result.Bytes) / deltaSeconds)
40+
totalXferRate += xferRate
3941
totalErrors += result.Errors
4042
totalMismatches += result.Mismatches
41-
xferSec := util.BytesToSize(int64(xfer))
4243
totalLoops += result.Loops
43-
logrus.Infof("looper #%d: %d loops, %d errors, %d mismatches, %s/sec", i, result.Loops, result.Errors, result.Mismatches, xferSec)
44+
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)))
4445
}
45-
totalXferSec := util.BytesToSize(int64(totalXfer))
46-
logrus.Infof("total: %d loops, %d errors, %d mismatches, %s/sec", totalLoops, totalErrors, totalMismatches, totalXferSec)
46+
logrus.Infof("total: %d loops, %v, %d errors, %d mismatches, %s/sec", totalLoops, util.BytesToSize(int64(totalBytes)), totalErrors, totalMismatches, util.BytesToSize(int64(totalXferRate)))
4747
}

canary/publicHttpLooper.go

+1-7
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,6 @@ func NewPublicHttpLooper(id uint, frontend string, opt *LooperOptions, root env_
4242
func (l *PublicHttpLooper) Run() {
4343
defer close(l.done)
4444
defer logrus.Infof("#%d stopping", l.id)
45-
defer func() {
46-
if r := recover(); r != nil {
47-
logrus.Errorf("#%d: %v", l.id, r)
48-
panic(r)
49-
}
50-
}()
5145
logrus.Infof("#%d starting", l.id)
5246

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

123117
go func() {
124118
if err := http.Serve(l.listener, l); err != nil {
125-
logrus.Errorf("#%d error starting http listener: %v", l.id, err)
119+
logrus.Errorf("#%d error in http listener: %v", l.id, err)
126120
}
127121
}()
128122

cmd/zrok/main.go

-7
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ func init() {
2525
adminCmd.AddCommand(adminListCmd)
2626
adminCmd.AddCommand(adminUpdateCmd)
2727
testCmd.AddCommand(testCanaryCmd)
28-
testCmd.AddCommand(testLoopCmd)
2928
rootCmd.AddCommand(adminCmd)
3029
rootCmd.AddCommand(configCmd)
3130
rootCmd.AddCommand(modifyCmd)
@@ -104,12 +103,6 @@ var testCanaryCmd = &cobra.Command{
104103
Short: "Utilities for performance management",
105104
}
106105

107-
var testLoopCmd = &cobra.Command{
108-
Use: "loopback",
109-
Aliases: []string{"loop"},
110-
Short: "Loopback testing utilities",
111-
}
112-
113106
func main() {
114107
if err := rootCmd.Execute(); err != nil {
115108
if panicInstead {

cmd/zrok/testCanaryPeriodic.go

+1
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ func (cmd *testCanaryPeriodicCommand) run(_ *cobra.Command, _ []string) {
8888
looper.Abort()
8989
}
9090
}()
91+
9192
for _, l := range loopers {
9293
<-l.Done()
9394
}

cmd/zrok/testLoopPublic.go

-292
This file was deleted.

0 commit comments

Comments
 (0)