Skip to content

conn.appendNumber() should have a default case #28

Open
@tabacco

Description

@tabacco

https://github.com/alexcesaro/statsd/blob/master/conn.go#L136-L163

appendNumber accepts an interface{} assuming it'll get a number. But if it gets an unexpected type it appends nothing to the buffer, possibly generating an invalid metric like "somekey:|c". This can happen if, for example, you have a custom type that's aliased from uint64 that you try to pass in as a value to Count().

The simplest solution is probably to have the default case in that switch append '0', but that's also sort of annoyingly hard to debug. I don't have an amazing idea for an alternative here, but wanted to register the issue :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions