diff options
-rw-r--r-- | src/exchange/taler-exchange-httpd_batch-withdraw.c | 1 | ||||
-rw-r--r-- | src/exchange/taler-exchange-httpd_deposit.c | 1 | ||||
-rw-r--r-- | src/exchange/taler-exchange-httpd_melt.c | 1 | ||||
-rw-r--r-- | src/exchange/taler-exchange-httpd_metrics.c | 18 | ||||
-rw-r--r-- | src/exchange/taler-exchange-httpd_metrics.h | 18 | ||||
-rw-r--r-- | src/exchange/taler-exchange-httpd_refreshes_reveal.c | 35 | ||||
-rw-r--r-- | src/exchange/taler-exchange-httpd_withdraw.c | 2 |
7 files changed, 63 insertions, 13 deletions
diff --git a/src/exchange/taler-exchange-httpd_batch-withdraw.c b/src/exchange/taler-exchange-httpd_batch-withdraw.c index 91d1ebd3b..d306838bf 100644 --- a/src/exchange/taler-exchange-httpd_batch-withdraw.c +++ b/src/exchange/taler-exchange-httpd_batch-withdraw.c @@ -273,6 +273,7 @@ batch_withdraw_transaction (void *cls, return GNUNET_DB_STATUS_HARD_ERROR; } } + TEH_METRICS_num_success[TEH_MT_SUCCESS_BATCH_WITHDRAW]++; return GNUNET_DB_STATUS_SUCCESS_ONE_RESULT; } diff --git a/src/exchange/taler-exchange-httpd_deposit.c b/src/exchange/taler-exchange-httpd_deposit.c index 48e1df9aa..c5f98d21e 100644 --- a/src/exchange/taler-exchange-httpd_deposit.c +++ b/src/exchange/taler-exchange-httpd_deposit.c @@ -203,6 +203,7 @@ deposit_transaction (void *cls, &dc->deposit->coin.coin_pub); return GNUNET_DB_STATUS_HARD_ERROR; } + TEH_METRICS_num_success[TEH_MT_SUCCESS_DEPOSIT]++; return qs; } diff --git a/src/exchange/taler-exchange-httpd_melt.c b/src/exchange/taler-exchange-httpd_melt.c index c6a8cc62f..1e5c92e18 100644 --- a/src/exchange/taler-exchange-httpd_melt.c +++ b/src/exchange/taler-exchange-httpd_melt.c @@ -201,6 +201,7 @@ melt_transaction (void *cls, return GNUNET_DB_STATUS_HARD_ERROR; } /* All good, commit, final response will be generated by caller */ + TEH_METRICS_num_success[TEH_MT_SUCCESS_MELT]++; return GNUNET_DB_STATUS_SUCCESS_ONE_RESULT; } diff --git a/src/exchange/taler-exchange-httpd_metrics.c b/src/exchange/taler-exchange-httpd_metrics.c index 5b82282b0..1542801fe 100644 --- a/src/exchange/taler-exchange-httpd_metrics.c +++ b/src/exchange/taler-exchange-httpd_metrics.c @@ -41,6 +41,9 @@ unsigned long long TEH_METRICS_num_verifications[TEH_MT_SIGNATURE_COUNT]; unsigned long long TEH_METRICS_num_keyexchanges[TEH_MT_KEYX_COUNT]; +unsigned long long TEH_METRICS_num_success[TEH_MT_SUCCESS_COUNT]; + + MHD_RESULT TEH_handler_metrics (struct TEH_RequestContext *rc, const char *const args[]) @@ -51,6 +54,11 @@ TEH_handler_metrics (struct TEH_RequestContext *rc, (void) args; GNUNET_asprintf (&reply, + "taler_exchange_success_transactions{type=\"%s\"} %llu\n" + "taler_exchange_success_transactions{type=\"%s\"} %llu\n" + "taler_exchange_success_transactions{type=\"%s\"} %llu\n" + "taler_exchange_success_transactions{type=\"%s\"} %llu\n" + "taler_exchange_success_transactions{type=\"%s\"} %llu\n" "# HELP taler_exchange_serialization_failures " " number of database serialization errors by type\n" "# TYPE taler_exchange_serialization_failures counter\n" @@ -91,6 +99,16 @@ TEH_handler_metrics (struct TEH_RequestContext *rc, " number of coins withdrawn in a batch-withdraw request\n" "# TYPE taler_exchange_batch_withdraw_num_coins counter\n" "taler_exchange_batch_withdraw_num_coins{} %llu\n", + "deposit", + TEH_METRICS_num_success[TEH_MT_SUCCESS_DEPOSIT], + "withdraw", + TEH_METRICS_num_success[TEH_MT_SUCCESS_WITHDRAW], + "batch-withdraw", + TEH_METRICS_num_success[TEH_MT_SUCCESS_BATCH_WITHDRAW], + "melt", + TEH_METRICS_num_success[TEH_MT_SUCCESS_MELT], + "refresh-reveal", + TEH_METRICS_num_success[TEH_MT_SUCCESS_REFRESH_REVEAL], "other", TEH_METRICS_num_conflict[TEH_MT_REQUEST_OTHER], "deposit", diff --git a/src/exchange/taler-exchange-httpd_metrics.h b/src/exchange/taler-exchange-httpd_metrics.h index 25022d0da..ff4c3f6ca 100644 --- a/src/exchange/taler-exchange-httpd_metrics.h +++ b/src/exchange/taler-exchange-httpd_metrics.h @@ -47,6 +47,19 @@ enum TEH_MetricTypeRequest }; /** + * Success types for which we collect metrics. + */ +enum TEH_MetricTypeSuccess +{ + TEH_MT_SUCCESS_DEPOSIT = 0, + TEH_MT_SUCCESS_WITHDRAW = 1, + TEH_MT_SUCCESS_BATCH_WITHDRAW = 2, + TEH_MT_SUCCESS_MELT = 3, + TEH_MT_SUCCESS_REFRESH_REVEAL = 4, + TEH_MT_SUCCESS_COUNT = 5 /* MUST BE LAST! */ +}; + +/** * Cipher types for which we collect signature metrics. */ enum TEH_MetricTypeSignature @@ -72,6 +85,11 @@ enum TEH_MetricTypeKeyX extern unsigned long long TEH_METRICS_num_requests[TEH_MT_REQUEST_COUNT]; /** + * Number of successful requests handled of the respective type. + */ +extern unsigned long long TEH_METRICS_num_success[TEH_MT_SUCCESS_COUNT]; + +/** * Number of coins withdrawn in a batch-withdraw request */ extern unsigned long long TEH_METRICS_batch_withdraw_num_coins; diff --git a/src/exchange/taler-exchange-httpd_refreshes_reveal.c b/src/exchange/taler-exchange-httpd_refreshes_reveal.c index bbccd5688..0c1701bb2 100644 --- a/src/exchange/taler-exchange-httpd_refreshes_reveal.c +++ b/src/exchange/taler-exchange-httpd_refreshes_reveal.c @@ -428,12 +428,13 @@ check_commitment (struct RevealContext *rctx, * @return MHD result code */ static MHD_RESULT -resolve_refreshes_reveal_denominations (struct MHD_Connection *connection, - struct RevealContext *rctx, - const json_t *link_sigs_json, - const json_t *new_denoms_h_json, - const json_t *old_age_commitment_json, - const json_t *coin_evs) +resolve_refreshes_reveal_denominations ( + struct MHD_Connection *connection, + struct RevealContext *rctx, + const json_t *link_sigs_json, + const json_t *new_denoms_h_json, + const json_t *old_age_commitment_json, + const json_t *coin_evs) { unsigned int num_fresh_coins = json_array_size (new_denoms_h_json); /* We know num_fresh_coins is bounded by #TALER_MAX_FRESH_COINS, so this is safe */ @@ -771,6 +772,8 @@ clean_age: for (unsigned int r = 0; r<MAX_TRANSACTION_COMMIT_RETRIES; r++) { + bool changed; + /* Persist operation result in DB */ if (GNUNET_OK != TEH_plugin->start (TEH_plugin->cls, @@ -789,13 +792,14 @@ clean_age: rrc->blinded_planchet = rcds[i].blinded_planchet; } - qs = TEH_plugin->insert_refresh_reveal (TEH_plugin->cls, - melt_serial_id, - num_fresh_coins, - rrcs, - TALER_CNC_KAPPA - 1, - rctx->transfer_privs, - &rctx->gamma_tp); + qs = TEH_plugin->insert_refresh_reveal ( + TEH_plugin->cls, + melt_serial_id, + num_fresh_coins, + rrcs, + TALER_CNC_KAPPA - 1, + rctx->transfer_privs, + &rctx->gamma_tp); if (GNUNET_DB_STATUS_SOFT_ERROR == qs) { TEH_plugin->rollback (TEH_plugin->cls); @@ -812,9 +816,14 @@ clean_age: "insert_refresh_reveal"); goto cleanup; } + changed = (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT == qs); qs = TEH_plugin->commit (TEH_plugin->cls); if (qs >= 0) + { + if (changed) + TEH_METRICS_num_success[TEH_MT_SUCCESS_REFRESH_REVEAL]++; break; /* success */ + } if (GNUNET_DB_STATUS_HARD_ERROR == qs) { GNUNET_break (0); diff --git a/src/exchange/taler-exchange-httpd_withdraw.c b/src/exchange/taler-exchange-httpd_withdraw.c index 1d48045b6..86d2c62b0 100644 --- a/src/exchange/taler-exchange-httpd_withdraw.c +++ b/src/exchange/taler-exchange-httpd_withdraw.c @@ -194,6 +194,8 @@ withdraw_transaction (void *cls, return GNUNET_DB_STATUS_HARD_ERROR; } } + if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT == qs) + TEH_METRICS_num_success[TEH_MT_SUCCESS_BATCH_WITHDRAW]++; return qs; } |