Skip to content

Commit 80da652

Browse files
authored
Merge pull request #19853 from mozilla/FXA-12846
chore(event-broker): Stop including clientId in statsd
2 parents 376c36e + 6e53eff commit 80da652

2 files changed

Lines changed: 19 additions & 5 deletions

File tree

packages/fxa-event-broker/src/queueworker/queueworker.service.spec.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -359,11 +359,19 @@ describe('QueueworkerService', () => {
359359
webHookService.hasWebhookRegistered = jest.fn().mockReturnValue(false);
360360
const msg = updateStubMessage(baseDeleteMessage);
361361
await (service as any).handleMessage(msg);
362-
expect(logger.debug).toBeCalledTimes(3);
362+
expect(logger.debug).toHaveBeenCalledTimes(3);
363+
363364
expect(logger.debug.mock.calls[1][0]).toBe('noWebhookRegistered');
364-
expect(metrics.increment).toBeCalledWith('message.webhookNotFound', {
365-
clientId: baseLoginMessage.clientId,
365+
expect(logger.debug.mock.calls[1][1]).toEqual({
366+
clientId: '444c5d137fc34d82ae65441d7f26a504',
367+
eventType: 'delete',
366368
});
369+
expect(metrics.increment).toHaveBeenCalledWith(
370+
'message.webhookNotFound',
371+
{
372+
eventType: 'delete',
373+
}
374+
);
367375
});
368376
});
369377
});

packages/fxa-event-broker/src/queueworker/queueworker.service.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,11 +134,17 @@ export class QueueworkerService
134134
* Publish a message to the pubsub topic for the client.
135135
*/
136136
private async publishMessage(clientId: string, json: any) {
137+
const eventType = json.event ?? 'unknown';
137138
// Ensure clientId is normalized
138139
clientId = clientId.toLowerCase();
139140
if (!this.clientWebhooks.hasWebhookRegistered(clientId)) {
140-
this.log.debug('noWebhookRegistered', { clientId });
141-
this.metrics.increment('message.webhookNotFound', { clientId });
141+
this.log.debug('noWebhookRegistered', {
142+
clientId,
143+
eventType,
144+
});
145+
this.metrics.increment('message.webhookNotFound', {
146+
eventType,
147+
});
142148
return;
143149
}
144150
const topicName = this.topicPrefix + clientId;

0 commit comments

Comments
 (0)