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

chore: improve health check log messages #29787

Merged
merged 2 commits into from
Jul 25, 2023
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: 2 additions & 0 deletions apps/meteor/server/routes/health.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { WebApp } from 'meteor/webapp';

import { isRunningMs } from '../lib/isRunningMs';
import { SystemLogger } from '../lib/logger/system';

WebApp.rawConnectHandlers.use('/health', async function (_req, res) {
res.setHeader('Cache-Control', 'no-cache, no-store, must-revalidate');
Expand All @@ -12,6 +13,7 @@ WebApp.rawConnectHandlers.use('/health', async function (_req, res) {
const { isLastDocDelayed } = await import('../startup/watchDb');

if (isLastDocDelayed()) {
SystemLogger.error('System not healthy due to no real time data received recently');
res.writeHead(500);
res.end('not healthy');
return;
Expand Down
6 changes: 5 additions & 1 deletion ee/apps/ddp-streamer/src/DDPStreamer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,11 @@ export class DDPStreamer extends ServiceClass {
.use(proxy())
.get('/health', async (_req, res) => {
try {
await this.api?.nodeList();
if (!this.api) {
throw new Error('API not available');
}

await this.api.nodeList();
res.end('ok');
} catch (err) {
console.error('Service not healthy', err);
Expand Down
2 changes: 1 addition & 1 deletion ee/apps/stream-hub-service/src/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const PORT = process.env.PORT || 3035;
await api.nodeList();

if (watcher.isLastDocDelayed()) {
throw new Error('not healthy');
throw new Error('No real time data received recently');
}
} catch (err) {
console.error('Service not healthy', err);
Expand Down
Loading