Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -120,5 +120,8 @@ distclean: clean-build-image

test: eunit common-test

dbg:
$(REBAR) ct -v --suite=apps/hellgate/test/hg_invoice_tests_SUITE.erl --group=all_non_destructive_tests --case=payment_big_cascade_success

Comment on lines +123 to +125
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

это тоже?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Пока оставил для удобства запуска самого "многословного" тесткейса.

cover-report:
$(REBAR) cover
37 changes: 14 additions & 23 deletions apps/hellgate/src/hellgate.erl
Original file line number Diff line number Diff line change
Expand Up @@ -133,25 +133,21 @@ ensure_otel_log_handler() ->
MaxQueue = application:get_env(hellgate, otel_log_max_queue_size, 2048),
DelayMs = application:get_env(hellgate, otel_log_scheduled_delay_ms, 1000),
TimeoutMs = application:get_env(hellgate, otel_log_exporting_timeout_ms, 300000),
LogLevel = application:get_env(hellgate, otel_log_level, info),
HandlerConfig = #{
report_cb => fun hg_otel_log_filter:format_otp_report_utf8/1,
exporter =>
{otel_exporter_logs_otlp, #{
protocol => http_protobuf,
ssl_options => []
}},
max_queue_size => MaxQueue,
scheduled_delay_ms => DelayMs,
exporting_timeout_ms => TimeoutMs
},
LogLevel = application:get_env(hellgate, otel_log_level, debug),
LoggerHandlerConfig = #{
level => LogLevel,
filter_default => log,
filters => [{hg_otel_trace_id_bytes, {fun hg_otel_log_filter:filter/2, undefined}}],
config => HandlerConfig
config => #{
exporter =>
{otel_exporter_logs_otlp, #{
protocol => http_protobuf,
ssl_options => []
}},
max_queue_size => MaxQueue,
scheduled_delay_ms => DelayMs,
exporting_timeout_ms => TimeoutMs
}
},
case logger:add_handler(otel_logs, hg_otel_log_handler, LoggerHandlerConfig) of
case logger:add_handler(otel_logs, otel_log_handler, LoggerHandlerConfig) of
ok ->
ok;
{error, {already_exist, _}} ->
Expand All @@ -171,13 +167,8 @@ ensure_otel_log_handler() ->
flush_otel_logs() ->
case logger:get_handler_config(otel_logs) of
{ok, HandlerCfg} ->
Config = maps:get(config, HandlerCfg, #{}),
DelayMs = maps:get(
scheduled_delay_ms,
Config,
maps:get(scheduled_delay_ms, HandlerCfg, 1000)
),
_ = logger:info("otel_log_handler_flush"),
_ = logger:info("Waiting for OTEL logs exporter to flush"),
DelayMs = maps:get(scheduled_delay_ms, HandlerCfg, 1000),
timer:sleep(erlang:min(?FLUSH_MAX_WAIT_MS, DelayMs + ?FLUSH_EXPORT_OVERHEAD_MS)),
ok;
_ ->
Expand Down
65 changes: 0 additions & 65 deletions apps/hellgate/src/hg_otel_log_filter.erl

This file was deleted.

48 changes: 0 additions & 48 deletions apps/hellgate/src/hg_otel_log_handler.erl

This file was deleted.

2 changes: 1 addition & 1 deletion apps/hellgate/test/hg_ct_helper.erl
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ start_app(party_client = AppName) ->
{
start_app(AppName, [
{services, #{
party_management => "http://party-management:8022/v1/processing/partymgmt"
party_management => <<"http://party-management:8022/v1/processing/partymgmt">>
}},
{woody, #{
% disabled | safe | aggressive
Expand Down
3 changes: 3 additions & 0 deletions apps/hellgate/test/hg_invoice_tests_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -499,6 +499,9 @@ groups() ->

-spec init_per_suite(config()) -> config().
init_per_suite(C) ->
%% NOTE Comment out primary logger's level change to revert to default
%% verbosity of info level.
ok = logger:set_primary_config(level, debug),
% _ = dbg:tracer(),
% _ = dbg:p(all, c),
% _ = dbg:tpl({'hg_invoice_payment', 'p', '_'}, x),
Expand Down
2 changes: 1 addition & 1 deletion config/sys.config
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@

{party_client, [
{services, #{
party_management => "http://party-management:8022/v1/processing/partymgmt"
party_management => <<"http://party-management:8022/v1/processing/partymgmt">>
}},
{woody, #{
% disabled | safe | aggressive
Expand Down
10 changes: 5 additions & 5 deletions rebar.lock
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,12 @@
0},
{<<"opentelemetry_experimental">>,
{git_subdir,"https://github.com/valitydev/opentelemetry-erlang.git",
{ref,"685389b35fb188166e072c389a487a8e5a9f0804"},
{ref,"21c41d1eb6dffb95d51c4b1cd89b38eae00fc08a"},
"apps/opentelemetry_experimental"},
0},
{<<"opentelemetry_exporter">>,
{git_subdir,"https://github.com/valitydev/opentelemetry-erlang.git",
{ref,"685389b35fb188166e072c389a487a8e5a9f0804"},
{ref,"21c41d1eb6dffb95d51c4b1cd89b38eae00fc08a"},
"apps/opentelemetry_exporter"},
0},
{<<"parse_trans">>,{pkg,<<"parse_trans">>,<<"3.3.1">>},2},
Expand Down Expand Up @@ -132,7 +132,7 @@
{ref,"3a60e5dc5bbd709495024f26e100b041c3547fd9"}},
1},
{<<"tls_certificate_check">>,
{pkg,<<"tls_certificate_check">>,<<"1.31.0">>},
{pkg,<<"tls_certificate_check">>,<<"1.32.0">>},
1},
{<<"unicode_util_compat">>,{pkg,<<"unicode_util_compat">>,<<"0.7.1">>},2},
{<<"woody">>,
Expand Down Expand Up @@ -172,7 +172,7 @@
{<<"ranch">>, <<"8C7A100A139FD57F17327B6413E4167AC559FBC04CA7448E9BE9057311597A1D">>},
{<<"recon">>, <<"CBA53FA8DB83AD968C9A652E09C3ED7DDCC4DA434F27C3EAA9CA47FFB2B1FF03">>},
{<<"ssl_verify_fun">>, <<"354C321CF377240C7B8716899E182CE4890C5938111A1296ADD3EC74CF1715DF">>},
{<<"tls_certificate_check">>, <<"9A910B54D8CB96CC810CABF4C0129F21360F82022B20180849F1442A25CCBB04">>},
{<<"tls_certificate_check">>, <<"A9BA9F1EA59F6728F564BC990047B56539C48F17866C2DEFA51D3C872A8DCDF6">>},
{<<"unicode_util_compat">>, <<"A48703A25C170EEDADCA83B11E88985AF08D35F37C6F664D6DCFB106A97782FC">>}]},
{pkg_hash_ext,[
{<<"accept">>, <<"CA69388943F5DAD2E7232A5478F16086E3C872F48E32B88B378E1885A59F5649">>},
Expand Down Expand Up @@ -206,6 +206,6 @@
{<<"ranch">>, <<"49FBCFD3682FAB1F5D109351B61257676DA1A2FDBE295904176D5E521A2DDFE5">>},
{<<"recon">>, <<"2C7523C8DEE91DFF41F6B3D63CBA2BD49EB6D2FE5BF1EEC0DF7F87EB5E230E1C">>},
{<<"ssl_verify_fun">>, <<"FE4C190E8F37401D30167C8C405EDA19469F34577987C76DDE613E838BBC67F8">>},
{<<"tls_certificate_check">>, <<"9D2B41B128D5507BD8AD93E1A998E06D0AB2F9A772AF343F4C00BF76C6BE1532">>},
{<<"tls_certificate_check">>, <<"38E38DB768244D808E11ED27F812E7D927EA5F999007B07D0473DB44D7F7CC51">>},
{<<"unicode_util_compat">>, <<"B3A917854CE3AE233619744AD1E0102E05673136776FB2FA76234F3E03B23642">>}]}
].
Loading