Skip to content

Commit

Permalink
Fixed missing statistics updating for unknown mapping keys in collect…
Browse files Browse the repository at this point in the history
…d/influxd.

Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
  • Loading branch information
utoni committed Feb 20, 2024
1 parent 791b272 commit 717d66b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion examples/c-collectd/c-collectd.c
Original file line number Diff line number Diff line change
Expand Up @@ -1074,6 +1074,8 @@ static ssize_t collectd_map_index(char const * const json_key,
struct global_map const * const map,
size_t map_length)
{
ssize_t unknown_key = -1;

if (json_key == NULL || key_length == 0)
{
return -1;
Expand All @@ -1083,6 +1085,7 @@ static ssize_t collectd_map_index(char const * const json_key,
{
if (map[i].json_key == NULL)
{
unknown_key = i;
continue;
}

Expand All @@ -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,
Expand Down
5 changes: 4 additions & 1 deletion examples/c-influxd/c-influxd.c
Original file line number Diff line number Diff line change
Expand Up @@ -946,6 +946,8 @@ static ssize_t influxd_map_index(char const * const json_key,
struct global_map const * const map,
size_t map_length)
{
ssize_t unknown_key = -1;

if (json_key == NULL || key_length == 0)
{
return -1;
Expand All @@ -955,6 +957,7 @@ static ssize_t influxd_map_index(char const * const json_key,
{
if (map[i].json_key == NULL)
{
unknown_key = i;
continue;
}

Expand All @@ -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,
Expand Down

0 comments on commit 717d66b

Please sign in to comment.