Skip to content
This repository has been archived by the owner on Apr 2, 2024. It is now read-only.

Commit

Permalink
opentsdb_batch: try to convert all strings to numbers instead of chec…
Browse files Browse the repository at this point in the history
…king for a type
  • Loading branch information
timurb committed Oct 13, 2015
1 parent 43b548a commit 7e9c7dd
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion sandbox/lua/encoders/opentsdb_batch.lua
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,8 @@ function process_message()
if tag then
tags[tag] = value
else
if type(value) == "number" and not skip_fields[name] then
value = tonumber(value)
if value and not skip_fields[name] then
if type_as_prefix then
name = string.format("%s.%s", typ, name)
end
Expand Down

1 comment on commit 7e9c7dd

@timurb
Copy link
Contributor Author

@timurb timurb commented on 7e9c7dd Oct 13, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rafrombrc is it ok to do this or constantly calling tonumber() would be slow/unstable?

I've hit an issue when metrics were emitted with incorrect type (string instead of number).
I guess many people will have the same problem which is not so easy to spot so I've added this workaround here.

Any other suggestions on how to handle this here?

Please sign in to comment.