diff --git a/typescript/infra/helm/helloworld-kathy/templates/stateful-set.yaml b/typescript/infra/helm/helloworld-kathy/templates/stateful-set.yaml index 42744af4d..1533530e7 100644 --- a/typescript/infra/helm/helloworld-kathy/templates/stateful-set.yaml +++ b/typescript/infra/helm/helloworld-kathy/templates/stateful-set.yaml @@ -15,6 +15,9 @@ spec: template: metadata: labels: *metadata_labels + annotations: + prometheus.io/port: "9090" + prometheus.io/scrape: "true" spec: containers: - name: helloworld-kathy diff --git a/typescript/infra/scripts/helloworld/kathy.ts b/typescript/infra/scripts/helloworld/kathy.ts index 3de18fd70..af24f86ac 100644 --- a/typescript/infra/scripts/helloworld/kathy.ts +++ b/typescript/infra/scripts/helloworld/kathy.ts @@ -116,6 +116,15 @@ async function main() { }); }, sendFrequency); + // init the metrics because it can take a while for kathy to get through everything and we do not + // want the metrics to be reported as null in the meantime. + for (const { origin, destination: remote } of pairings) { + messagesSendCount.labels({ origin, remote, status: 'success' }).inc(0); + messagesSendCount.labels({ origin, remote, status: 'failure' }).inc(0); + messageSendSeconds.labels({ origin, remote }).inc(0); + messageReceiptSeconds.labels({ origin, remote }).inc(0); + } + for ( // in case we are restarting kathy, keep it from always running the exact same messages first let currentPairingIndex = Date.now() % pairings.length; diff --git a/typescript/utils/src/utils.ts b/typescript/utils/src/utils.ts index 90a5bd39d..e137c7363 100644 --- a/typescript/utils/src/utils.ts +++ b/typescript/utils/src/utils.ts @@ -181,7 +181,7 @@ export function timeout( if (!timeoutMs || timeoutMs <= 0) return promise; return new Promise((resolve, reject) => { setTimeout(() => { - throw new Error(message); + reject(new Error(message)); }, timeoutMs); promise.then(resolve).catch(reject); });