Loading...
Loading...
Serverpod health endpoints — /livez, /readyz, /startupz, custom HealthIndicator, HealthConfig. Use when configuring Kubernetes probes or monitoring server health.
npx skill4agent add serverpod/serverpod serverpod-health-checks/livez/readyz/startupzclass StripeApiIndicator extends HealthIndicator<double> {
String get name => 'stripe:api';
String get componentType => HealthComponentType.component.name;
String get observedUnit => 'ms';
Duration get timeout => const Duration(seconds: 3);
Future<HealthCheckResult> check() async {
final sw = Stopwatch()..start();
try {
await stripeClient.ping();
return pass(observedValue: sw.elapsedMilliseconds.toDouble());
} catch (e) {
return fail(output: 'Stripe unavailable: $e');
}
}
}final pod = Serverpod(
args,
healthConfig: HealthConfig(
cacheTtl: Duration(seconds: 2), // default is 1 second
additionalReadinessIndicators: [StripeApiIndicator()],
additionalStartupIndicators: [CacheWarmupIndicator()],
),
);timeoutcacheTtlGET //livez/readyz/startupz