Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix health check #8

Merged
merged 1 commit into from
Jan 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading