Merge pull request #9881 from olcai/log-influxdb-is-alive-reason
fix(emqx_ee_connector): log reason for failure when starting influxdb connector
This commit is contained in:
commit
6ce5029d79
|
@ -0,0 +1,4 @@
|
||||||
|
In this pull request, we have enhanced the error logs related to InfluxDB connectivity health checks.
|
||||||
|
Previously, if InfluxDB failed to pass the health checks using the specified parameters, the only message provided was "timed out waiting for it to become healthy".
|
||||||
|
With the updated implementation, the error message will be displayed in both the logs and the dashboard, enabling easier identification and resolution of the issue.
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
增强了与 InfluxDB 连接健康检查相关的错误日志。
|
||||||
|
在此更改之前,如果使用配置的参数 InfluxDB 未能通过健康检查,用户仅能获得一个“超时”的信息。
|
||||||
|
现在,详细的错误消息将显示在日志和控制台,从而让用户更容易地识别和解决问题。
|
|
@ -827,7 +827,7 @@ t_create_disconnected(Config) ->
|
||||||
end),
|
end),
|
||||||
fun(Trace) ->
|
fun(Trace) ->
|
||||||
?assertMatch(
|
?assertMatch(
|
||||||
[#{error := influxdb_client_not_alive}],
|
[#{error := influxdb_client_not_alive, reason := econnrefused}],
|
||||||
?of_kind(influxdb_connector_start_failed, Trace)
|
?of_kind(influxdb_connector_start_failed, Trace)
|
||||||
),
|
),
|
||||||
ok
|
ok
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{erl_opts, [debug_info]}.
|
{erl_opts, [debug_info]}.
|
||||||
{deps, [
|
{deps, [
|
||||||
{hstreamdb_erl, {git, "https://github.com/hstreamdb/hstreamdb_erl.git", {tag, "0.2.5"}}},
|
{hstreamdb_erl, {git, "https://github.com/hstreamdb/hstreamdb_erl.git", {tag, "0.2.5"}}},
|
||||||
{influxdb, {git, "https://github.com/emqx/influxdb-client-erl", {tag, "1.1.8"}}},
|
{influxdb, {git, "https://github.com/emqx/influxdb-client-erl", {tag, "1.1.9"}}},
|
||||||
{tdengine, {git, "https://github.com/emqx/tdengine-client-erl", {tag, "0.1.5"}}},
|
{tdengine, {git, "https://github.com/emqx/tdengine-client-erl", {tag, "0.1.5"}}},
|
||||||
{emqx, {path, "../../apps/emqx"}}
|
{emqx, {path, "../../apps/emqx"}}
|
||||||
]}.
|
]}.
|
||||||
|
|
|
@ -234,7 +234,7 @@ do_start_client(
|
||||||
) ->
|
) ->
|
||||||
case influxdb:start_client(ClientConfig) of
|
case influxdb:start_client(ClientConfig) of
|
||||||
{ok, Client} ->
|
{ok, Client} ->
|
||||||
case influxdb:is_alive(Client) of
|
case influxdb:is_alive(Client, true) of
|
||||||
true ->
|
true ->
|
||||||
State = #{
|
State = #{
|
||||||
client => Client,
|
client => Client,
|
||||||
|
@ -249,13 +249,15 @@ do_start_client(
|
||||||
state => redact_auth(State)
|
state => redact_auth(State)
|
||||||
}),
|
}),
|
||||||
{ok, State};
|
{ok, State};
|
||||||
false ->
|
{false, Reason} ->
|
||||||
?tp(influxdb_connector_start_failed, #{error => influxdb_client_not_alive}),
|
?tp(influxdb_connector_start_failed, #{
|
||||||
|
error => influxdb_client_not_alive, reason => Reason
|
||||||
|
}),
|
||||||
?SLOG(warning, #{
|
?SLOG(warning, #{
|
||||||
msg => "starting influxdb connector failed",
|
msg => "failed_to_start_influxdb_connector",
|
||||||
connector => InstId,
|
connector => InstId,
|
||||||
client => redact_auth(Client),
|
client => redact_auth(Client),
|
||||||
reason => "client is not alive"
|
reason => Reason
|
||||||
}),
|
}),
|
||||||
%% no leak
|
%% no leak
|
||||||
_ = influxdb:stop_client(Client),
|
_ = influxdb:stop_client(Client),
|
||||||
|
@ -273,7 +275,7 @@ do_start_client(
|
||||||
{error, Reason} ->
|
{error, Reason} ->
|
||||||
?tp(influxdb_connector_start_failed, #{error => Reason}),
|
?tp(influxdb_connector_start_failed, #{error => Reason}),
|
||||||
?SLOG(warning, #{
|
?SLOG(warning, #{
|
||||||
msg => "starting influxdb connector failed",
|
msg => "failed_to_start_influxdb_connector",
|
||||||
connector => InstId,
|
connector => InstId,
|
||||||
reason => Reason
|
reason => Reason
|
||||||
}),
|
}),
|
||||||
|
|
2
mix.exs
2
mix.exs
|
@ -130,7 +130,7 @@ defmodule EMQXUmbrella.MixProject do
|
||||||
defp enterprise_deps(_profile_info = %{edition_type: :enterprise}) do
|
defp enterprise_deps(_profile_info = %{edition_type: :enterprise}) do
|
||||||
[
|
[
|
||||||
{:hstreamdb_erl, github: "hstreamdb/hstreamdb_erl", tag: "0.2.5"},
|
{:hstreamdb_erl, github: "hstreamdb/hstreamdb_erl", tag: "0.2.5"},
|
||||||
{:influxdb, github: "emqx/influxdb-client-erl", tag: "1.1.7", override: true},
|
{:influxdb, github: "emqx/influxdb-client-erl", tag: "1.1.9", override: true},
|
||||||
{:wolff, github: "kafka4beam/wolff", tag: "1.7.5"},
|
{:wolff, github: "kafka4beam/wolff", tag: "1.7.5"},
|
||||||
{:kafka_protocol, github: "kafka4beam/kafka_protocol", tag: "4.1.2", override: true},
|
{:kafka_protocol, github: "kafka4beam/kafka_protocol", tag: "4.1.2", override: true},
|
||||||
{:brod_gssapi, github: "kafka4beam/brod_gssapi", tag: "v0.1.0-rc1"},
|
{:brod_gssapi, github: "kafka4beam/brod_gssapi", tag: "v0.1.0-rc1"},
|
||||||
|
|
Loading…
Reference in New Issue