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:
Ivan Dyachkov 2023-02-28 09:49:08 +00:00 committed by GitHub
commit 6ce5029d79
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 18 additions and 9 deletions

View File

@ -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.

View File

@ -0,0 +1,3 @@
增强了与 InfluxDB 连接健康检查相关的错误日志。
在此更改之前,如果使用配置的参数 InfluxDB 未能通过健康检查,用户仅能获得一个“超时”的信息。
现在,详细的错误消息将显示在日志和控制台,从而让用户更容易地识别和解决问题。

View File

@ -827,7 +827,7 @@ t_create_disconnected(Config) ->
end),
fun(Trace) ->
?assertMatch(
[#{error := influxdb_client_not_alive}],
[#{error := influxdb_client_not_alive, reason := econnrefused}],
?of_kind(influxdb_connector_start_failed, Trace)
),
ok

View File

@ -1,7 +1,7 @@
{erl_opts, [debug_info]}.
{deps, [
{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"}}},
{emqx, {path, "../../apps/emqx"}}
]}.

View File

@ -234,7 +234,7 @@ do_start_client(
) ->
case influxdb:start_client(ClientConfig) of
{ok, Client} ->
case influxdb:is_alive(Client) of
case influxdb:is_alive(Client, true) of
true ->
State = #{
client => Client,
@ -249,13 +249,15 @@ do_start_client(
state => redact_auth(State)
}),
{ok, State};
false ->
?tp(influxdb_connector_start_failed, #{error => influxdb_client_not_alive}),
{false, Reason} ->
?tp(influxdb_connector_start_failed, #{
error => influxdb_client_not_alive, reason => Reason
}),
?SLOG(warning, #{
msg => "starting influxdb connector failed",
msg => "failed_to_start_influxdb_connector",
connector => InstId,
client => redact_auth(Client),
reason => "client is not alive"
reason => Reason
}),
%% no leak
_ = influxdb:stop_client(Client),
@ -273,7 +275,7 @@ do_start_client(
{error, Reason} ->
?tp(influxdb_connector_start_failed, #{error => Reason}),
?SLOG(warning, #{
msg => "starting influxdb connector failed",
msg => "failed_to_start_influxdb_connector",
connector => InstId,
reason => Reason
}),

View File

@ -130,7 +130,7 @@ defmodule EMQXUmbrella.MixProject do
defp enterprise_deps(_profile_info = %{edition_type: :enterprise}) do
[
{: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"},
{:kafka_protocol, github: "kafka4beam/kafka_protocol", tag: "4.1.2", override: true},
{:brod_gssapi, github: "kafka4beam/brod_gssapi", tag: "v0.1.0-rc1"},