Skip to content

Commit

Permalink
Remove noisy logging in favor of a metric
Browse files Browse the repository at this point in the history
  • Loading branch information
ThatHurleyGuy committed May 31, 2022
1 parent 44ff9f3 commit 65c87e1
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions proxy/connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"crypto/rand"
"fmt"
"io"
"log"
"math/big"
"net"
"runtime/debug"
Expand Down Expand Up @@ -198,7 +199,7 @@ func (c *connection) roundTrip(msg *mongo.Message, isMaster bool, tags []string)
func (c *connection) roundTripWithDualCursor(msg *mongo.Message, primaryRes *mongo.Message, isMaster bool, tags []string) {
dynamic := c.dynamic.ForAddress(c.address)
if dynamic.DualReadFrom != "" {
command, _ := msg.Op.CommandAndCollection()
command, collection := msg.Op.CommandAndCollection()

bigint, err := rand.Int(rand.Reader, big.NewInt(100))
if err != nil {
Expand Down Expand Up @@ -238,11 +239,9 @@ func (c *connection) roundTripWithDualCursor(msg *mongo.Message, primaryRes *mon
return
}

if bytes.Equal(primSection, dualSection) {
c.log.Info("Dual reads match", zap.String("real_socket", c.address), zap.String("test_socket", dynamic.DualReadFrom))
} else {
c.log.Info("Dual reads mismatch", zap.String("real_socket", c.address), zap.String("test_socket", dynamic.DualReadFrom))
}
match := bytes.Equal(primSection, dualSection)
// TODO: add timing to compare primary and secondary performance
c.statsd.Incr("dual_read_result", []string{fmt.Sprintf("collection:%s,match:%t", collection, match)}, 1)
}
}
}

0 comments on commit 65c87e1

Please sign in to comment.