From 731504fa0a3a05f8d0c061975b6ecb62399da653 Mon Sep 17 00:00:00 2001 From: Brett Hoerner Date: Wed, 4 Oct 2023 07:09:06 -0600 Subject: [PATCH] chore(plugin-server): switch console.log usage to status (#17741) --- plugin-server/src/utils/db/utils.ts | 3 ++- plugin-server/src/worker/ingestion/app-metrics.ts | 4 ++-- plugin-server/src/worker/ingestion/hooks.ts | 10 ++++++---- plugin-server/src/worker/plugins/run.ts | 4 +--- 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/plugin-server/src/utils/db/utils.ts b/plugin-server/src/utils/db/utils.ts index a242445047cff..14349848ff619 100644 --- a/plugin-server/src/utils/db/utils.ts +++ b/plugin-server/src/utils/db/utils.ts @@ -6,6 +6,7 @@ import { DateTime } from 'luxon' import { defaultConfig } from '../../config/config' import { KAFKA_PERSON } from '../../config/kafka-topics' import { BasePerson, Person, RawPerson, TimestampFormat } from '../../types' +import { status } from '../../utils/status' import { castTimestampOrNow } from '../../utils/utils' import { PluginLogEntrySource, PluginLogEntryType, PluginLogLevel } from './../../types' @@ -35,7 +36,7 @@ export function timeoutGuard( ): NodeJS.Timeout { return setTimeout(() => { const ctx = typeof context === 'function' ? context() : context - console.log(`⌛⌛⌛ ${message}`, ctx) + status.warn('⌛', message, ctx) Sentry.captureMessage(message, ctx ? { extra: ctx } : undefined) }, timeout) } diff --git a/plugin-server/src/worker/ingestion/app-metrics.ts b/plugin-server/src/worker/ingestion/app-metrics.ts index 333104e967d4a..6cf4297cda476 100644 --- a/plugin-server/src/worker/ingestion/app-metrics.ts +++ b/plugin-server/src/worker/ingestion/app-metrics.ts @@ -136,7 +136,7 @@ export class AppMetrics { } async flush(): Promise { - console.log(`Flushing app metrics`) + status.debug('🚽', `Flushing app metrics`) const startTime = Date.now() this.lastFlushTime = startTime if (Object.keys(this.queuedData).length === 0) { @@ -170,7 +170,7 @@ export class AppMetrics { topic: KAFKA_APP_METRICS, messages: kafkaMessages, }) - console.log(`Finisehd flushing app metrics, took ${Date.now() - startTime}ms`) + status.debug('🚽', `Finished flushing app metrics, took ${Date.now() - startTime}ms`) } _metricErrorParameters(errorWithContext: ErrorWithContext): Partial { diff --git a/plugin-server/src/worker/ingestion/hooks.ts b/plugin-server/src/worker/ingestion/hooks.ts index c2bab8f9e3a42..85464a075a567 100644 --- a/plugin-server/src/worker/ingestion/hooks.ts +++ b/plugin-server/src/worker/ingestion/hooks.ts @@ -359,8 +359,9 @@ export class HookCommander { end() const timeout = setTimeout(() => { - console.log( - `⌛⌛⌛ Posting Webhook slow. Timeout warning after 5 sec! url=${webhookUrl} team_id=${team.id} event_id=${event.eventUuid}` + status.warn( + '⌛', + `Posting Webhook slow. Timeout warning after 5 sec! url=${webhookUrl} team_id=${team.id} event_id=${event.eventUuid}` ) }, 5000) const relevantFetch = @@ -404,8 +405,9 @@ export class HookCommander { } const timeout = setTimeout(() => { - console.log( - `⌛⌛⌛ Posting RestHook slow. Timeout warning after 5 sec! url=${hook.target} team_id=${event.teamId} event_id=${event.eventUuid}` + status.warn( + '⌛', + `Posting RestHook slow. Timeout warning after 5 sec! url=${hook.target} team_id=${event.teamId} event_id=${event.eventUuid}` ) }, 5000) const relevantFetch = diff --git a/plugin-server/src/worker/plugins/run.ts b/plugin-server/src/worker/plugins/run.ts index b118f23665971..2d5a982ab8532 100644 --- a/plugin-server/src/worker/plugins/run.ts +++ b/plugin-server/src/worker/plugins/run.ts @@ -13,9 +13,7 @@ async function runSingleTeamPluginOnEvent( onEvent: any ): Promise { const timeout = setTimeout(() => { - console.log( - `⌛⌛⌛ Still running single onEvent plugin for team ${event.team_id} for plugin ${pluginConfig.id}` - ) + status.warn('⌛', `Still running single onEvent plugin for team ${event.team_id} for plugin ${pluginConfig.id}`) }, 10 * 1000) // 10 seconds try { // Runs onEvent for a single plugin without any retries