Skip to content

Commit

Permalink
fix: Prune Unnecessary Logs (#465)
Browse files Browse the repository at this point in the history
Logs are causing machine to run out of space, leading to crashes. I've
removed some logs which are not particularly helpful for debugging
problems anymore. These logs also tend to run basically every single
iteration, bloating logs both on machine and in GCP.
  • Loading branch information
darunrs committed Dec 20, 2023
1 parent d83396c commit e63024a
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 18 deletions.
15 changes: 0 additions & 15 deletions runner/src/dml-handler/dml-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,6 @@ export default class DmlHandler {
const query = `INSERT INTO ${schemaName}."${tableName}" (${keys.join(', ')}) VALUES %L RETURNING *`;

const result = await wrapError(async () => await this.pgClient.query(this.pgClient.format(query, values), []), `Failed to execute '${query}' on ${schemaName}."${tableName}".`);
if (result.rows?.length === 0) {
console.log('No rows were inserted.');
}
return result.rows;
}

Expand All @@ -53,9 +50,6 @@ export default class DmlHandler {
}

const result = await wrapError(async () => await this.pgClient.query(this.pgClient.format(query), values), `Failed to execute '${query}' on ${schemaName}."${tableName}".`);
if (!(result.rows && result.rows.length > 0)) {
console.log('No rows were selected.');
}
return result.rows;
}

Expand All @@ -69,9 +63,6 @@ export default class DmlHandler {
const query = `UPDATE ${schemaName}."${tableName}" SET ${updateParam} WHERE ${whereParam} RETURNING *`;

const result = await wrapError(async () => await this.pgClient.query(this.pgClient.format(query), queryValues), `Failed to execute '${query}' on ${schemaName}."${tableName}".`);
if (!(result.rows && result.rows.length > 0)) {
console.log('No rows were selected.');
}
return result.rows;
}

Expand All @@ -87,9 +78,6 @@ export default class DmlHandler {
const query = `INSERT INTO ${schemaName}."${tableName}" (${keys.join(', ')}) VALUES %L ON CONFLICT (${conflictColumns.join(', ')}) DO UPDATE SET ${updatePlaceholders} RETURNING *`;

const result = await wrapError(async () => await this.pgClient.query(this.pgClient.format(query, values), []), `Failed to execute '${query}' on ${schemaName}."${tableName}".`);
if (result.rows?.length === 0) {
console.log('No rows were inserted or updated.');
}
return result.rows;
}

Expand All @@ -100,9 +88,6 @@ export default class DmlHandler {
const query = `DELETE FROM ${schemaName}."${tableName}" WHERE ${param} RETURNING *`;

const result = await wrapError(async () => await this.pgClient.query(this.pgClient.format(query), values), `Failed to execute '${query}' on ${schemaName}."${tableName}".`);
if (!(result.rows && result.rows.length > 0)) {
console.log('No rows were deleted.');
}
return result.rows;
}
}
3 changes: 1 addition & 2 deletions runner/src/indexer/indexer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export default class Indexer {
const indexerFunction = functions[functionName];

const runningMessage = `Running function ${functionName} on block ${blockHeight}` + (isHistorical ? ' historical backfill' : `, lag is: ${lag?.toString()}ms from block timestamp`);
console.log(runningMessage); // Print the running message to the console (Lambda logs)
console.log(runningMessage); // Print the running message to the console

simultaneousPromises.push(this.writeLog(functionName, blockHeight, runningMessage));

Expand Down Expand Up @@ -192,7 +192,6 @@ export default class Indexer {
}

const tableNamesArray = Array.from(tableNames);
console.log('Retrieved the following table names from schema: ', tableNamesArray);
return Array.from(tableNamesArray);
}

Expand Down
1 change: 0 additions & 1 deletion runner/src/stream-handler/worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ async function blockQueueProducer (workerContext: WorkerContext, streamKey: stri
streamMessageStartId = '0';
continue;
}
console.log(`Fetched ${messages?.length} messages from stream ${streamKey}`);

for (const streamMessage of messages) {
const { id, message } = streamMessage;
Expand Down

0 comments on commit e63024a

Please sign in to comment.