From 8e9527bd4a0bd6273d0cfa8868d84d27be2c3863 Mon Sep 17 00:00:00 2001 From: Mohsin Zaidi <2236875+smrz2001@users.noreply.github.com> Date: Wed, 12 Jun 2024 16:53:20 -0600 Subject: [PATCH] fix: append pid to metrics instance identifier (#1227) --- src/app.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/app.ts b/src/app.ts index 5f0f9a5a..ccd3d443 100644 --- a/src/app.ts +++ b/src/app.ts @@ -126,9 +126,12 @@ export class CeramicAnchorApp { this.config.metrics.exportTimeoutMillis ) Metrics.count('HELLO', 1) - logger.imp('Metrics exporter started') + logger.imp( + `Metrics exporter started for instance "${this.config.metrics.instanceIdentifier}" and process ID ${process.pid}` + ) if (this.config.metrics.instanceIdentifier) { - Metrics.setInstanceIdentifier(this.config.metrics.instanceIdentifier) + // Append the PID to the metrics identifier to ensure uniqueness with clustering + Metrics.setInstanceIdentifier(this.config.metrics.instanceIdentifier + '_' + process.pid) } } catch (e: any) { logger.imp('ERROR: Metrics exporter failed to start. Continuing anyway.')