From b161ff6a54314b5abc9abc507433c12015b5e8f7 Mon Sep 17 00:00:00 2001 From: Syphax Date: Mon, 28 Oct 2024 11:39:21 +0100 Subject: [PATCH] Revert "Feature: Add rails performance gem and save API calls as custom events (#20)" This reverts commit 8788515be8be4101fba62dc4561b3d14b12d40a0. --- Gemfile.lock | 60 ++----------------------------- lib/ontologies_api_client/http.rb | 14 -------- ontologies_api_client.gemspec | 1 - 3 files changed, 3 insertions(+), 72 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 0e45725..b147d35 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -11,27 +11,13 @@ PATH multi_json oj parallel - rails_performance request_store spawnling (= 2.1.5) GEM remote: https://rubygems.org/ specs: - actionpack (7.0.4) - actionview (= 7.0.4) - activesupport (= 7.0.4) - rack (~> 2.0, >= 2.2.0) - rack-test (>= 0.6.3) - rails-dom-testing (~> 2.0) - rails-html-sanitizer (~> 1.0, >= 1.2.0) - actionview (7.0.4) - activesupport (= 7.0.4) - builder (~> 3.1) - erubi (~> 1.4) - rails-dom-testing (~> 2.0) - rails-html-sanitizer (~> 1.1, >= 1.2.0) - activesupport (7.0.4) + activesupport (7.0.8.1) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 1.6, < 2) minitest (>= 5.1) @@ -39,16 +25,11 @@ GEM addressable (2.8.6) public_suffix (>= 2.0.2, < 6.0) bigdecimal (3.1.7) - browser (5.3.1) - builder (3.3.0) coderay (1.1.3) concurrent-ruby (1.2.3) - connection_pool (2.4.1) crack (1.0.0) bigdecimal rexml - crass (1.0.6) - erubi (1.13.0) excon (0.110.0) faraday (2.0.1) faraday-net_http (~> 2.0) @@ -62,16 +43,11 @@ GEM hashdiff (1.1.0) i18n (1.14.4) concurrent-ruby (~> 1.0) - loofah (2.22.0) - crass (~> 1.0.2) - nokogiri (>= 1.12.0) lz4-ruby (0.3.3) method_source (1.1.0) minitest (5.22.3) multi_json (1.15.0) multipart-post (2.4.0) - nokogiri (1.15.6-x86_64-linux) - racc (~> 1.4) oj (3.16.3) bigdecimal (>= 3.0) parallel (1.24.0) @@ -80,36 +56,8 @@ GEM coderay (~> 1.1) method_source (~> 1.0) public_suffix (5.0.5) - racc (1.8.1) - rack (2.2.9) - rack-test (2.1.0) - rack (>= 1.3) - rails-dom-testing (2.2.0) - activesupport (>= 5.0.0) - minitest - nokogiri (>= 1.6) - rails-html-sanitizer (1.6.0) - loofah (~> 2.21) - nokogiri (~> 1.14) - rails_performance (1.2.2) - browser - railties - redis - redis-namespace - railties (7.0.4) - actionpack (= 7.0.4) - activesupport (= 7.0.4) - method_source - rake (>= 12.2) - thor (~> 1.0) - zeitwerk (~> 2.5) + rack (3.0.10) rake (13.2.1) - redis (5.3.0) - redis-client (>= 0.22.0) - redis-client (0.22.2) - connection_pool - redis-namespace (1.11.0) - redis (>= 4) request_store (1.7.0) rack (>= 1.4) rexml (3.2.6) @@ -117,14 +65,12 @@ GEM spawnling (2.1.5) test-unit (3.6.2) power_assert - thor (1.3.2) tzinfo (2.0.6) concurrent-ruby (~> 1.0) webmock (3.23.0) addressable (>= 2.8.0) crack (>= 0.3.2) hashdiff (>= 0.4.0, < 2.0.0) - zeitwerk (2.6.18) PLATFORMS ruby @@ -140,4 +86,4 @@ DEPENDENCIES webmock BUNDLED WITH - 2.4.22 + 2.4.21 diff --git a/lib/ontologies_api_client/http.rb b/lib/ontologies_api_client/http.rb index 36dc67a..ebd8750 100644 --- a/lib/ontologies_api_client/http.rb +++ b/lib/ontologies_api_client/http.rb @@ -4,7 +4,6 @@ require 'ostruct' require 'benchmark' require 'active_support/cache' -require 'rails_performance' if defined?(Rails) ## # This monkeypatch makes OpenStruct act like Struct objects class OpenStruct @@ -78,8 +77,6 @@ def self.get(path, params = {}, options = {}) req.headers[:invalidate_cache] = invalidate_cache end end - - monitor_request(params, path, response, time) puts "Getting: #{path} with #{params} (t: #{time}s - cache: #{response.headers["X-Rack-Cache"]})" if $DEBUG_API_CLIENT rescue Exception => e params = Faraday::Utils.build_query(params) @@ -167,17 +164,6 @@ def self.object_from_json(json) private - def self.monitor_request(params, path, response, time) - RailsPerformance::Models::CustomRecord.new( - tag_name: "Getting: #{path} with #{params} - cache: (#{response.headers["X-Rack-Cache"]})", - namespace_name: "API call #{path}", - status: response.status, - duration: time, - datetime: Time.current.strftime(RailsPerformance::FORMAT), - datetimei: Time.current.to_i).save if defined?(Rails) && RailsPerformance.enabled - end - - def self.custom_req(obj, file, file_attribute, req) req.headers['Content-Type'] = 'application/json' diff --git a/ontologies_api_client.gemspec b/ontologies_api_client.gemspec index 63cc247..b2ae8c2 100644 --- a/ontologies_api_client.gemspec +++ b/ontologies_api_client.gemspec @@ -23,5 +23,4 @@ Gem::Specification.new do |gem| gem.add_dependency('parallel') gem.add_dependency('request_store') gem.add_dependency('spawnling', '2.1.5') - gem.add_dependency('rails_performance') end