diff --git a/changes/ee/feat-9881.en.md b/changes/ee/feat-9881.en.md new file mode 100644 index 000000000..546178965 --- /dev/null +++ b/changes/ee/feat-9881.en.md @@ -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. + diff --git a/changes/ee/feat-9881.zh.md b/changes/ee/feat-9881.zh.md new file mode 100644 index 000000000..9746a4c0a --- /dev/null +++ b/changes/ee/feat-9881.zh.md @@ -0,0 +1,3 @@ +增强了与 InfluxDB 连接健康检查相关的错误日志。 +在此更改之前,如果使用配置的参数 InfluxDB 未能通过健康检查,用户仅能获得一个“超时”的信息。 +现在,详细的错误消息将显示在日志和控制台,从而让用户更容易地识别和解决问题。 diff --git a/lib-ee/emqx_ee_bridge/test/emqx_ee_bridge_influxdb_SUITE.erl b/lib-ee/emqx_ee_bridge/test/emqx_ee_bridge_influxdb_SUITE.erl index bbde88cc7..a395f8a36 100644 --- a/lib-ee/emqx_ee_bridge/test/emqx_ee_bridge_influxdb_SUITE.erl +++ b/lib-ee/emqx_ee_bridge/test/emqx_ee_bridge_influxdb_SUITE.erl @@ -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 diff --git a/lib-ee/emqx_ee_connector/rebar.config b/lib-ee/emqx_ee_connector/rebar.config index 54c471f96..d758e1424 100644 --- a/lib-ee/emqx_ee_connector/rebar.config +++ b/lib-ee/emqx_ee_connector/rebar.config @@ -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"}} ]}. diff --git a/lib-ee/emqx_ee_connector/src/emqx_ee_connector_influxdb.erl b/lib-ee/emqx_ee_connector/src/emqx_ee_connector_influxdb.erl index 785ec5d07..453f949be 100644 --- a/lib-ee/emqx_ee_connector/src/emqx_ee_connector_influxdb.erl +++ b/lib-ee/emqx_ee_connector/src/emqx_ee_connector_influxdb.erl @@ -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 }), diff --git a/mix.exs b/mix.exs index 43b0c979f..9abcd9a3b 100644 --- a/mix.exs +++ b/mix.exs @@ -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"},