Skip to content

Commit

Permalink
Vtgateproxy rework discovery and add metrics (#296)
Browse files Browse the repository at this point in the history
* refactor a bit more to consolidate the command line flags

* rework again to have a single parser and move around all the logic

This way we only have a single entity watching the file and dispatching out to
the resolvers when things change rather than a bunch of tickers watching the
file. Also cleaned up the code a bunch.

* redo the shuffle to be a single pass

* actually use the builder rand not the global one

* add some metrics

* only stat once per second

* split out counter for unknown affinity
  • Loading branch information
demmer authored and dedelala committed Sep 9, 2024
1 parent 9587a41 commit 7720518
Show file tree
Hide file tree
Showing 3 changed files with 294 additions and 177 deletions.
6 changes: 0 additions & 6 deletions go/cmd/vtgateproxy/vtgateproxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,13 @@ limitations under the License.
package main

import (
"math/rand"
"time"

"vitess.io/vitess/go/exit"
"vitess.io/vitess/go/stats/prometheusbackend"
"vitess.io/vitess/go/vt/servenv"
"vitess.io/vitess/go/vt/vtgateproxy"
)

func init() {
rand.Seed(time.Now().UnixNano())
servenv.RegisterDefaultFlags()
}

Expand All @@ -40,8 +36,6 @@ func main() {
prometheusbackend.Init("vtgateproxy")

servenv.OnRun(func() {
// Flags are parsed now. Parse the template using the actual flag value and overwrite the current template.
vtgateproxy.RegisterJsonDiscovery()
vtgateproxy.Init()
})

Expand Down
Loading

0 comments on commit 7720518

Please sign in to comment.