diff --git a/examples/single-file-example/hooks/main.go b/examples/single-file-example/hooks/main.go index ba5da930..ef88962d 100644 --- a/examples/single-file-example/hooks/main.go +++ b/examples/single-file-example/hooks/main.go @@ -53,6 +53,7 @@ func Handle(_ context.Context, input *pkg.HookInput) error { return nil } +// func ReadinessFunc(ctx context.Context, input *pkg.ReadinessInput) error { func ReadinessFunc(ctx context.Context, input *pkg.HookInput) error { input.Logger.Info("start user logic for readiness probe") diff --git a/pkg/app/app_config.go b/pkg/app/app_config.go index 29dcb1a5..48e33e0e 100644 --- a/pkg/app/app_config.go +++ b/pkg/app/app_config.go @@ -38,6 +38,7 @@ type readinessConfig struct { IntervalInSeconds uint8 `env:"INTERVAL_IN_SECONDS"` // TODO: not implemented Threshold int + // ProbeFunc func(ctx context.Context, input *pkg.ReadinessInput) error ProbeFunc func(ctx context.Context, input *pkg.HookInput) error } diff --git a/pkg/app/options.go b/pkg/app/options.go index 7b446691..a4045203 100644 --- a/pkg/app/options.go +++ b/pkg/app/options.go @@ -31,7 +31,8 @@ func WithReadiness(cfg *ReadinessConfig) RunConfigOption { type ReadinessConfig struct { IntervalInSeconds uint8 - ProbeFunc func(ctx context.Context, input *pkg.HookInput) error + // ProbeFunc func(ctx context.Context, input *pkg.ReadinessInput) error + ProbeFunc func(ctx context.Context, input *pkg.HookInput) error } func WithSettingsCheck(check settingscheck.Check) RunConfigOption { diff --git a/pkg/hook.go b/pkg/hook.go index 3c5208be..b9ede3e1 100644 --- a/pkg/hook.go +++ b/pkg/hook.go @@ -81,6 +81,16 @@ type ApplicationHookInput struct { Logger Logger } +type ReadinessInput struct { + Values ReadableValuesCollector + ConfigValues ReadableValuesCollector + MetricsCollector MetricsCollector + + DC DependencyContainer + + Logger Logger +} + // Instance provides access to application instance metadata. type Instance interface { // Name returns application instance name