8000 fix(emqx_ee_connector): log reason for failure when starting influxdb connector by olcai · Pull Request #9881 · emqx/emqx · GitHub
[go: up one dir, main page]

Skip to content
Merged
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
4 changes: 4 additions & 0 deletions changes/ee/feat-9881.en.md
Original file line number Diff line number Diff line change
@@ -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.

3 changes: 3 additions & 0 deletions changes/ee/feat-9881.zh.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
增强了与 InfluxDB 连接健康检查相关的错误日志。
在此更改之前,如果使用配置的参数 InfluxDB 未能通过健康检查,用户仅能获得一个“超时”的信息。
现在,详细的错误消息将显示在日志和控制台,从而让用户更容易地识别和解决问题。
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib-ee/emqx_ee_connector/rebar.config
Original file line number Diff line number Diff line change
@@ -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"}}
]}.
Expand Down
14 changes: 8 additions & 6 deletions lib-ee/emqx_ee_connector/src/emqx_ee_connector_influxdb.erl
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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),
Expand All @@ -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
}),
Expand Down
2 changes: 1 addition & 1 deletion mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -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"},
Expand Down
0