diff --git a/packages/phone-number-privacy/combiner/src/common/crypto-clients/crypto-client.ts b/packages/phone-number-privacy/combiner/src/common/crypto-clients/crypto-client.ts index 2fd8580420a..c57783a3051 100644 --- a/packages/phone-number-privacy/combiner/src/common/crypto-clients/crypto-client.ts +++ b/packages/phone-number-privacy/combiner/src/common/crypto-clients/crypto-client.ts @@ -1,5 +1,6 @@ import { ErrorMessage, KeyVersionInfo } from '@celo/phone-number-privacy-common' import Logger from 'bunyan' +import { performance } from 'perf_hooks' export interface ServicePartialSignature { url: string @@ -38,7 +39,17 @@ export abstract class CryptoClient { `${ErrorMessage.NOT_ENOUGH_PARTIAL_SIGNATURES} ${this.allSignaturesLength}/${threshold}` ) } - return this._combineBlindedSignatureShares(blindedMessage, logger) + + const start = `Start combineBlindedSignatureShares` + const end = `End combineBlindedSignatureShares` + performance.mark(start) + + const combinedSignature = this._combineBlindedSignatureShares(blindedMessage, logger) + + performance.mark(end) + performance.measure('combineBlindedSignatureShares', start, end) + + return combinedSignature } /* diff --git a/packages/phone-number-privacy/signer/src/pnp/endpoints/sign/action.ts b/packages/phone-number-privacy/signer/src/pnp/endpoints/sign/action.ts index 19982f13306..4ffe7151d91 100644 --- a/packages/phone-number-privacy/signer/src/pnp/endpoints/sign/action.ts +++ b/packages/phone-number-privacy/signer/src/pnp/endpoints/sign/action.ts @@ -11,7 +11,7 @@ import { computeBlindedSignature } from '../../../common/bls/bls-cryptography-cl import { REQUESTS_TABLE } from '../../../common/database/models/request' import { getRequestExists } from '../../../common/database/wrappers/request' import { DefaultKeyName, Key, KeyProvider } from '../../../common/key-management/key-provider-base' -import { Counters } from '../../../common/metrics' +import { Counters, Histograms, meter } from '../../../common/metrics' import { SignerConfig } from '../../../config' import { PnpQuotaService } from '../../services/quota' import { PnpSession } from '../../session' @@ -113,10 +113,14 @@ export class PnpSignAction implements Action { } try { - const signature = await this.sign( - session.request.body.blindedQueryPhoneNumber, - key, - session + const signature = await meter( + this.sign, + [session.request.body.blindedQueryPhoneNumber, key, session], + (err: any) => { + throw err + }, + Histograms.getBlindedSigInstrumentation, + ['sign'] ) this.io.sendSuccess(200, session.response, key, signature, quotaStatus, session.errors) return