Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Add performance monitoring section to the admin page #767

Draft
wants to merge 4 commits into
base: development
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ gem 'puma', '~> 5.0'

# Use JavaScript with ESM import maps
# [https://github.com/rails/importmap-rails]
gem 'importmap-rails'
gem 'importmap-rails', '2.0.1'
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is not required


# Hotwire's SPA-like page accelerator
# [https://turbo.hotwired.dev]
Expand All @@ -55,8 +55,9 @@ gem 'tzinfo-data', platforms: %i[mingw mswin x64_mingw jruby]
# Reduces boot times through caching; required in config/boot.rb
gem 'bootsnap', require: false

# Memcached client for Ruby
gem 'dalli'
# For Rails cache store support
gem 'redis'
gem 'redis-rails'

# GraphQL client for Ruby
gem 'graphql-client'
Expand All @@ -65,7 +66,7 @@ gem 'graphql-client'
gem 'haml', '~> 5.1'

# Internationalization (i18n)
gem 'i18n'
gem 'i18n', '~> 1.14.6'
gem 'rails-i18n', '~> 7.0.0'

# MySQL database adapter
Expand Down Expand Up @@ -96,7 +97,7 @@ gem 'flag-icons-rails', '~> 3.4'
gem 'iso-639', '~> 0.3.6'

# Custom API client
gem 'ontologies_api_client', git: 'https://github.com/ontoportal-lirmm/ontologies_api_ruby_client.git', branch: 'development'
gem 'ontologies_api_client', git: 'https://github.com/ontoportal-lirmm/ontologies_api_ruby_client.git', branch: 'feature/add-rails-performance'

# Ruby 2.7.8 pinned gems (to remove when migrating to Ruby >= 3.0)
gem 'ffi', '~> 1.16.3'
Expand All @@ -114,6 +115,9 @@ gem 'omniauth-orcid'
# Used to generate colors randomly
gem "color", "~> 1.8"

# Application performance monitoring
gem 'rails_performance'

group :staging, :production, :appliance do
# Application performance monitoring
gem 'newrelic_rpm'
Expand Down
95 changes: 64 additions & 31 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
GIT
remote: https://github.com/ontoportal-lirmm/ontologies_api_ruby_client.git
revision: 670ce6adfe77aeda97974414ab0ed4b6c5dc9469
branch: development
revision: c473aae92493c2e0de08f0af8ed5812349db9621
branch: feature/add-rails-performance
specs:
ontologies_api_client (2.2.0)
activesupport (~> 7.0.4)
Expand All @@ -13,6 +13,7 @@ GIT
multi_json
oj
parallel
rails_performance
request_store
spawnling (= 2.1.5)

Expand Down Expand Up @@ -104,6 +105,7 @@ GEM
popper_js (>= 1.14.3, < 2)
sassc-rails (>= 2.0.0)
brakeman (5.4.1)
browser (5.3.1)
bugsnag (6.27.1)
concurrent-ruby (~> 1.0)
builder (3.3.0)
Expand Down Expand Up @@ -139,25 +141,25 @@ GEM
coderay (1.1.3)
color (1.8)
concurrent-ruby (1.3.4)
connection_pool (2.4.1)
crack (1.0.0)
bigdecimal
rexml
crass (1.0.6)
css_parser (1.17.1)
addressable
dalli (3.2.8)
date (3.3.4)
debug (1.9.2)
irb (~> 1.10)
reline (>= 0.3.8)
deepl-rb (2.5.3)
deepl-rb (3.0.2)
diff-lcs (1.5.1)
docile (1.4.1)
domain_name (0.6.20240107)
ed25519 (1.3.0)
erubi (1.13.0)
erubis (2.7.0)
excon (0.111.0)
excon (0.112.0)
execjs (2.9.1)
faraday (2.0.1)
faraday-net_http (~> 2.0)
Expand All @@ -176,7 +178,7 @@ GEM
sass-rails
globalid (1.2.1)
activesupport (>= 6.1)
graphql (2.3.14)
graphql (2.3.17)
base64
fiber-storage
graphql-client (0.23.0)
Expand All @@ -203,7 +205,7 @@ GEM
http-accept (1.7.0)
http-cookie (1.0.7)
domain_name (~> 0.5)
i18n (1.14.5)
i18n (1.14.6)
concurrent-ruby (~> 1.0)
i18n-tasks (0.9.37)
activesupport (>= 4.0.2)
Expand All @@ -225,7 +227,7 @@ GEM
activesupport (>= 3.0)
nokogiri (>= 1.6)
io-console (0.7.2)
irb (1.14.0)
irb (1.14.1)
rdoc (>= 4.0.0)
reline (>= 0.4.2)
iso-639 (0.3.6)
Expand All @@ -245,7 +247,7 @@ GEM
bindata
faraday (~> 2.0)
faraday-follow_redirects
jwt (2.8.2)
jwt (2.9.3)
base64
language_server-protocol (3.17.0.3)
launchy (3.0.1)
Expand Down Expand Up @@ -287,12 +289,13 @@ GEM
marcel (1.0.4)
matrix (0.4.2)
method_source (1.1.0)
mime-types (3.5.2)
mime-types (3.6.0)
logger
mime-types-data (~> 3.2015)
mime-types-data (3.2024.0903)
mime-types-data (3.2024.1001)
mini_mime (1.1.5)
minitest (5.25.1)
msgpack (1.7.2)
msgpack (1.7.3)
multi_json (1.15.0)
multi_xml (0.6.0)
multipart-post (2.4.1)
Expand All @@ -302,7 +305,7 @@ GEM
time
net-http (0.3.2)
uri
net-imap (0.4.15)
net-imap (0.4.16)
date
net-protocol
net-pop (0.1.2)
Expand All @@ -315,9 +318,9 @@ GEM
net-ssh (>= 5.0.0, < 8.0.0)
net-smtp (0.5.0)
net-protocol
net-ssh (7.2.3)
net-ssh (7.3.0)
netrc (0.11.0)
newrelic_rpm (9.13.0)
newrelic_rpm (9.14.0)
nio4r (2.7.3)
nokogiri (1.15.6-x86_64-linux)
racc (~> 1.4)
Expand All @@ -328,7 +331,7 @@ GEM
rack (>= 1.2, < 4)
snaky_hash (~> 2.0)
version_gem (~> 1.1)
oj (3.16.5)
oj (3.16.6)
bigdecimal (>= 3.0)
ostruct (>= 0.2)
omniauth (2.1.2)
Expand All @@ -338,8 +341,8 @@ GEM
omniauth-github (2.0.1)
omniauth (~> 2.0)
omniauth-oauth2 (~> 1.8)
omniauth-google-oauth2 (1.1.3)
jwt (>= 2.0)
omniauth-google-oauth2 (1.2.0)
jwt (>= 2.9)
oauth2 (~> 2.0)
omniauth (~> 2.0)
omniauth-oauth2 (~> 1.8)
Expand Down Expand Up @@ -369,13 +372,15 @@ GEM
psych (5.1.2)
stringio
public_suffix (5.1.1)
puma (5.6.8)
puma (5.6.9)
nio4r (~> 2.0)
racc (1.8.1)
rack (2.2.9)
rack-protection (3.2.0)
base64 (>= 0.1.0)
rack (~> 2.2, >= 2.2.4)
rack-session (1.0.2)
rack (< 3)
rack-test (2.1.0)
rack (>= 1.3)
rails (7.0.4)
Expand All @@ -402,6 +407,11 @@ GEM
rails-i18n (7.0.9)
i18n (>= 0.7, < 2)
railties (>= 6.0.0, < 8)
rails_performance (1.2.2)
browser
railties
redis
redis-namespace
railties (7.0.4)
actionpack (= 7.0.4)
activesupport (= 7.0.4)
Expand All @@ -419,6 +429,28 @@ GEM
recaptcha (5.9.0)
json
redcarpet (3.6.0)
redis (5.3.0)
redis-client (>= 0.22.0)
redis-actionpack (5.4.0)
actionpack (>= 5, < 8)
redis-rack (>= 2.1.0, < 4)
redis-store (>= 1.1.0, < 2)
redis-activesupport (5.3.0)
activesupport (>= 3, < 8)
redis-store (>= 1.3, < 2)
redis-client (0.22.2)
connection_pool
redis-namespace (1.11.0)
redis (>= 4)
redis-rack (3.0.0)
rack-session (>= 0.2.0)
redis-store (>= 1.2, < 2)
redis-rails (5.0.2)
redis-actionpack (>= 5.0, < 6)
redis-activesupport (>= 5.0, < 6)
redis-store (>= 1.2, < 2)
redis-store (1.11.0)
redis (>= 4, < 6)
regexp_parser (2.9.2)
reline (0.5.10)
io-console (~> 0.5)
Expand All @@ -429,14 +461,14 @@ GEM
http-cookie (>= 1.0.2, < 2.0)
mime-types (>= 1.16, < 4.0)
netrc (~> 0.8)
rexml (3.3.7)
rouge (4.3.0)
rexml (3.3.8)
rouge (4.4.0)
rspec-core (3.13.1)
rspec-support (~> 3.13.0)
rspec-expectations (3.13.3)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.13.0)
rspec-mocks (3.13.1)
rspec-mocks (3.13.2)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.13.0)
rspec-rails (7.0.1)
Expand All @@ -458,7 +490,7 @@ GEM
rubocop-ast (>= 1.32.2, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 3.0)
rubocop-ast (1.32.2)
rubocop-ast (1.32.3)
parser (>= 3.3.1.0)
ruby-progressbar (1.13.0)
ruby2_keywords (0.0.5)
Expand Down Expand Up @@ -521,13 +553,12 @@ GEM
time (0.4.0)
date
timeout (0.4.1)
turbo-rails (2.0.6)
turbo-rails (2.0.10)
actionpack (>= 6.0.0)
activejob (>= 6.0.0)
railties (>= 6.0.0)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
unicode-display_width (2.5.0)
unicode-display_width (2.6.0)
uri (0.13.1)
version_gem (1.1.4)
view_component (2.83.0)
Expand All @@ -539,7 +570,7 @@ GEM
activemodel (>= 6.0.0)
bindex (>= 0.4.0)
railties (>= 6.0.0)
webmock (3.23.1)
webmock (3.24.0)
addressable (>= 2.8.0)
crack (>= 0.3.2)
hashdiff (>= 0.4.0, < 2.0.0)
Expand Down Expand Up @@ -572,7 +603,6 @@ DEPENDENCIES
capybara
chart-js-rails
color (~> 1.8)
dalli
debug
deepl-rb
ed25519 (>= 1.2, < 2.0)
Expand All @@ -582,10 +612,10 @@ DEPENDENCIES
haml (~> 5.1)
haml-rails
html2haml
i18n
i18n (~> 1.14.6)
i18n-tasks
i18n-tasks-csv (~> 1.1)
importmap-rails
importmap-rails (= 2.0.1)
inline_svg
iso-639 (~> 0.3.6)
jquery-rails
Expand All @@ -610,7 +640,10 @@ DEPENDENCIES
puma (~> 5.0)
rails (= 7.0.4)
rails-i18n (~> 7.0.0)
rails_performance
recaptcha (~> 5.9.0)
redis
redis-rails
rest-client
rspec-rails
rubocop
Expand All @@ -629,4 +662,4 @@ DEPENDENCIES
will_paginate (~> 3.0)

BUNDLED WITH
2.4.22
2.3.23
2 changes: 2 additions & 0 deletions app/views/admin/_monitoring.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
%div
%iframe.embed-responsive.w-100.border{src: 'rails/performance', style: 'height:100vh;'}
4 changes: 3 additions & 1 deletion app/views/admin/index.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

%div
%div.mx-1
- sections = [t('admin.index.analytics'), t('admin.index.site_administration'),t('admin.index.ontology_administration'), t('admin.index.licensing'), t('admin.index.users'), t('admin.index.metadata_administration'), t('admin.index.groups'), t('admin.index.categories'), t('admin.index.persons_and_organizations'), t('admin.index.sparql'), t('admin.index.search')]
- sections = [t('admin.index.analytics'), t('admin.index.site_administration'), "Performance Monitoring", t('admin.index.ontology_administration'), t('admin.index.licensing'), t('admin.index.users'), t('admin.index.metadata_administration'), t('admin.index.groups'), t('admin.index.categories'), t('admin.index.persons_and_organizations'), t('admin.index.sparql'), t('admin.index.search')]
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

localize this in English and French

- selected = params[:section] || sections.first.downcase
= render Layout::VerticalTabsComponent.new(header: t('admin.index.administration_console'), titles: sections, selected: selected, url_parameter: 'section') do |t|
- t.item_content do
Expand All @@ -22,6 +22,8 @@
= render 'analytics'
- t.item_content do
= render 'main'
- t.item_content do
= render 'monitoring'
- t.item_content do
%div
%table{:style => "float:left;"}
Expand Down
2 changes: 1 addition & 1 deletion config/cable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ test:

production:
adapter: redis
url: <%= ENV.fetch("REDIS_URL") { "redis://localhost:6379/1" } %>
url: <%= "redis://#{ENV.fetch("CACHE_HOST", "localhost")}:6379/1" %>
channel_prefix: bioportal_web_ui_production
2 changes: 1 addition & 1 deletion config/environments/appliance.rb
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
require Rails.root.join('config', "bioportal_config_#{Rails.env}.rb")

# Use a different cache store in the appliance.
config.cache_store = :mem_cache_store, ENV["MEMCACHE_SERVERS"] || "localhost:11211", { :namespace => 'bioportal_web_ui', :expires_in => 1.day }
config.cache_store = :redis_cache_store, { url: "redis://#{ENV.fetch("CACHE_HOST", "localhost")}:6379/1", namespace: 'bioportal_web_ui' }


# Disable serving static files from the `/public` folder by default since
Expand Down
Loading
Loading