Merge pull request #9770 from sstrigler/EMQX-8625-follow-up
EMQX 8625 follow up
This commit is contained in:
commit
5c55783d5f
|
@ -718,7 +718,7 @@ t_metrics(Config) ->
|
|||
{ok, 200, Bridge3Str} = request(get, uri(["bridges", BridgeID, "metrics"]), []),
|
||||
?assertMatch(
|
||||
#{
|
||||
<<"metrics">> := #{<<"success">> := 1},
|
||||
<<"metrics">> := #{<<"success">> := _},
|
||||
<<"node_metrics">> := [_ | _]
|
||||
},
|
||||
jsx:decode(Bridge3Str)
|
||||
|
@ -729,7 +729,7 @@ t_metrics(Config) ->
|
|||
?assertMatch(
|
||||
[
|
||||
#{
|
||||
<<"metrics">> := #{<<"success">> := 1},
|
||||
<<"metrics">> := #{<<"success">> := _},
|
||||
<<"node_metrics">> := [_ | _]
|
||||
}
|
||||
],
|
||||
|
|
|
@ -280,7 +280,7 @@ t_mqtt_conn_bridge_ingress_no_payload_template(_) ->
|
|||
),
|
||||
|
||||
%% verify the metrics of the bridge
|
||||
{ok, 200, BridgeStr} = request(get, uri(["bridges", BridgeIDIngress]), []),
|
||||
{ok, 200, BridgeStr} = request(get, uri(["bridges", BridgeIDIngress, "metrics"]), []),
|
||||
?assertMatch(
|
||||
#{
|
||||
<<"metrics">> := #{<<"matched">> := 0, <<"received">> := 1},
|
||||
|
@ -421,7 +421,7 @@ t_mqtt_conn_bridge_egress_no_payload_template(_) ->
|
|||
),
|
||||
|
||||
%% verify the metrics of the bridge
|
||||
{ok, 200, BridgeStr} = request(get, uri(["bridges", BridgeIDEgress]), []),
|
||||
{ok, 200, BridgeStr} = request(get, uri(["bridges", BridgeIDEgress, "metrics"]), []),
|
||||
?assertMatch(
|
||||
#{
|
||||
<<"metrics">> := #{<<"matched">> := 1, <<"success">> := 1, <<"failed">> := 0},
|
||||
|
|
|
@ -417,6 +417,10 @@ do_get_status(PoolName, Timeout) ->
|
|||
end
|
||||
catch
|
||||
exit:timeout ->
|
||||
?SLOG(error, #{
|
||||
msg => "http_connector_pmap_failed",
|
||||
reason => timeout
|
||||
}),
|
||||
{error, timeout}
|
||||
end.
|
||||
|
||||
|
|
|
@ -111,17 +111,19 @@ on_start(
|
|||
false ->
|
||||
[]
|
||||
end,
|
||||
Options = [
|
||||
maybe_password_opt(maps:get(password, Config, undefined))
|
||||
| [
|
||||
{host, Host},
|
||||
{port, Port},
|
||||
{user, Username},
|
||||
{database, DB},
|
||||
{auto_reconnect, ?AUTO_RECONNECT_INTERVAL},
|
||||
{pool_size, PoolSize}
|
||||
]
|
||||
],
|
||||
Options =
|
||||
maybe_add_password_opt(
|
||||
maps:get(password, Config, undefined),
|
||||
[
|
||||
{host, Host},
|
||||
{port, Port},
|
||||
{user, Username},
|
||||
{database, DB},
|
||||
{auto_reconnect, ?AUTO_RECONNECT_INTERVAL},
|
||||
{pool_size, PoolSize}
|
||||
]
|
||||
),
|
||||
|
||||
PoolName = emqx_plugin_libs_pool:pool_name(InstId),
|
||||
Prepares = parse_prepare_sql(Config),
|
||||
State = maps:merge(#{poolname => PoolName}, Prepares),
|
||||
|
@ -136,10 +138,10 @@ on_start(
|
|||
{error, Reason}
|
||||
end.
|
||||
|
||||
maybe_password_opt(undefined) ->
|
||||
[];
|
||||
maybe_password_opt(Password) ->
|
||||
{password, Password}.
|
||||
maybe_add_password_opt(undefined, Options) ->
|
||||
Options;
|
||||
maybe_add_password_opt(Password, Options) ->
|
||||
[{password, Password} | Options].
|
||||
|
||||
on_stop(InstId, #{poolname := PoolName}) ->
|
||||
?SLOG(info, #{
|
||||
|
|
Loading…
Reference in New Issue