elasticsearch/logstash — pull request #1145 by devin-c (2014-03-01 01:37:04+00:00)
Title: Avoid monkey patching `Time#to_json`

While testing a gem dependent on logstash-event, I was encountering
intermittent anomolies in `LogStash::Event#to_json`. Sometimes it
encoded `@timestamp` with the patched version, i.e., `#iso8601(3)` and
other times it encoded it with the non-patched version, i.e.,
`#iso8601()`.

I was not able to discover what library was reverting the patched
version of `Time#to_json`, but I found that this change fixed the issue
for me. Admittedly, it adds a bit of overhead by cloning the `@data`,
but it seemed negligible in my testing, and I believe that avoiding the
monkey patch to `Time` is worth the cost.