Merge pull request #11453 from thalesmg/fix-influxdb-probe-write-syntax-20230815
fix(influxdb_bridge): avoid double-parsing write syntax during probe
This commit is contained in:
commit
c60751b401
|
@ -1,6 +1,6 @@
|
||||||
{application, emqx_bridge_influxdb, [
|
{application, emqx_bridge_influxdb, [
|
||||||
{description, "EMQX Enterprise InfluxDB Bridge"},
|
{description, "EMQX Enterprise InfluxDB Bridge"},
|
||||||
{vsn, "0.1.3"},
|
{vsn, "0.1.4"},
|
||||||
{registered, []},
|
{registered, []},
|
||||||
{applications, [
|
{applications, [
|
||||||
kernel,
|
kernel,
|
||||||
|
|
|
@ -168,6 +168,9 @@ write_syntax(format) ->
|
||||||
write_syntax(_) ->
|
write_syntax(_) ->
|
||||||
undefined.
|
undefined.
|
||||||
|
|
||||||
|
to_influx_lines(Lines = [#{} | _]) ->
|
||||||
|
%% already parsed/converted (e.g.: bridge_probe, after hocon_tconf:check_plain)
|
||||||
|
Lines;
|
||||||
to_influx_lines(RawLines) ->
|
to_influx_lines(RawLines) ->
|
||||||
try
|
try
|
||||||
influx_lines(str(RawLines), [])
|
influx_lines(str(RawLines), [])
|
||||||
|
|
|
@ -66,7 +66,9 @@ on_start(InstId, Config) ->
|
||||||
on_stop(InstId, _State) ->
|
on_stop(InstId, _State) ->
|
||||||
case emqx_resource:get_allocated_resources(InstId) of
|
case emqx_resource:get_allocated_resources(InstId) of
|
||||||
#{?influx_client := Client} ->
|
#{?influx_client := Client} ->
|
||||||
influxdb:stop_client(Client);
|
Res = influxdb:stop_client(Client),
|
||||||
|
?tp(influxdb_client_stopped, #{instance_id => InstId}),
|
||||||
|
Res;
|
||||||
_ ->
|
_ ->
|
||||||
ok
|
ok
|
||||||
end.
|
end.
|
||||||
|
|
|
@ -124,6 +124,9 @@ init_per_group(InfluxDBType, Config0) when
|
||||||
{influxdb_config, InfluxDBConfig},
|
{influxdb_config, InfluxDBConfig},
|
||||||
{influxdb_config_string, ConfigString},
|
{influxdb_config_string, ConfigString},
|
||||||
{ehttpc_pool_name, EHttpcPoolName},
|
{ehttpc_pool_name, EHttpcPoolName},
|
||||||
|
{bridge_type, influxdb_api_v1},
|
||||||
|
{bridge_name, Name},
|
||||||
|
{bridge_config, InfluxDBConfig},
|
||||||
{influxdb_name, Name}
|
{influxdb_name, Name}
|
||||||
| Config
|
| Config
|
||||||
];
|
];
|
||||||
|
@ -193,6 +196,9 @@ init_per_group(InfluxDBType, Config0) when
|
||||||
{influxdb_config, InfluxDBConfig},
|
{influxdb_config, InfluxDBConfig},
|
||||||
{influxdb_config_string, ConfigString},
|
{influxdb_config_string, ConfigString},
|
||||||
{ehttpc_pool_name, EHttpcPoolName},
|
{ehttpc_pool_name, EHttpcPoolName},
|
||||||
|
{bridge_type, influxdb_api_v2},
|
||||||
|
{bridge_name, Name},
|
||||||
|
{bridge_config, InfluxDBConfig},
|
||||||
{influxdb_name, Name}
|
{influxdb_name, Name}
|
||||||
| Config
|
| Config
|
||||||
];
|
];
|
||||||
|
@ -570,6 +576,10 @@ t_start_ok(Config) ->
|
||||||
),
|
),
|
||||||
ok.
|
ok.
|
||||||
|
|
||||||
|
t_start_stop(Config) ->
|
||||||
|
ok = emqx_bridge_testlib:t_start_stop(Config, influxdb_client_stopped),
|
||||||
|
ok.
|
||||||
|
|
||||||
t_start_already_started(Config) ->
|
t_start_already_started(Config) ->
|
||||||
Type = influxdb_type_bin(?config(influxdb_type, Config)),
|
Type = influxdb_type_bin(?config(influxdb_type, Config)),
|
||||||
Name = ?config(influxdb_name, Config),
|
Name = ?config(influxdb_name, Config),
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
Fixed an issue which would yield false negatives when testing the connectivity of InfluxDB bridges.
|
Loading…
Reference in New Issue