7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
# File 'lib/new_relic/agent/instrumentation/ruby_openai/chain.rb', line 7
def self.instrument!
::OpenAI::Client.class_eval do
include NewRelic::Agent::Instrumentation::OpenAI
alias_method(:json_post_without_new_relic, :json_post)
def json_post(**kwargs)
json_post_with_new_relic(**kwargs) do
json_post_without_new_relic(**kwargs)
end
end
class << self
alias_method(:json_post_without_new_relic, :json_post)
def json_post(**kwargs)
json_post_with_new_relic(**kwargs) do
json_post_without_new_relic(**kwargs)
end
end
end
end
end
|