-
Notifications
You must be signed in to change notification settings - Fork 137
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
to_s
all the tags
#51
Conversation
During a migration from 1.6 to 3.0 we discovered that the ability to use symbols as tags is no longer available and raises a `TypeError: can't dup Symbol` exception. The reason for this is that we are running each of the tags through a block and calling `#dup` on each value without checking what data type it is. It's a fair assumption that all values _should_ be strings however our application has shown that this isn't the case and we the DataDog collector handles this fine in 1.6 so I would expect the same to be true in 3.0 unless explicitly stated otherwise. To address the issue here I'm running each value via `#to_s` before we pass it to `#dup` which will ensure that it never gets a symbol and chokes. Closes DataDog#50.
67a54e9
to
3bc17a5
Compare
Using the excellent ground work from @janester in this gist, I did benchmark this and an alternative which looks (slightly) better but does cause a bunch more allocations + memory. This PR (3bc17a5)
Using
|
@jacobbednarz I'm addressing the same issue with #53 |
@jacobbednarz @pschambacher Thanks for the contributions! I think both are needed, as @pschambacher's works for events/service checks + class level tags, but not for the specific use case of @jacobbednarz, Thanks for the benchmark, the current method LGTM! |
@degemer I'm interested in this PR's status... |
Hi @jacobbednarz, i'm going to merge this, thanks for your contribution. |
@zippolyte I wonder if you have a date when git tag with the changes above will be released? |
It would be awesome if you can release a patch v3.0.1 with the changes from that PR and #53 one together! |
During a migration from 1.6 to 3.0 we discovered that the ability to use
symbols as tags is no longer available and raises a
TypeError: can't dup Symbol
exception. The reason for this is that we are running each of thetags through a block and calling
#dup
on each value without checking whatdata type it is. It's a fair assumption that all values
should be strings however our application has shown that this isn't the
case and we the DataDog collector handles this fine in 1.6 so I would
expect the same to be true in 3.0 unless explicitly stated otherwise.
To address the issue here I'm running each value via
#to_s
before we passit to
#dup
which will ensure that it never gets a symbol and chokes.Closes #50.