Skylight instrumentation

This allows individual installations to optionally collect performance
data using [Skylight for Open Source](https://www.skylight.io/oss).
This commit is contained in:
Godfrey Chan 2018-02-08 22:29:58 -08:00 committed by James Mason
parent 637f6ce765
commit 0c8095493a
6 changed files with 62 additions and 4 deletions

View file

@ -209,6 +209,9 @@ gem 'sprockets-rails'
# for multiple speakers select on proposal/event forms # for multiple speakers select on proposal/event forms
gem 'selectize-rails' gem 'selectize-rails'
# For collecting performance data
gem 'skylight'
# Nokogiri < 1.8.1 is subject to: # Nokogiri < 1.8.1 is subject to:
# CVE-2017-0663, CVE-2017-7375, CVE-2017-7376, CVE-2017-9047, CVE-2017-9048, # CVE-2017-0663, CVE-2017-7375, CVE-2017-7376, CVE-2017-9047, CVE-2017-9048,
# CVE-2017-9049, CVE-2017-9050 # CVE-2017-9049, CVE-2017-9050

View file

@ -505,6 +505,8 @@ GEM
simplecov-html (~> 0.10.0) simplecov-html (~> 0.10.0)
simplecov-html (0.10.0) simplecov-html (0.10.0)
sixarm_ruby_unaccent (1.1.1) sixarm_ruby_unaccent (1.1.1)
skylight (1.5.1)
activesupport (>= 3.0.0)
slop (3.6.0) slop (3.6.0)
sort_alphabetical (1.0.2) sort_alphabetical (1.0.2)
unicode_utils (>= 1.2.2) unicode_utils (>= 1.2.2)
@ -668,6 +670,7 @@ DEPENDENCIES
sass-rails (>= 4.0.2) sass-rails (>= 4.0.2)
selectize-rails selectize-rails
shoulda-matchers shoulda-matchers
skylight
spring-commands-rspec spring-commands-rspec
sprockets-rails sprockets-rails
sqlite3 sqlite3

View file

@ -106,6 +106,8 @@ There are a couple of environment variables you can set to configure OSEM. Check
| STRIPE_PUBLISHABLE_KEY | *string* | Publishable Key for Stripe Gateway | STRIPE_PUBLISHABLE_KEY | *string* | Publishable Key for Stripe Gateway
| STRIPE_SECRET_KEY | *string* | Secret Key for Stripe Gateway | STRIPE_SECRET_KEY | *string* | Secret Key for Stripe Gateway
| OSEM_REDIS_URL | *string* | Redis server URL e.g. redis://localhost:6379/1 | OSEM_REDIS_URL | *string* | Redis server URL e.g. redis://localhost:6379/1
| SKYLIGHT_AUTHENTICATION | *string* | (Optional) Authentication token for Skylight
| SKYLIGHT_PUBLIC_DASHBOARD_URL | *string* | (Optional) URL to your public Skylight dashboard
### Online Ticket Payments ### Online Ticket Payments
We use [Stripe](https://stripe.com) for accepting your ticket payments securely over the web. We use [Stripe](https://stripe.com) for accepting your ticket payments securely over the web.
@ -130,3 +132,8 @@ Open a separate terminal and go into the directory where the rails app is presen
``` ```
bundle exec rake jobs:work bundle exec rake jobs:work
``` ```
## Performance
If you are experiencing performance issues (or just curious), you may be able to [apply a free Skylight account](https://www.skylight.io/oss).
Once you have your account setup, simply set `SKYLIGHT_AUTHENTICATION` and `SKYLIGHT_PUBLIC_DASHBOARD_URL` in your `.env` file.
If you are reporting a performance issue or submiting a performance patch, it would be helpful (but not required) to link to the relevant Skylight data.

View file

@ -37,11 +37,14 @@
%p.muted.text-center %p.muted.text-center
%small %small
This tool is This tool is
=link_to "free software,", "http://www.gnu.org/philosophy/free-sw.html" #{link_to "free software", "http://www.gnu.org/philosophy/free-sw.html"},
released under the released under the
=link_to "MIT license.", "http://opensource.org/licenses/MIT" #{link_to "MIT license", "http://opensource.org/licenses/MIT"}.
You can run, copy, distribute, study, change and improve it. You can run, copy, distribute, study, change and improve it.
The source code and the developers are on The source code and the developers are on
=link_to "github.", "https://github.com/openSUSE/osem" #{link_to "GitHub", "https://github.com/openSUSE/osem"}.
- if ENV["SKYLIGHT_PUBLIC_DASHBOARD_URL"].present?
Performance data is available on
#{link_to "Skylight", ENV["SKYLIGHT_PUBLIC_DASHBOARD_URL"]}.
= yield :script_body = yield :script_body
= piwik_tracking_tag = piwik_tracking_tag

View file

@ -46,6 +46,10 @@ OSEM_SUSE_SECRET=''
STRIPE_PUBLISHABLE_KEY='' STRIPE_PUBLISHABLE_KEY=''
STRIPE_SECRET_KEY='' STRIPE_SECRET_KEY=''
# (OPTIONAL) Skylight keys. See https://www.skylight.io/oss.
# SKYLIGHT_AUTHENTICATION=''
# SKYLIGHT_PUBLIC_DASHBOARD_URL='https://oss.skylight.io/app/applications/xxxxxxxxxxxx'
# Disable linting of factories in the test suite. # Disable linting of factories in the test suite.
# Speeds up turn around times of tests # Speeds up turn around times of tests
OSEM_FACTORY_LINT="false" OSEM_FACTORY_LINT="false"

View file

@ -30,7 +30,45 @@ describe ApplicationController, type: :controller do
expect(controller.after_sign_in_path_for(user)).to eq conferences_path expect(controller.after_sign_in_path_for(user)).to eq conferences_path
end end
end end
end
end
end
describe ApplicationController, type: :request do
let(:conference) { create(:conference) }
describe 'Skylight link' do
around do |example|
original_value = ENV['SKYLIGHT_PUBLIC_DASHBOARD_URL']
example.run
ENV['SKYLIGHT_PUBLIC_DASHBOARD_URL'] = original_value
end
context 'when SKYLIGHT_PUBLIC_DASHBOARD_URL is set' do
before do
ENV['SKYLIGHT_PUBLIC_DASHBOARD_URL'] = 'https://oss.skylight.io/app/applications/my-osem'
end
it 'should include a link to view performance data' do
get '/'
expect(response.body).to match(/Performance data/i)
expect(response.body).to include('https://oss.skylight.io/app/applications/my-osem')
end
end
context 'when SKYLIGHT_PUBLIC_DASHBOARD_URL is not set' do
before do
ENV['SKYLIGHT_PUBLIC_DASHBOARD_URL'] = nil
end
it 'should not include a link to view performance data' do
get '/'
expect(response.body).to_not match(/performance data/i)
expect(response.body).to_not match(/skylight/i)
end
end end
end end