From ce5a4d1ef159672c146203f3b352d87ca8525af9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20Adel=C3=B6w?= Date: Sun, 20 Apr 2025 15:36:34 +0200 Subject: [PATCH] emit metrics per task id, not event topic MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Fredrik Adelöw --- .../GooglePubSubConsumingEventPublisher.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/plugins/events-backend-module-google-pubsub/src/GooglePubSubConsumingEventPublisher/GooglePubSubConsumingEventPublisher.ts b/plugins/events-backend-module-google-pubsub/src/GooglePubSubConsumingEventPublisher/GooglePubSubConsumingEventPublisher.ts index 0461c2da51..4844c216fb 100644 --- a/plugins/events-backend-module-google-pubsub/src/GooglePubSubConsumingEventPublisher/GooglePubSubConsumingEventPublisher.ts +++ b/plugins/events-backend-module-google-pubsub/src/GooglePubSubConsumingEventPublisher/GooglePubSubConsumingEventPublisher.ts @@ -130,7 +130,7 @@ export class GooglePubSubConsumingEventPublisher { event = this.#messageToEvent(message, task)!; if (!event) { this.#metrics.messages.add(1, { - topic: 'unknown', + subscription: task.id, status: 'ignored', }); return; @@ -138,7 +138,7 @@ export class GooglePubSubConsumingEventPublisher { } catch (error) { this.#logger.error('Error processing Google Pub/Sub message', error); this.#metrics.messages.add(1, { - topic: 'unknown', + subscription: task.id, status: 'failed', }); // We unconditionally ACK the message in this case, because if it's @@ -151,14 +151,14 @@ export class GooglePubSubConsumingEventPublisher { try { await this.#events.publish(event); this.#metrics.messages.add(1, { - topic: event.topic, + subscription: task.id, status: 'success', }); message.ack(); } catch (error) { this.#logger.error('Error processing Google Pub/Sub message', error); this.#metrics.messages.add(1, { - topic: event.topic, + subscription: task.id, status: 'failed', }); // We fast-NACK the message in this case because this may be a