Fixed missing statistics updating for unknown mapping keys in collectd/influxd.

Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
This commit is contained in:
Toni Uhlig
2024-02-18 23:16:31 +01:00
parent 791b27219d
commit 717d66b0e7
2 changed files with 8 additions and 2 deletions

View File

@@ -1074,6 +1074,8 @@ static ssize_t collectd_map_index(char const * const json_key,
struct global_map const * const map, struct global_map const * const map,
size_t map_length) size_t map_length)
{ {
ssize_t unknown_key = -1;
if (json_key == NULL || key_length == 0) if (json_key == NULL || key_length == 0)
{ {
return -1; return -1;
@@ -1083,6 +1085,7 @@ static ssize_t collectd_map_index(char const * const json_key,
{ {
if (map[i].json_key == NULL) if (map[i].json_key == NULL)
{ {
unknown_key = i;
continue; continue;
} }
@@ -1092,7 +1095,7 @@ static ssize_t collectd_map_index(char const * const json_key,
} }
} }
return -1; return unknown_key;
} }
static int collectd_map_flow_u8(struct nDPIsrvd_socket * const sock, static int collectd_map_flow_u8(struct nDPIsrvd_socket * const sock,

View File

@@ -946,6 +946,8 @@ static ssize_t influxd_map_index(char const * const json_key,
struct global_map const * const map, struct global_map const * const map,
size_t map_length) size_t map_length)
{ {
ssize_t unknown_key = -1;
if (json_key == NULL || key_length == 0) if (json_key == NULL || key_length == 0)
{ {
return -1; return -1;
@@ -955,6 +957,7 @@ static ssize_t influxd_map_index(char const * const json_key,
{ {
if (map[i].json_key == NULL) if (map[i].json_key == NULL)
{ {
unknown_key = i;
continue; continue;
} }
@@ -964,7 +967,7 @@ static ssize_t influxd_map_index(char const * const json_key,
} }
} }
return -1; return unknown_key;
} }
static int influxd_map_flow_u8(struct nDPIsrvd_socket * const sock, static int influxd_map_flow_u8(struct nDPIsrvd_socket * const sock,