newrelic / newrelic-ruby-agent

New Relic RPM Ruby Agent
https://docs.newrelic.com/docs/apm/agents/ruby-agent/getting-started/introduction-new-relic-ruby/
Apache License 2.0
1.2k stars 596 forks source link

OpenAI: Refactor string v symbol lookup #2515

Open hannahramadan opened 6 months ago

hannahramadan commented 6 months ago

OpenAI requests can include a string or a symbol, so the agent currently does an || check to make sure one or the other is avaliable. In performace testing an || check was faster than checking is_a or type_of check.

There is still yet probably a better way to do this, which was captured during a code review. Lets see if we can clean this code up.

workato-integration[bot] commented 6 months ago

https://new-relic.atlassian.net/browse/NR-250396