add core success count metrics
This commit is contained in:
parent
f2e2c5c9d8
commit
7700f6ff88
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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",
|
||||
|
@ -46,6 +46,19 @@ enum TEH_MetricTypeRequest
|
||||
TEH_MT_REQUEST_COUNT = 12 /* MUST BE LAST! */
|
||||
};
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
@ -71,6 +84,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
|
||||
*/
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user