instana / ruby-sensor

💎 Ruby Distributed Tracing & Metrics Sensor for Instana
https://www.instana.com/
MIT License
26 stars 25 forks source link

fix: Prevent usage of Oj once requiring it already raised an exception #383

Closed Ferenc- closed 6 months ago

Ferenc- commented 6 months ago

Fixes the following exception, which happens, when the require statement has raised an exception, but only after the 'Oj' name is already defined.

E, [2024-04-29T13:33:24.549280 #108] ERROR -- : undefined method `dump' for Oj:Module

        defined?(Oj) ? Oj.dump(data, mode: :strict) : JSON.dump(data)
                         ^^^^^
Did you mean?  dup