diff options
author | Christian Grothoff <christian@grothoff.org> | 2021-12-07 21:27:08 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2021-12-07 21:27:08 +0100 |
commit | add2d29acf1d73258c034f82a544e591009cd238 (patch) | |
tree | 26082e9b5b2fb0179befc62ef6dba84795c740cc | |
parent | 71933dd2e9b5b66dbc72cdde9ea7b498a11db197 (diff) |
implement basic /metrics
-rw-r--r-- | src/exchange/taler-exchange-httpd_metrics.c | 58 |
1 files changed, 55 insertions, 3 deletions
diff --git a/src/exchange/taler-exchange-httpd_metrics.c b/src/exchange/taler-exchange-httpd_metrics.c index d3f1f02d8..39e20a859 100644 --- a/src/exchange/taler-exchange-httpd_metrics.c +++ b/src/exchange/taler-exchange-httpd_metrics.c @@ -38,10 +38,62 @@ MHD_RESULT TEH_handler_metrics (struct TEH_RequestContext *rc, const char *const args[]) { + char *reply; + struct MHD_Response *resp; + MHD_RESULT ret; + (void) args; - return TALER_MHD_reply_json (rc->connection, - json_pack ("{}"), - MHD_HTTP_NO_CONTENT); + GNUNET_asprintf (&reply, + "received_requests(type='%s') %llu\n" + "serialization_failures(type='%s') %llu\n" + "received_requests(type='%s') %llu\n" + "serialization_failures(type='%s') %llu\n" + "received_requests(type='%s') %llu\n" + "serialization_failures(type='%s') %llu\n" + "received_requests(type='%s') %llu\n" + "serialization_failures(type='%s') %llu\n" + "received_requests(type='%s') %llu\n" + "serialization_failures(type='%s') %llu\n" + "received_requests(type='%s') %llu\n" + "serialization_failures(type='%s') %llu\n" + "received_requests(type='%s') %llu\n" + "serialization_failures(type='%s') %llu\n", + "other", + TEH_METRICS_num_requests[TEH_MT_OTHER], + "other", + TEH_METRICS_num_conflict[TEH_MT_OTHER], + "deposit", + TEH_METRICS_num_requests[TEH_MT_DEPOSIT], + "deposit", + TEH_METRICS_num_conflict[TEH_MT_DEPOSIT], + "withdraw", + TEH_METRICS_num_requests[TEH_MT_WITHDRAW], + "withdraw", + TEH_METRICS_num_conflict[TEH_MT_WITHDRAW], + "melt", + TEH_METRICS_num_requests[TEH_MT_MELT], + "melt", + TEH_METRICS_num_conflict[TEH_MT_MELT], + "reveal-precheck", + TEH_METRICS_num_requests[TEH_MT_REVEAL_PRECHECK], + "reveal-precheck", + TEH_METRICS_num_conflict[TEH_MT_REVEAL_PRECHECK], + "reveal", + TEH_METRICS_num_requests[TEH_MT_REVEAL], + "reveal", + TEH_METRICS_num_conflict[TEH_MT_REVEAL], + "reveal-persist", + TEH_METRICS_num_requests[TEH_MT_REVEAL_PERSIST], + "reveal-persist", + TEH_METRICS_num_conflict[TEH_MT_REVEAL_PERSIST]); + resp = MHD_create_response_from_buffer (strlen (reply), + reply, + MHD_RESPMEM_MUST_FREE); + ret = MHD_queue_response (rc->connection, + MHD_HTTP_OK, + resp); + MHD_destroy_response (resp); + return ret; } |