Skip to content

Commit

Permalink
Merge pull request #13572 from MinaProtocol/georgeee/add-snark-pool-s…
Browse files Browse the repository at this point in the history
…ummury-to-status-graphql

Add snark pool information to the status metrics query results
  • Loading branch information
deepthiskumar authored Oct 10, 2023
2 parents 5217a1d + 84d74b5 commit 19de438
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 1 deletion.
48 changes: 48 additions & 0 deletions graphql_schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -12280,6 +12280,54 @@
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "snarkPoolDiffReceived",
"description": null,
"args": [],
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": { "kind": "SCALAR", "name": "Int", "ofType": null }
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "snarkPoolDiffBroadcasted",
"description": null,
"args": [],
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": { "kind": "SCALAR", "name": "Int", "ofType": null }
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "pendingSnarkWork",
"description": null,
"args": [],
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": { "kind": "SCALAR", "name": "Int", "ofType": null }
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "snarkPoolSize",
"description": null,
"args": [],
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": { "kind": "SCALAR", "name": "Int", "ofType": null }
},
"isDeprecated": false,
"deprecationReason": null
}
],
"inputFields": null,
Expand Down
14 changes: 14 additions & 0 deletions src/lib/daemon_rpcs/types.ml
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,10 @@ module Status = struct
; transaction_pool_diff_broadcasted : int
; transactions_added_to_pool : int
; transaction_pool_size : int
; snark_pool_diff_received : int
; snark_pool_diff_broadcasted : int
; pending_snark_work : int
; snark_pool_size : int
}
[@@deriving to_yojson, bin_io_unversioned, fields]
end
Expand Down Expand Up @@ -423,9 +427,19 @@ module Status = struct
let transaction_pool_size =
fmt_field "transaction_pool_size" string_of_int
in
let snark_pool_diff_received =
fmt_field "snark_pool_diff_received" string_of_int
in
let snark_pool_diff_broadcasted =
fmt_field "snark_pool_diff_broadcasted" string_of_int
in
let pending_snark_work = fmt_field "pending_snark_work" string_of_int in
let snark_pool_size = fmt_field "snark_pool_size" string_of_int in
Metrics.Fields.to_list ~block_production_delay
~transaction_pool_diff_received ~transaction_pool_diff_broadcasted
~transactions_added_to_pool ~transaction_pool_size
~snark_pool_diff_received ~snark_pool_diff_broadcasted
~pending_snark_work ~snark_pool_size
|> List.concat
|> List.map ~f:(fun (s, v) -> ("\t" ^ s, v))
|> digest_entries ~title:""
Expand Down
7 changes: 7 additions & 0 deletions src/lib/mina_commands/mina_commands.ml
Original file line number Diff line number Diff line change
Expand Up @@ -466,6 +466,13 @@ let get_status ~flag t =
; transactions_added_to_pool =
Float.to_int
@@ Counter.value Transaction_pool.transactions_added_to_pool
; snark_pool_diff_received =
Float.to_int @@ Gauge.value Network.snark_pool_diff_received
; snark_pool_diff_broadcasted =
Float.to_int @@ Gauge.value Network.snark_pool_diff_broadcasted
; snark_pool_size = Float.to_int @@ Gauge.value Snark_work.snark_pool_size
; pending_snark_work =
Float.to_int @@ Gauge.value Snark_work.pending_snark_work
}
in
{ Daemon_rpcs.Types.Status.num_accounts
Expand Down
5 changes: 4 additions & 1 deletion src/lib/mina_graphql/types.ml
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,10 @@ module DaemonStatus = struct
~block_production_delay:nn_int_list
~transaction_pool_diff_received:nn_int
~transaction_pool_diff_broadcasted:nn_int
~transactions_added_to_pool:nn_int ~transaction_pool_size:nn_int )
~transactions_added_to_pool:nn_int ~transaction_pool_size:nn_int
~snark_pool_diff_received:nn_int
~snark_pool_diff_broadcasted:nn_int ~pending_snark_work:nn_int
~snark_pool_size:nn_int )

let t : (_, Daemon_rpcs.Types.Status.t option) typ =
obj "DaemonStatus" ~fields:(fun _ ->
Expand Down

0 comments on commit 19de438

Please sign in to comment.