newrelic/rpm — pull request #144 by maximerety (2014-01-30 14:17:57+00:00)
Title: Instrumenting Mongo::Collection#ensure_index should not blow up if first argument is a String or a Symbol.

Though it's not documented in the "mongo" gem docs, the `Mongo::Collection#ensure_index` method accepts several types of parameters, including `String` and `Symbol`, as the spec of the index.

For example, these are valid calls to `ensure_index` :
```ruby
@collection.ensure_index(:some_id)
# or
@collection.ensure_index("some_id")
```

See : [source of ensure_index](https://github.com/mongodb/mongo-ruby-driver/blob/1.9.2/lib/mongo/collection.rb#L576) and [source of parse_index_spec](https://github.com/mongodb/mongo-ruby-driver/blob/1.9.2/lib/mongo/collection.rb#L1041) (same behavior in the 1.7.1 / 1.8.6 / 1.9.2 versions of the "mongo" gem)

This PR updates the instrumentation code for mongo, avoiding a blow up when using this alternative syntax.

The patch included mimics the behavior adopted by the mongo gem itself ([as show here](https://github.com/mongodb/mongo-ruby-driver/blob/1.9.2/lib/mongo/collection.rb#L1041)).