From 5d233fce1bdc9ea0fda7aca1e7e011f14cd50767 Mon Sep 17 00:00:00 2001 From: CJ Cobb Date: Thu, 21 Jan 2021 11:23:21 -0500 Subject: [PATCH] add more logging --- handlers/LedgerData.cpp | 2 ++ reporting/ReportingBackend.cpp | 2 ++ reporting/ReportingBackend.h | 4 ++++ test.py | 4 ++-- websocket_server_async.cpp | 1 + 5 files changed, 11 insertions(+), 2 deletions(-) diff --git a/handlers/LedgerData.cpp b/handlers/LedgerData.cpp index a6f6f93a..5df827cc 100644 --- a/handlers/LedgerData.cpp +++ b/handlers/LedgerData.cpp @@ -53,6 +53,8 @@ doLedgerData( auto start = std::chrono::system_clock::now(); auto [results, returnedMarker] = backend.doUpperBound(marker, ledger, limit); + BOOST_LOG_TRIVIAL(debug) + << "doUpperBound returned " << results.size() << " results"; auto end = std::chrono::system_clock::now(); diff --git a/reporting/ReportingBackend.cpp b/reporting/ReportingBackend.cpp index 828e84c5..e47cda1d 100644 --- a/reporting/ReportingBackend.cpp +++ b/reporting/ReportingBackend.cpp @@ -273,6 +273,8 @@ flatMapReadObjectCallback(CassFuture* fut, void* cbData) else { auto finish = [&requestParams]() { + BOOST_LOG_TRIVIAL(trace) + << "flatMapReadObjectCallback - finished a read"; size_t batchSize = requestParams.batchSize; if (++(requestParams.numFinished) == batchSize) requestParams.cv.notify_all(); diff --git a/reporting/ReportingBackend.h b/reporting/ReportingBackend.h index 3152ecc3..d2d8b422 100644 --- a/reporting/ReportingBackend.h +++ b/reporting/ReportingBackend.h @@ -996,6 +996,7 @@ public: std::uint32_t seq, std::uint32_t limit) const { + BOOST_LOG_TRIVIAL(debug) << "Starting doUpperBound"; CassStatement* statement = cass_prepared_bind(upperBound_); cass_statement_set_consistency(statement, CASS_CONSISTENCY_QUORUM); int64_t markerVal = marker ? marker.value() : INT64_MIN; @@ -1058,6 +1059,7 @@ public: cass_statement_free(statement); cass_future_free(fut); + BOOST_LOG_TRIVIAL(debug) << "doUpperBound - got keys"; std::vector keys; CassIterator* iter = cass_iterator_from_result(res); @@ -1081,6 +1083,8 @@ public: } keys.push_back(ripple::uint256::fromVoid(outData)); } + BOOST_LOG_TRIVIAL(debug) + << "doUpperBound - populated keys. num keys = " << keys.size(); if (keys.size()) { std::vector results; diff --git a/test.py b/test.py index 60a169a1..7a3b692e 100755 --- a/test.py +++ b/test.py @@ -52,7 +52,7 @@ async def ledger_data(ip, port, ledger, limit): address = 'ws://' + str(ip) + ':' + str(port) try: async with websockets.connect(address) as ws: - await ws.send(json.dumps({"command":"ledger_data","ledger_index":int(ledger),"limit":int(limit)})) + await ws.send(json.dumps({"command":"ledger_data","ledger_index":int(ledger),"limit":int(limit),"binary":True})) res = json.loads(await ws.recv()) print(res) except websockets.exceptions.connectionclosederror as e: @@ -66,7 +66,7 @@ async def ledger_data_full(ip, port, ledger): marker = None while True: if marker is None: - await ws.send(json.dumps({"command":"ledger_data","ledger_index":int(ledger)})) + await ws.send(json.dumps({"command":"ledger_data","ledger_index":int(ledger),"binary":True})) res = json.loads(await ws.recv()) print(res) diff --git a/websocket_server_async.cpp b/websocket_server_async.cpp index fa3a0624..36016b80 100644 --- a/websocket_server_async.cpp +++ b/websocket_server_async.cpp @@ -70,6 +70,7 @@ buildResponse( std::shared_ptr& pgPool) { std::string command = request.at("command").as_string().c_str(); + BOOST_LOG_TRIVIAL(info) << "Received rpc command : " << request; boost::json::object response; switch (commandMap[command]) {