File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,8 @@ def render_single(component_name, data_hash)
1313 }
1414
1515 response = ::HTTParty . post ( ssr_server_url , body : body . to_json , headers : { "Content-Type" => 'application/json' } )
16+ duration = response . parsed_response . dig ( "results" , "content" , "duration" )
17+ ::Rails . logger . info "SSR render took duration #{ duration } ms"
1618
1719 return ::JSON . parse ( response . body ) . dig ( "results" , "content" , "html" )
1820 end
@@ -32,6 +34,15 @@ def render_many(component_name, payloads=[])
3234
3335 response = ::HTTParty . post ( ssr_server_url , body : body_h . to_json , headers : { "Content-Type" => 'application/json' } )
3436
37+ durations = response . parsed_response [ "results" ] . values . map { |res | res [ "duration" ] }
38+ duration_sum = durations . sum
39+
40+ durations . each do |duration |
41+ ::Rails . logger . info "SSR render took duration #{ duration } ms"
42+ end
43+
44+ ::Rails . logger . info "Total: SSR render took duration #{ duration_sum } ms"
45+
3546 return ::JSON . parse ( response . body ) [ "results" ] . map { |k , v | v [ "html" ] }
3647 end
3748
You can’t perform that action at this time.
0 commit comments