diff options
author | Marco Boss <bossm8@bfh.ch> | 2022-03-14 20:06:07 +0100 |
---|---|---|
committer | Marco Boss <bossm8@bfh.ch> | 2022-03-14 20:06:07 +0100 |
commit | 7529939a0f7af04c9435cd985a3d4729935634e1 (patch) | |
tree | 5a5dccb30ad8be058ab0910d163994fefc73e842 /src | |
parent | 687f0cab82869216289c62ac42acd9c8a6bbf59f (diff) |
add metrics for number of crypto operations
Diffstat (limited to 'src')
31 files changed, 113 insertions, 45 deletions
diff --git a/src/exchange/taler-exchange-httpd_auditors.c b/src/exchange/taler-exchange-httpd_auditors.c index b32feff7d..ed86bacec 100644 --- a/src/exchange/taler-exchange-httpd_auditors.c +++ b/src/exchange/taler-exchange-httpd_auditors.c @@ -140,6 +140,7 @@ add_auditor_denom_sig (void *cls, TALER_B2S (awc->auditor_pub)); return GNUNET_DB_STATUS_HARD_ERROR; } + TEH_METRICS_num_verifications[TEH_MT_EDDSA]++; if (GNUNET_OK != TALER_auditor_denom_validity_verify ( auditor_url, @@ -213,7 +214,7 @@ TEH_handler_auditors ( return MHD_YES; /* failure */ ret = TEH_DB_run_transaction (connection, "add auditor denom sig", - TEH_MT_OTHER, + TEH_MT_REQUEST_OTHER, &res, &add_auditor_denom_sig, &awc); diff --git a/src/exchange/taler-exchange-httpd_db.c b/src/exchange/taler-exchange-httpd_db.c index d383c471d..da19b7154 100644 --- a/src/exchange/taler-exchange-httpd_db.c +++ b/src/exchange/taler-exchange-httpd_db.c @@ -81,7 +81,7 @@ TEH_make_coin_known (const struct TALER_CoinPublicInfo *coin, enum GNUNET_GenericReturnValue TEH_DB_run_transaction (struct MHD_Connection *connection, const char *name, - enum TEH_MetricType mt, + enum TEH_MetricTypeRequest mt, MHD_RESULT *mhd_ret, TEH_DB_TransactionCallback cb, void *cb_cls) @@ -99,7 +99,7 @@ TEH_DB_run_transaction (struct MHD_Connection *connection, NULL); return GNUNET_SYSERR; } - GNUNET_assert (mt < TEH_MT_COUNT); + GNUNET_assert (mt < TEH_MT_REQUEST_COUNT); TEH_METRICS_num_requests[mt]++; for (unsigned int retries = 0; retries < MAX_TRANSACTION_COMMIT_RETRIES; diff --git a/src/exchange/taler-exchange-httpd_db.h b/src/exchange/taler-exchange-httpd_db.h index bca97cf0a..482bc5923 100644 --- a/src/exchange/taler-exchange-httpd_db.h +++ b/src/exchange/taler-exchange-httpd_db.h @@ -96,7 +96,7 @@ typedef enum GNUNET_DB_QueryStatus enum GNUNET_GenericReturnValue TEH_DB_run_transaction (struct MHD_Connection *connection, const char *name, - enum TEH_MetricType mt, + enum TEH_MetricTypeRequest mt, MHD_RESULT *mhd_ret, TEH_DB_TransactionCallback cb, void *cb_cls); diff --git a/src/exchange/taler-exchange-httpd_deposit.c b/src/exchange/taler-exchange-httpd_deposit.c index 66cbe04ca..b1c91f76c 100644 --- a/src/exchange/taler-exchange-httpd_deposit.c +++ b/src/exchange/taler-exchange-httpd_deposit.c @@ -382,6 +382,7 @@ TEH_handler_deposit (struct MHD_Connection *connection, deposit.deposit_fee = dk->meta.fees.deposit; /* check coin signature */ + TEH_METRICS_num_verifications[TEH_MT_CIPHER]++; if (GNUNET_YES != TALER_test_coin_valid (&deposit.coin, &dk->denom_pub)) @@ -405,6 +406,7 @@ TEH_handler_deposit (struct MHD_Connection *connection, NULL); } + TEH_METRICS_num_verifications[TEH_MT_EDDSA]++; if (GNUNET_OK != TALER_wallet_deposit_verify (&deposit.amount_with_fee, &deposit.deposit_fee, @@ -472,7 +474,7 @@ TEH_handler_deposit (struct MHD_Connection *connection, if (GNUNET_OK != TEH_DB_run_transaction (connection, "execute deposit", - TEH_MT_DEPOSIT, + TEH_MT_REQUEST_DEPOSIT, &mhd_ret, &deposit_transaction, &dc)) diff --git a/src/exchange/taler-exchange-httpd_deposits_get.c b/src/exchange/taler-exchange-httpd_deposits_get.c index fa1b530b2..1e99608c3 100644 --- a/src/exchange/taler-exchange-httpd_deposits_get.c +++ b/src/exchange/taler-exchange-httpd_deposits_get.c @@ -247,7 +247,7 @@ handle_track_transaction_request ( if (GNUNET_OK != TEH_DB_run_transaction (connection, "handle deposits GET", - TEH_MT_OTHER, + TEH_MT_REQUEST_OTHER, &mhd_ret, &deposits_get_transaction, &ctx)) @@ -344,6 +344,7 @@ TEH_handler_deposits_get (struct TEH_RequestContext *rc, return MHD_NO; /* internal error */ if (GNUNET_NO == res) return MHD_YES; /* parse error */ + TEH_METRICS_num_verifications[TEH_MT_EDDSA]++; if (GNUNET_OK != GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_MERCHANT_TRACK_TRANSACTION, &tps, diff --git a/src/exchange/taler-exchange-httpd_keys.c b/src/exchange/taler-exchange-httpd_keys.c index 33f9170d3..fce6d4f1d 100644 --- a/src/exchange/taler-exchange-httpd_keys.c +++ b/src/exchange/taler-exchange-httpd_keys.c @@ -2453,6 +2453,7 @@ TEH_keys_denomination_sign_withdraw ( switch (hd->denom_pub.cipher) { case TALER_DENOMINATION_RSA: + TEH_METRICS_num_signatures[TEH_MT_CIPHER]++; return TALER_CRYPTO_helper_rsa_sign ( ksh->helpers->rsadh, &hd->h_details.h_rsa, @@ -2460,6 +2461,7 @@ TEH_keys_denomination_sign_withdraw ( bp->details.rsa_blinded_planchet.blinded_msg_size, bs); case TALER_DENOMINATION_CS: + TEH_METRICS_num_signatures[TEH_MT_CIPHER]++; return TALER_CRYPTO_helper_cs_sign_withdraw ( ksh->helpers->csdh, &hd->h_details.h_cs, @@ -2492,6 +2494,7 @@ TEH_keys_denomination_sign_melt ( switch (hd->denom_pub.cipher) { case TALER_DENOMINATION_RSA: + TEH_METRICS_num_signatures[TEH_MT_CIPHER]++; return TALER_CRYPTO_helper_rsa_sign ( ksh->helpers->rsadh, &hd->h_details.h_rsa, @@ -2499,6 +2502,7 @@ TEH_keys_denomination_sign_melt ( bp->details.rsa_blinded_planchet.blinded_msg_size, bs); case TALER_DENOMINATION_CS: + TEH_METRICS_num_signatures[TEH_MT_CIPHER]++; return TALER_CRYPTO_helper_cs_sign_melt ( ksh->helpers->csdh, &hd->h_details.h_cs, @@ -2645,6 +2649,7 @@ TEH_keys_exchange_sign2_ ( { enum TALER_ErrorCode ec; + TEH_METRICS_num_signatures[TEH_MT_EDDSA]++; ec = TALER_CRYPTO_helper_esign_sign_ (ksh->helpers->esh, purpose, pub, diff --git a/src/exchange/taler-exchange-httpd_kyc-check.c b/src/exchange/taler-exchange-httpd_kyc-check.c index de6ac42fd..d6b16d219 100644 --- a/src/exchange/taler-exchange-httpd_kyc-check.c +++ b/src/exchange/taler-exchange-httpd_kyc-check.c @@ -345,7 +345,7 @@ TEH_handler_kyc_check ( now = GNUNET_TIME_timestamp_get (); ret = TEH_DB_run_transaction (rc->connection, "kyc check", - TEH_MT_OTHER, + TEH_MT_REQUEST_OTHER, &res, &kyc_check, kyp); diff --git a/src/exchange/taler-exchange-httpd_kyc-proof.c b/src/exchange/taler-exchange-httpd_kyc-proof.c index 333bd733b..f561a95a8 100644 --- a/src/exchange/taler-exchange-httpd_kyc-proof.c +++ b/src/exchange/taler-exchange-httpd_kyc-proof.c @@ -675,7 +675,7 @@ TEH_handler_kyc_proof ( ret = TEH_DB_run_transaction (kpc->rc->connection, "check proof kyc", - TEH_MT_OTHER, + TEH_MT_REQUEST_OTHER, &res, &persist_kyc_ok, kpc); diff --git a/src/exchange/taler-exchange-httpd_kyc-wallet.c b/src/exchange/taler-exchange-httpd_kyc-wallet.c index 4062f9305..da696c9fb 100644 --- a/src/exchange/taler-exchange-httpd_kyc-wallet.c +++ b/src/exchange/taler-exchange-httpd_kyc-wallet.c @@ -118,6 +118,7 @@ TEH_handler_kyc_wallet ( if (GNUNET_NO == ret) return MHD_YES; /* failure */ + TEH_METRICS_num_verifications[TEH_MT_EDDSA]++; if (GNUNET_OK != GNUNET_CRYPTO_eddsa_verify_ (TALER_SIGNATURE_WALLET_ACCOUNT_SETUP, &purpose, @@ -140,7 +141,7 @@ TEH_handler_kyc_wallet ( 0); ret = TEH_DB_run_transaction (rc->connection, "check wallet kyc", - TEH_MT_OTHER, + TEH_MT_REQUEST_OTHER, &res, &wallet_kyc_check, &krc); diff --git a/src/exchange/taler-exchange-httpd_link.c b/src/exchange/taler-exchange-httpd_link.c index 47b803ffa..9b7e297bc 100644 --- a/src/exchange/taler-exchange-httpd_link.c +++ b/src/exchange/taler-exchange-httpd_link.c @@ -203,7 +203,7 @@ TEH_handler_link (struct TEH_RequestContext *rc, if (GNUNET_OK != TEH_DB_run_transaction (rc->connection, "run link", - TEH_MT_OTHER, + TEH_MT_REQUEST_OTHER, &mhd_ret, &link_transaction, &ctx)) diff --git a/src/exchange/taler-exchange-httpd_management_auditors.c b/src/exchange/taler-exchange-httpd_management_auditors.c index 6096cc98b..9c7a5c472 100644 --- a/src/exchange/taler-exchange-httpd_management_auditors.c +++ b/src/exchange/taler-exchange-httpd_management_auditors.c @@ -189,7 +189,7 @@ TEH_handler_management_auditors ( ret = TEH_DB_run_transaction (connection, "add auditor", - TEH_MT_OTHER, + TEH_MT_REQUEST_OTHER, &res, &add_auditor, &aac); diff --git a/src/exchange/taler-exchange-httpd_management_auditors_AP_disable.c b/src/exchange/taler-exchange-httpd_management_auditors_AP_disable.c index 5ae0cbd07..07e2933bb 100644 --- a/src/exchange/taler-exchange-httpd_management_auditors_AP_disable.c +++ b/src/exchange/taler-exchange-httpd_management_auditors_AP_disable.c @@ -178,7 +178,7 @@ TEH_handler_management_auditors_AP_disable ( ret = TEH_DB_run_transaction (connection, "del auditor", - TEH_MT_OTHER, + TEH_MT_REQUEST_OTHER, &res, &del_auditor, &dac); diff --git a/src/exchange/taler-exchange-httpd_management_denominations_HDP_revoke.c b/src/exchange/taler-exchange-httpd_management_denominations_HDP_revoke.c index ec5251a11..425acdcca 100644 --- a/src/exchange/taler-exchange-httpd_management_denominations_HDP_revoke.c +++ b/src/exchange/taler-exchange-httpd_management_denominations_HDP_revoke.c @@ -56,6 +56,7 @@ TEH_handler_management_denominations_HDP_revoke ( if (GNUNET_NO == res) return MHD_YES; /* failure */ } + TEH_METRICS_num_verifications[TEH_MT_EDDSA]++; if (GNUNET_OK != TALER_exchange_offline_denomination_revoke_verify ( h_denom_pub, diff --git a/src/exchange/taler-exchange-httpd_management_extensions.c b/src/exchange/taler-exchange-httpd_management_extensions.c index 41df22f68..109e863d3 100644 --- a/src/exchange/taler-exchange-httpd_management_extensions.c +++ b/src/exchange/taler-exchange-httpd_management_extensions.c @@ -278,7 +278,7 @@ TEH_handler_management_post_extensions ( res = TEH_DB_run_transaction (connection, "set extensions", - TEH_MT_OTHER, + TEH_MT_REQUEST_OTHER, &ret, &set_extensions, &sec); diff --git a/src/exchange/taler-exchange-httpd_management_global_fees.c b/src/exchange/taler-exchange-httpd_management_global_fees.c index 0753da84b..51fbbceb9 100644 --- a/src/exchange/taler-exchange-httpd_management_global_fees.c +++ b/src/exchange/taler-exchange-httpd_management_global_fees.c @@ -221,6 +221,7 @@ TEH_handler_management_post_global_fees ( return MHD_YES; /* failure */ } + TEH_METRICS_num_verifications[TEH_MT_EDDSA]++; if (GNUNET_OK != TALER_exchange_offline_global_fee_verify ( afc.start_time, @@ -248,7 +249,7 @@ TEH_handler_management_post_global_fees ( res = TEH_DB_run_transaction (connection, "add global fee", - TEH_MT_OTHER, + TEH_MT_REQUEST_OTHER, &ret, &add_fee, &afc); diff --git a/src/exchange/taler-exchange-httpd_management_post_keys.c b/src/exchange/taler-exchange-httpd_management_post_keys.c index 93b7252e3..c32da4d44 100644 --- a/src/exchange/taler-exchange-httpd_management_post_keys.c +++ b/src/exchange/taler-exchange-httpd_management_post_keys.c @@ -179,6 +179,7 @@ add_keys (void *cls, } /* check signature is valid */ + TEH_METRICS_num_verifications[TEH_MT_EDDSA]++; if (GNUNET_OK != TALER_exchange_offline_denom_validity_verify ( &d->h_denom_pub, @@ -277,6 +278,7 @@ add_keys (void *cls, } /* check signature is valid */ + TEH_METRICS_num_verifications[TEH_MT_EDDSA]++; if (GNUNET_OK != TALER_exchange_offline_signkey_validity_verify ( &s->exchange_pub, @@ -459,7 +461,7 @@ TEH_handler_management_post_keys ( res = TEH_DB_run_transaction (connection, "add keys", - TEH_MT_OTHER, + TEH_MT_REQUEST_OTHER, &ret, &add_keys, &akc); diff --git a/src/exchange/taler-exchange-httpd_management_signkey_EP_revoke.c b/src/exchange/taler-exchange-httpd_management_signkey_EP_revoke.c index 0d6317b47..5f93b8acc 100644 --- a/src/exchange/taler-exchange-httpd_management_signkey_EP_revoke.c +++ b/src/exchange/taler-exchange-httpd_management_signkey_EP_revoke.c @@ -56,6 +56,7 @@ TEH_handler_management_signkeys_EP_revoke ( if (GNUNET_NO == res) return MHD_YES; /* failure */ } + TEH_METRICS_num_verifications[TEH_MT_EDDSA]++; if (GNUNET_OK != TALER_exchange_offline_signkey_revoke_verify (exchange_pub, &TEH_master_public_key, diff --git a/src/exchange/taler-exchange-httpd_management_wire_disable.c b/src/exchange/taler-exchange-httpd_management_wire_disable.c index d776bc353..34825eda3 100644 --- a/src/exchange/taler-exchange-httpd_management_wire_disable.c +++ b/src/exchange/taler-exchange-httpd_management_wire_disable.c @@ -179,7 +179,7 @@ TEH_handler_management_post_wire_disable ( res = TEH_DB_run_transaction (connection, "del wire", - TEH_MT_OTHER, + TEH_MT_REQUEST_OTHER, &ret, &del_wire, &awc); diff --git a/src/exchange/taler-exchange-httpd_management_wire_enable.c b/src/exchange/taler-exchange-httpd_management_wire_enable.c index 56828eb5e..af6fbecf0 100644 --- a/src/exchange/taler-exchange-httpd_management_wire_enable.c +++ b/src/exchange/taler-exchange-httpd_management_wire_enable.c @@ -165,6 +165,7 @@ TEH_handler_management_post_wire ( if (GNUNET_NO == res) return MHD_YES; /* failure */ } + TEH_METRICS_num_verifications[TEH_MT_EDDSA]++; if (GNUNET_OK != TALER_exchange_offline_wire_add_verify (awc.payto_uri, awc.validity_start, @@ -178,6 +179,7 @@ TEH_handler_management_post_wire ( TALER_EC_EXCHANGE_MANAGEMENT_WIRE_ADD_SIGNATURE_INVALID, NULL); } + TEH_METRICS_num_verifications[TEH_MT_EDDSA]++; if (GNUNET_OK != TALER_exchange_wire_signature_check (awc.payto_uri, &TEH_master_public_key, @@ -214,7 +216,7 @@ TEH_handler_management_post_wire ( res = TEH_DB_run_transaction (connection, "add wire", - TEH_MT_OTHER, + TEH_MT_REQUEST_OTHER, &ret, &add_wire, &awc); diff --git a/src/exchange/taler-exchange-httpd_management_wire_fees.c b/src/exchange/taler-exchange-httpd_management_wire_fees.c index 1e96353ca..070e9567f 100644 --- a/src/exchange/taler-exchange-httpd_management_wire_fees.c +++ b/src/exchange/taler-exchange-httpd_management_wire_fees.c @@ -188,6 +188,7 @@ TEH_handler_management_post_wire_fees ( return MHD_YES; /* failure */ } + TEH_METRICS_num_verifications[TEH_MT_EDDSA]++; if (GNUNET_OK != TALER_exchange_offline_wire_fee_verify ( afc.wire_method, @@ -212,7 +213,7 @@ TEH_handler_management_post_wire_fees ( res = TEH_DB_run_transaction (connection, "add wire fee", - TEH_MT_OTHER, + TEH_MT_REQUEST_OTHER, &ret, &add_fee, &afc); diff --git a/src/exchange/taler-exchange-httpd_melt.c b/src/exchange/taler-exchange-httpd_melt.c index 4db1b2469..f1e99a864 100644 --- a/src/exchange/taler-exchange-httpd_melt.c +++ b/src/exchange/taler-exchange-httpd_melt.c @@ -265,7 +265,7 @@ database_melt (struct MHD_Connection *connection, if (GNUNET_OK != TEH_DB_run_transaction (connection, "run melt", - TEH_MT_MELT, + TEH_MT_REQUEST_MELT, &mhd_ret, &melt_transaction, rmc)) @@ -341,7 +341,7 @@ check_melt_valid (struct MHD_Connection *connection, TALER_EC_EXCHANGE_MELT_FEES_EXCEED_CONTRIBUTION, NULL); } - + TEH_METRICS_num_verifications[TEH_MT_CIPHER]++; if (GNUNET_OK != TALER_test_coin_valid (&rmc->refresh_session.coin, &dk->denom_pub)) @@ -354,6 +354,7 @@ check_melt_valid (struct MHD_Connection *connection, } /* verify signature of coin for melt operation */ + TEH_METRICS_num_verifications[TEH_MT_EDDSA]++; if (GNUNET_OK != TALER_wallet_melt_verify (&rmc->refresh_session.amount_with_fee, &rmc->coin_refresh_fee, diff --git a/src/exchange/taler-exchange-httpd_metrics.c b/src/exchange/taler-exchange-httpd_metrics.c index 8c8cd343a..36e50f98d 100644 --- a/src/exchange/taler-exchange-httpd_metrics.c +++ b/src/exchange/taler-exchange-httpd_metrics.c @@ -29,10 +29,13 @@ #include <jansson.h> -unsigned long long TEH_METRICS_num_requests[TEH_MT_COUNT]; +unsigned long long TEH_METRICS_num_requests[TEH_MT_REQUEST_COUNT]; -unsigned long long TEH_METRICS_num_conflict[TEH_MT_COUNT]; +unsigned long long TEH_METRICS_num_conflict[TEH_MT_REQUEST_COUNT]; +unsigned long long TEH_METRICS_num_signatures[TEH_MT_CIPHER_COUNT]; + +unsigned long long TEH_METRICS_num_verifications[TEH_MT_CIPHER_COUNT]; MHD_RESULT TEH_handler_metrics (struct TEH_RequestContext *rc, @@ -57,23 +60,41 @@ TEH_handler_metrics (struct TEH_RequestContext *rc, "taler_exchange_received_requests{type=\"%s\"} %llu\n" "taler_exchange_received_requests{type=\"%s\"} %llu\n" "taler_exchange_received_requests{type=\"%s\"} %llu\n" - "taler_exchange_received_requests{type=\"%s\"} %llu\n", + "taler_exchange_received_requests{type=\"%s\"} %llu\n" + "# HELP taler_exchange_num_signatures " + " number of signatures created by cipher (rsa, cs) and eddsa\n" + "# TYPE taler_exchange_num_signatures counter\n" + "taler_exchange_num_signatures{type=\"%s\"} %llu\n" + "taler_exchange_num_signatures{type=\"%s\"} %llu\n" + "# HELP taler_exchange_num_signature_verifications " + " number of signatures verified by cipher (rsa, cs) and eddsa\n" + "# TYPE taler_exchange_num_signature_verifications counter\n" + "taler_exchange_num_signature_verifications{type=\"%s\"} %llu\n" + "taler_exchange_num_signature_verifications{type=\"%s\"} %llu\n", "other", - TEH_METRICS_num_conflict[TEH_MT_OTHER], + TEH_METRICS_num_conflict[TEH_MT_REQUEST_OTHER], "deposit", - TEH_METRICS_num_conflict[TEH_MT_DEPOSIT], + TEH_METRICS_num_conflict[TEH_MT_REQUEST_DEPOSIT], "withdraw", - TEH_METRICS_num_conflict[TEH_MT_WITHDRAW], + TEH_METRICS_num_conflict[TEH_MT_REQUEST_WITHDRAW], "melt", - TEH_METRICS_num_conflict[TEH_MT_MELT], + TEH_METRICS_num_conflict[TEH_MT_REQUEST_MELT], "other", - TEH_METRICS_num_requests[TEH_MT_OTHER], + TEH_METRICS_num_requests[TEH_MT_REQUEST_OTHER], "deposit", - TEH_METRICS_num_requests[TEH_MT_DEPOSIT], + TEH_METRICS_num_requests[TEH_MT_REQUEST_DEPOSIT], "withdraw", - TEH_METRICS_num_requests[TEH_MT_WITHDRAW], + TEH_METRICS_num_requests[TEH_MT_REQUEST_WITHDRAW], "melt", - TEH_METRICS_num_requests[TEH_MT_MELT]); + TEH_METRICS_num_requests[TEH_MT_REQUEST_MELT], + "cipher", + TEH_METRICS_num_signatures[TEH_MT_CIPHER], + "eddsa", + TEH_METRICS_num_signatures[TEH_MT_EDDSA], + "cipher", + TEH_METRICS_num_verifications[TEH_MT_CIPHER], + "eddsa", + TEH_METRICS_num_verifications[TEH_MT_EDDSA]); resp = MHD_create_response_from_buffer (strlen (reply), reply, MHD_RESPMEM_MUST_FREE); diff --git a/src/exchange/taler-exchange-httpd_metrics.h b/src/exchange/taler-exchange-httpd_metrics.h index 55e5372a7..60b2e650c 100644 --- a/src/exchange/taler-exchange-httpd_metrics.h +++ b/src/exchange/taler-exchange-httpd_metrics.h @@ -29,27 +29,45 @@ /** * Request types for which we collect metrics. */ -enum TEH_MetricType +enum TEH_MetricTypeRequest { - TEH_MT_OTHER = 0, - TEH_MT_DEPOSIT = 1, - TEH_MT_WITHDRAW = 2, - TEH_MT_MELT = 3, - TEH_MT_COUNT = 4 /* MUST BE LAST! */ + TEH_MT_REQUEST_OTHER = 0, + TEH_MT_REQUEST_DEPOSIT = 1, + TEH_MT_REQUEST_WITHDRAW = 2, + TEH_MT_REQUEST_MELT = 3, + TEH_MT_REQUEST_COUNT = 4 /* MUST BE LAST! */ }; +/** + * Cipher types for which we collect metrics. + */ +enum TEH_MetricTypeRequestCipher +{ + TEH_MT_CIPHER = 0, + TEH_MT_EDDSA = 2, + TEH_MT_CIPHER_COUNT = 3 +}; /** * Number of requests handled of the respective type. */ -extern unsigned long long TEH_METRICS_num_requests[TEH_MT_COUNT]; +extern unsigned long long TEH_METRICS_num_requests[TEH_MT_REQUEST_COUNT]; /** * Number of serialization errors encountered when * handling requests of the respective type. */ -extern unsigned long long TEH_METRICS_num_conflict[TEH_MT_COUNT]; +extern unsigned long long TEH_METRICS_num_conflict[TEH_MT_REQUEST_COUNT]; +/** + * Number of signatures created by the respecitve cipher. + */ +extern unsigned long long TEH_METRICS_num_signatures[TEH_MT_CIPHER_COUNT]; + +/** + * Number of signatures verified by the respecitve cipher. + */ +extern unsigned long long TEH_METRICS_num_verifications[TEH_MT_CIPHER_COUNT]; /** * Handle a "/metrics" request. diff --git a/src/exchange/taler-exchange-httpd_recoup-refresh.c b/src/exchange/taler-exchange-httpd_recoup-refresh.c index d21aa02ce..2fec1c154 100644 --- a/src/exchange/taler-exchange-httpd_recoup-refresh.c +++ b/src/exchange/taler-exchange-httpd_recoup-refresh.c @@ -217,6 +217,7 @@ verify_and_execute_recoup_refresh ( } /* check denomination signature */ + TEH_METRICS_num_verifications[TEH_MT_CIPHER]++; if (GNUNET_YES != TALER_test_coin_valid (coin, &dk->denom_pub)) @@ -230,6 +231,7 @@ verify_and_execute_recoup_refresh ( } /* check recoup request signature */ + TEH_METRICS_num_verifications[TEH_MT_EDDSA]++; if (GNUNET_OK != TALER_wallet_recoup_refresh_verify (&coin->denom_pub_hash, coin_bks, @@ -328,7 +330,7 @@ verify_and_execute_recoup_refresh ( if (GNUNET_OK != TEH_DB_run_transaction (connection, "run recoup-refresh", - TEH_MT_OTHER, + TEH_MT_REQUEST_OTHER, &mhd_ret, &recoup_refresh_transaction, &pc)) diff --git a/src/exchange/taler-exchange-httpd_recoup.c b/src/exchange/taler-exchange-httpd_recoup.c index da576e94f..5431c0551 100644 --- a/src/exchange/taler-exchange-httpd_recoup.c +++ b/src/exchange/taler-exchange-httpd_recoup.c @@ -219,6 +219,7 @@ verify_and_execute_recoup ( } /* check denomination signature */ + TEH_METRICS_num_verifications[TEH_MT_CIPHER]++; if (GNUNET_YES != TALER_test_coin_valid (coin, &dk->denom_pub)) @@ -232,6 +233,7 @@ verify_and_execute_recoup ( } /* check recoup request signature */ + TEH_METRICS_num_verifications[TEH_MT_EDDSA]++; if (GNUNET_OK != TALER_wallet_recoup_verify (&coin->denom_pub_hash, coin_bks, @@ -341,7 +343,7 @@ verify_and_execute_recoup ( if (GNUNET_OK != TEH_DB_run_transaction (connection, "run recoup", - TEH_MT_OTHER, + TEH_MT_REQUEST_OTHER, &mhd_ret, &recoup_transaction, &pc)) diff --git a/src/exchange/taler-exchange-httpd_refreshes_reveal.c b/src/exchange/taler-exchange-httpd_refreshes_reveal.c index d5cb2e476..374d3a7ca 100644 --- a/src/exchange/taler-exchange-httpd_refreshes_reveal.c +++ b/src/exchange/taler-exchange-httpd_refreshes_reveal.c @@ -684,6 +684,7 @@ clean_age: return (GNUNET_NO == res) ? MHD_YES : MHD_NO; /* Check signature */ + TEH_METRICS_num_verifications[TEH_MT_EDDSA]++; if (GNUNET_OK != TALER_wallet_link_verify ( &rrcs[i].h_denom_pub, diff --git a/src/exchange/taler-exchange-httpd_refund.c b/src/exchange/taler-exchange-httpd_refund.c index 70ab3fd0f..e08247963 100644 --- a/src/exchange/taler-exchange-httpd_refund.c +++ b/src/exchange/taler-exchange-httpd_refund.c @@ -209,6 +209,7 @@ verify_and_execute_refund (struct MHD_Connection *connection, .refund = refund }; + TEH_METRICS_num_verifications[TEH_MT_EDDSA]++; if (GNUNET_OK != TALER_merchant_refund_verify (&refund->coin.coin_pub, &refund->details.h_contract_terms, @@ -275,7 +276,7 @@ verify_and_execute_refund (struct MHD_Connection *connection, if (GNUNET_OK != TEH_DB_run_transaction (connection, "run refund", - TEH_MT_OTHER, + TEH_MT_REQUEST_OTHER, &mhd_ret, &refund_transaction, &rctx)) diff --git a/src/exchange/taler-exchange-httpd_reserves_get.c b/src/exchange/taler-exchange-httpd_reserves_get.c index 80c992e61..4b1bbddec 100644 --- a/src/exchange/taler-exchange-httpd_reserves_get.c +++ b/src/exchange/taler-exchange-httpd_reserves_get.c @@ -315,7 +315,7 @@ TEH_handler_reserves_get (struct TEH_RequestContext *rc, if (GNUNET_OK != TEH_DB_run_transaction (rc->connection, "get reserve history", - TEH_MT_OTHER, + TEH_MT_REQUEST_OTHER, &mhd_ret, &reserve_history_transaction, &rsc)) diff --git a/src/exchange/taler-exchange-httpd_responses.c b/src/exchange/taler-exchange-httpd_responses.c index d4da51621..736ac36f7 100644 --- a/src/exchange/taler-exchange-httpd_responses.c +++ b/src/exchange/taler-exchange-httpd_responses.c @@ -68,6 +68,7 @@ TEH_RESPONSE_compile_transaction_history ( &h_wire); #if ENABLE_SANITY_CHECKS /* internal sanity check before we hand out a bogus sig... */ + TEH_METRICS_num_verifications[TEH_MT_EDDSA]++; if (GNUNET_OK != TALER_wallet_deposit_verify (&deposit->amount_with_fee, &deposit->deposit_fee, @@ -132,6 +133,7 @@ TEH_RESPONSE_compile_transaction_history ( const struct TALER_AgeCommitmentHash *phac = NULL; #if ENABLE_SANITY_CHECKS + TEH_METRICS_num_verifications[TEH_MT_EDDSA]++; if (GNUNET_OK != TALER_wallet_melt_verify (&melt->amount_with_fee, &melt->melt_fee, @@ -185,6 +187,7 @@ TEH_RESPONSE_compile_transaction_history ( struct TALER_Amount value; #if ENABLE_SANITY_CHECKS + TEH_METRICS_num_verifications[TEH_MT_EDDSA]++; if (GNUNET_OK != TALER_merchant_refund_verify (coin_pub, &refund->h_contract_terms, diff --git a/src/exchange/taler-exchange-httpd_transfers_get.c b/src/exchange/taler-exchange-httpd_transfers_get.c index 0a4b1f541..3f87f370a 100644 --- a/src/exchange/taler-exchange-httpd_transfers_get.c +++ b/src/exchange/taler-exchange-httpd_transfers_get.c @@ -514,7 +514,7 @@ TEH_handler_transfers_get (struct TEH_RequestContext *rc, if (GNUNET_OK != TEH_DB_run_transaction (rc->connection, "run transfers GET", - TEH_MT_OTHER, + TEH_MT_REQUEST_OTHER, &mhd_ret, &get_transfer_deposits, &ctx)) diff --git a/src/exchange/taler-exchange-httpd_withdraw.c b/src/exchange/taler-exchange-httpd_withdraw.c index ac47824e5..4811b6833 100644 --- a/src/exchange/taler-exchange-httpd_withdraw.c +++ b/src/exchange/taler-exchange-httpd_withdraw.c @@ -489,6 +489,7 @@ TEH_handler_withdraw (struct TEH_RequestContext *rc, NULL); } + TEH_METRICS_num_verifications[TEH_MT_EDDSA]++; if (GNUNET_OK != TALER_wallet_withdraw_verify (&wc.collectable.denom_pub_hash, &wc.collectable.amount_with_fee, @@ -525,7 +526,7 @@ TEH_handler_withdraw (struct TEH_RequestContext *rc, if (GNUNET_OK != TEH_DB_run_transaction (rc->connection, "run withdraw", - TEH_MT_WITHDRAW, + TEH_MT_REQUEST_WITHDRAW, &mhd_ret, &withdraw_transaction, &wc)) |