add core success count metrics

This commit is contained in:
Christian Grothoff 2022-06-08 15:47:47 +02:00
parent f2e2c5c9d8
commit 7700f6ff88
No known key found for this signature in database
GPG Key ID: 939E6BE1E29FC3CC
7 changed files with 63 additions and 13 deletions

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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",

View File

@ -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
*/

View File

@ -428,7 +428,8 @@ check_commitment (struct RevealContext *rctx,
* @return MHD result code
*/
static MHD_RESULT
resolve_refreshes_reveal_denominations (struct MHD_Connection *connection,
resolve_refreshes_reveal_denominations (
struct MHD_Connection *connection,
struct RevealContext *rctx,
const json_t *link_sigs_json,
const json_t *new_denoms_h_json,
@ -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,7 +792,8 @@ clean_age:
rrc->blinded_planchet = rcds[i].blinded_planchet;
}
qs = TEH_plugin->insert_refresh_reveal (TEH_plugin->cls,
qs = TEH_plugin->insert_refresh_reveal (
TEH_plugin->cls,
melt_serial_id,
num_fresh_coins,
rrcs,
@ -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);

View File

@ -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;
}