diff --git a/plugin-server/src/cdp/cdp-consumers.ts b/plugin-server/src/cdp/cdp-consumers.ts index 425cd69698c35..f738b559a0523 100644 --- a/plugin-server/src/cdp/cdp-consumers.ts +++ b/plugin-server/src/cdp/cdp-consumers.ts @@ -209,7 +209,7 @@ abstract class CdpConsumerBase { instance_id: new UUIDT().toString(), // random UUID, like it would be for an invocation timestamp: castTimestampOrNow(null, TimestampFormat.ClickHouse), level: 'error', - message: `Error filtering: ${error}`, + message: error, } this.messagesToProduce.push({ diff --git a/plugin-server/src/cdp/hog-executor.ts b/plugin-server/src/cdp/hog-executor.ts index b1af237213b08..631f8c8438444 100644 --- a/plugin-server/src/cdp/hog-executor.ts +++ b/plugin-server/src/cdp/hog-executor.ts @@ -110,13 +110,13 @@ export class HogExecutor { this.telemetryMatcher = buildIntegerMatcher(this.hub.CDP_HOG_FILTERS_TELEMETRY_TEAMS, true) } - findMatchingFunctions(event: HogFunctionInvocationGlobals): { + findMatchingFunctions(globals: HogFunctionInvocationGlobals): { matchingFunctions: HogFunctionType[] nonMatchingFunctions: HogFunctionType[] erroredFunctions: [HogFunctionType, string][] } { - const allFunctionsForTeam = this.hogFunctionManager.getTeamHogDestinations(event.project.id) - const filtersGlobals = convertToHogFunctionFilterGlobal(event) + const allFunctionsForTeam = this.hogFunctionManager.getTeamHogDestinations(globals.project.id) + const filtersGlobals = convertToHogFunctionFilterGlobal(globals) const nonMatchingFunctions: HogFunctionType[] = [] const matchingFunctions: HogFunctionType[] = [] @@ -143,7 +143,10 @@ export class HogExecutor { error: filterResult.error.message, result: filterResult, }) - erroredFunctions.push([hogFunction, filterResult.error.message]) + erroredFunctions.push([ + hogFunction, + `Error filtering event ${globals.event.uuid}: ${filterResult.error.message}`, + ]) return } } catch (error) { @@ -153,7 +156,10 @@ export class HogExecutor { teamId: hogFunction.team_id, error: error.message, }) - erroredFunctions.push([hogFunction, error.message]) + erroredFunctions.push([ + hogFunction, + `Error filtering event ${globals.event.uuid}: ${error.message}`, + ]) return } finally { const duration = performance.now() - start @@ -165,7 +171,7 @@ export class HogExecutor { hogFunctionName: hogFunction.name, teamId: hogFunction.team_id, duration, - eventId: event.event.uuid, + eventId: globals.event.uuid, }) } } diff --git a/plugin-server/tests/cdp/cdp-processed-events-consumer.test.ts b/plugin-server/tests/cdp/cdp-processed-events-consumer.test.ts index 66487f202f374..c559a4240fca4 100644 --- a/plugin-server/tests/cdp/cdp-processed-events-consumer.test.ts +++ b/plugin-server/tests/cdp/cdp-processed-events-consumer.test.ts @@ -377,7 +377,8 @@ describe('CDP Processed Events Consumer', () => { { topic: 'log_entries_test', value: { - message: 'Error filtering: Invalid HogQL bytecode, stack is empty, can not pop', + message: + 'Error filtering event b3a1fe86-b10c-43cc-acaf-d208977608d0: Invalid HogQL bytecode, stack is empty, can not pop', }, }, ])