Improve chronos.Future tracking. (#2988)

* Add `child_id` field.

* Fix json-rpc api call and bump chronos.

* Bump chronos master and fix compilation warnings.

* One more bump of `chronos`.

* add random import

* export rest_utils a bit more

Co-authored-by: Jacek Sieka <jacek@status.im>
This commit is contained in:
Eugene Kabanov 2021-10-27 15:01:11 +03:00 committed by GitHub
parent 23b5a945ea
commit 7c9a6b7170
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 44 additions and 12 deletions

View File

@ -9,7 +9,6 @@ import
std/[typetraits, sequtils, strutils, sets],
stew/[results, base10],
chronicles,
json_serialization, json_serialization/std/[options, net],
nimcrypto/utils as ncrutils,
../beacon_node, ../networking/eth2_network,
../consensus_object_pools/[blockchain_dag, exit_pool, spec_cache],
@ -18,6 +17,8 @@ import
../spec/datatypes/[phase0, altair],
./rest_utils
export rest_utils
logScope: topics = "rest_beaconapi"
proc validateFilter(filters: seq[ValidatorFilter]): Result[ValidatorFilter,

View File

@ -11,6 +11,8 @@ import ".."/beacon_node,
".."/spec/forks,
"."/rest_utils
export rest_utils
logScope: topics = "rest_config"
proc installConfigApiHandlers*(router: var RestRouter, node: BeaconNode) =

View File

@ -11,6 +11,8 @@ import ".."/[version, beacon_node],
".."/spec/forks,
"."/rest_utils
export rest_utils
logScope: topics = "rest_debug"
proc installDebugApiHandlers*(router: var RestRouter, node: BeaconNode) =

View File

@ -10,6 +10,8 @@ import
./rest_utils,
../beacon_node
export rest_utils
logScope: topics = "rest_eventapi"
proc validateEventTopics(events: seq[EventTopic]): Result[EventTopics,

View File

@ -13,7 +13,9 @@ import ".."/spec/[keystore, crypto]
import ".."/rpc/rest_utils
import ".."/validators/[keystore_management, validator_pool]
export results
export
rest_utils,
results
type
ValidatorToggleAction {.pure.} = enum

View File

@ -16,6 +16,11 @@ import
../spec/forks,
../beacon_node, ../nimbus_binary_common
export rest_utils
when defined(chronosFutureTracking):
import stew/base10
logScope: topics = "rest_nimbusapi"
type
@ -39,7 +44,8 @@ type
score*: int
RestFutureInfo* = object
id*: int
id*: string
child_id*: string
procname*: string
filename*: string
line*: int
@ -213,9 +219,14 @@ proc installNimbusApiHandlers*(router: var RestRouter, node: BeaconNode) =
var res: seq[RestFutureInfo]
for item in pendingFutures():
let loc = item.location[LocCreateIndex][]
let futureId = Base10.toString(item.id)
let childId =
if isNil(item.child): ""
else: Base10.toString(item.child.id)
res.add(
RestFutureInfo(
id: item.id,
id: futureId,
child_id: childId,
procname: $loc.procedure,
filename: $loc.file,
line: loc.line,

View File

@ -11,6 +11,8 @@ import
../spec/eth2_apis/rpc_types,
./rest_utils
export rest_utils
logScope: topics = "rest_node"
type

View File

@ -4,7 +4,7 @@ import std/options,
../spec/[forks],
../spec/eth2_apis/[rest_types, eth2_rest_serialization],
../beacon_node,
../consensus_object_pools/[block_pools_types, blockchain_dag]
../consensus_object_pools/blockchain_dag
export
options, eth2_rest_serialization, blockchain_dag, presto, rest_types

View File

@ -4,8 +4,7 @@
# * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0).
# at your option. This file may not be copied, modified, or distributed except according to those terms.
import std/[typetraits, strutils, sets, sequtils]
import stew/[results, base10], chronicles, json_serialization,
json_serialization/std/[options, net],
import stew/[results, base10], chronicles,
nimcrypto/utils as ncrutils
import ".."/[beacon_chain_db, beacon_node],
".."/networking/eth2_network,
@ -16,6 +15,8 @@ import ".."/[beacon_chain_db, beacon_node],
".."/spec/datatypes/[phase0, altair],
"."/rest_utils
export rest_utils
logScope: topics = "rest_validatorapi"
proc installValidatorApiHandlers*(router: var RestRouter, node: BeaconNode) =

View File

@ -21,13 +21,17 @@ import
../spec/[forks],
./rpc_utils
when defined(chronosFutureTracking):
import stew/base10
logScope: topics = "nimbusapi"
type
RpcServer = RpcHttpServer
FutureInfo* = object
id*: int
id*: string
child_id*: string
procname*: string
filename*: string
line*: int
@ -113,8 +117,13 @@ proc installNimbusApiHandlers*(rpcServer: RpcServer, node: BeaconNode) {.
for item in pendingFutures():
let loc = item.location[LocCreateIndex][]
let futureId = Base10.toString(item.id)
let childId =
if isNil(item.child): ""
else: Base10.toString(item.child.id)
res.add FutureInfo(
id: item.id,
id: futureId,
child_id: childId,
procname: $loc.procedure,
filename: $loc.file,
line: loc.line,

View File

@ -7,14 +7,14 @@
import std/typetraits
import stew/[results, base10, byteutils, endians2], presto/common,
libp2p/peerid, serialization,
json_serialization, json_serialization/std/[options, net],
json_serialization, json_serialization/std/[options, net, sets],
nimcrypto/utils as ncrutils
import ".."/[eth2_ssz_serialization, forks],
".."/datatypes/[phase0, altair, merge],
"."/rest_types
export
results, peerid, common, serialization, json_serialization, options, net,
results, peerid, common, serialization, json_serialization, options, net, sets,
eth2_ssz_serialization, rest_types
Json.createFlavor RestJson

2
vendor/nim-chronos vendored

@ -1 +1 @@
Subproject commit 80102a3b6a8bc9c205302ec5d0f895d01a4e43df
Subproject commit 661eae5732c54c40158679af9c7a34ed1245e647