Skip to content

Commit

Permalink
fix health check (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
timcovar authored Jan 26, 2024
1 parent 3b4537f commit de9ef03
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/server/server_impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ func newServer(s settings.Settings, name string, statsManager stats.Manager, loc
ret.router = mux.NewRouter()

// setup healthcheck path
ret.health = NewHealthChecker(health.NewServer(), "ratelimit", s.HealthyWithAtLeastOneConfigLoaded)
ret.health = NewHealthChecker(health.NewServer(), name, s.HealthyWithAtLeastOneConfigLoaded)
ret.router.Path("/healthcheck").Handler(ret.health)
healthpb.RegisterHealthServer(ret.grpcServer, ret.health.Server())

Expand Down
2 changes: 1 addition & 1 deletion src/service_cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ import (
)

func main() {
runner := runner.NewRunner(settings.NewSettings())
runner := runner.NewRunner("ratelimit", settings.NewSettings())
runner.Run()
}
6 changes: 4 additions & 2 deletions src/service_cmd/runner/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,16 @@ import (
)

type Runner struct {
name string
statsManager stats.Manager
settings settings.Settings
srv server.Server
mu sync.Mutex
}

func NewRunner(s settings.Settings) Runner {
func NewRunner(name string, s settings.Settings) Runner {
return Runner{
name: name,
statsManager: stats.NewStatManager(gostats.NewDefaultStore(), s),
settings: s,
}
Expand Down Expand Up @@ -111,7 +113,7 @@ func (runner *Runner) Run() {

serverReporter := metrics.NewServerReporter(runner.statsManager.GetStatsStore().ScopeWithTags("ratelimit_server", s.ExtraTags))

srv := server.NewServer(s, "ratelimit", runner.statsManager, localCache, settings.GrpcUnaryInterceptor(serverReporter.UnaryServerInterceptor()))
srv := server.NewServer(s, runner.name, runner.statsManager, localCache, settings.GrpcUnaryInterceptor(serverReporter.UnaryServerInterceptor()))
runner.mu.Lock()
runner.srv = srv
runner.mu.Unlock()
Expand Down
2 changes: 1 addition & 1 deletion test/integration/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -694,7 +694,7 @@ func testBasicBaseConfig(s settings.Settings) func(*testing.T) {

func startTestRunner(t *testing.T, s settings.Settings) *runner.Runner {
t.Helper()
runner := runner.NewRunner(s)
runner := runner.NewRunner("ratelimit", s)

go func() {
// Catch a panic() to ensure that test name is printed.
Expand Down

0 comments on commit de9ef03

Please sign in to comment.