Skip to content
This repository has been archived by the owner on Jun 12, 2023. It is now read-only.

Commit

Permalink
updating latest core rebase changes
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffgrunewald committed Aug 8, 2022
1 parent 2135486 commit ffae14c
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 11 deletions.
11 changes: 7 additions & 4 deletions include/metrics.hrl
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@
-define(METRICS_BLOCK_HEIGHT, "blockchain_block_height").
-define(METRICS_BLOCK_UNVAL_HEIGHT, "blockchain_block_unval_height").
-define(METRICS_TXN_ABSORB_DURATION, "blockchain_txn_absorb_duration").
-define(METRICS_TXN_BLOCK_SPAN, "blockchain_txn_mgr_block_span").
-define(METRICS_TXN_QUEUE, "blockchain_txn_mgr_queue").
-define(METRICS_TXN_SUBMIT_COUNT, "blockchain_txn_mgr_submited_count").
-define(METRICS_TXN_REJECT_COUNT, "blockchain_txn_mgr_rejected_count").
-define(METRICS_TXN_REJECT_SPAN, "blockchain_txn_mgr_rejected_span").
-define(METRICS_TXN_ACCEPT_COUNT, "blockchain_txn_mgr_accepted_count").
-define(METRICS_TXN_ACCEPT_SPAN, "blockchain_txn_mgr_accepted_span").
-define(METRICS_TXN_UPDATE_COUNT, "blockchain_txn_mgr_updated_count").
-define(METRICS_TXN_PROCESS_DURATION, "blockchain_txn_mgr_process_duration").
-define(METRICS_TXN_CACHE_SIZE, "blockchain_txn_mgr_cache_size").
-define(METRICS_TXN_BLOCK_TIME, "blockchain_txn_mgr_block_time").
Expand Down Expand Up @@ -38,14 +39,16 @@
[blockchain, txn_mgr, submit],
[blockchain, txn_mgr, reject],
[blockchain, txn_mgr, accept],
[blockchain, txn_mgr, update],
[blockchain, txn_mgr, process],
[blockchain, txn_mgr, add_block] ],
[ {?METRICS_TXN_ABSORB_DURATION, prometheus_histogram, [stage], "Txn absorb duration"},
{?METRICS_TXN_BLOCK_SPAN, prometheus_gauge, [], "Block span of transactions"},
{?METRICS_TXN_QUEUE, prometheus_gauge, [], "Txn manager submission queue length"},
{?METRICS_TXN_SUBMIT_COUNT, prometheus_counter, [type], "Count of submitted transactions"},
{?METRICS_TXN_REJECT_COUNT, prometheus_counter, [type], "Count of rejected transactions"},
{?METRICS_TXN_REJECT_SPAN, prometheus_gauge, [type], "Block span of transactions on final rejection"},
{?METRICS_TXN_ACCEPT_COUNT, prometheus_counter, [type], "Count of accepted transactions"},
{?METRICS_TXN_ACCEPT_SPAN, prometheus_gauge, [type], "Block span of transactions on acceptance"},
{?METRICS_TXN_UPDATE_COUNT, prometheus_counter, [type], "Count of updated transactions"},
{?METRICS_TXN_PROCESS_DURATION, prometheus_histogram, [stage], "Transaction manager cache process duration"},
{?METRICS_TXN_CACHE_SIZE, prometheus_gauge, [height], "Transaction manager buffer size"},
{?METRICS_TXN_BLOCK_TIME, prometheus_gauge, [height], "Block time observed from the transaction mgr"},
Expand Down
2 changes: 1 addition & 1 deletion rebar.config
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

{deps, [
{blockchain, {git, "https://github.com/helium/blockchain-core.git",
{branch, "jg/txn_absorb_metrics"}}},
{branch, "master"}}},
{sibyl, {git, "https://github.com/helium/sibyl.git",
{branch, "master"}}},
{hbbft, {git, "https://github.com/helium/erlang-hbbft.git",
Expand Down
2 changes: 1 addition & 1 deletion rebar.lock
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
{<<"base64url">>,{pkg,<<"base64url">>,<<"1.0.1">>},1},
{<<"blockchain">>,
{git,"https://github.com/helium/blockchain-core.git",
{ref,"0caf2295d0576c0ef803258e834bf6ec3b3e74bc"}},
{ref,"bae8c3696747fdc24074c0e85ac64e745760d8aa"}},
0},
{<<"certifi">>,{pkg,<<"certifi">>,<<"2.9.0">>},2},
{<<"chatterbox">>,
Expand Down
2 changes: 1 addition & 1 deletion src/handlers/miner_hbbft_handler.erl
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ metadata(Version, Meta, Chain) ->
Infos = blockchain_ledger_snapshot_v1:get_infos(Chain),
case blockchain_ledger_snapshot_v1:snapshot(Ledger, Blocks, Infos) of
{ok, Snapshot} ->
{ok, _SnapHeight, SnapHash, _SnapSize} = blockchain:add_snapshot(Snapshot, Chain),
{ok, {_SnapHeight, SnapHash, _SnapSize}} = blockchain:add_snapshot(Snapshot, Chain),
lager:info("snapshot hash is ~p", [SnapHash]),
maps:put(snapshot_hash, SnapHash, ChainMeta0);
_Err ->
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
-module(miner_metrics_reporter).
-module(miner_metrics_exporter).

-behaviour(elli_handler).

Expand Down
12 changes: 9 additions & 3 deletions src/metrics/miner_metrics_server.erl
Original file line number Diff line number Diff line change
Expand Up @@ -145,11 +145,17 @@ handle_metric_event([blockchain, txn_mgr, submit], _Measurements, #{type := Type
ok;
handle_metric_event([blockchain, txn_mgr, reject], #{block_span := Span}, #{type := Type}) ->
prometheus_counter:inc(?METRICS_TXN_REJECT_COUNT, [Type]),
prometheus_gauge:set(?METRICS_TXN_REJECT_SPAN, [Type], Span),
prometheus_gauge:set(?METRICS_TXN_BLOCK_SPAN, [], Span),
ok;
handle_metric_event([blockchain, txn_mgr, accept], #{block_span := Span}, #{type := Type}) ->
handle_metric_event([blockchain, txn_mgr, accept], #{block_span := Span, queue_len := QLen}, #{type := Type}) ->
prometheus_counter:inc(?METRICS_TXN_ACCEPT_COUNT, [Type]),
prometheus_gauge:set(?METRICS_TXN_ACCEPT_SPAN, [Type], Span),
prometheus_gauge:set(?METRICS_TXN_BLOCK_SPAN, [], Span),
prometheus_gauge:set(?METRICS_TXN_QUEUE, [], QLen),
ok;
handle_metric_event([blockchain, txn_mgr, update], #{block_span := Span, queue_len := QLen}, #{type := Type}) ->
prometheus_counter:inc(?METRICS_TXN_UPDATE_COUNT, [Type]),
prometheus_gauge:set(?METRICS_TXN_BLOCK_SPAN, [], Span),
prometheus_gauge:set(?METRICS_TXN_QUEUE, [], QLen),
ok;
handle_metric_event([blockchain, txn_mgr, process], #{duration := Duration}, #{stage := Stage}) ->
prometheus_histogram:observe(?METRICS_TXN_PROCESS_DURATION, [Stage], Duration),
Expand Down

0 comments on commit ffae14c

Please sign in to comment.