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

937/xray configurable #967

Merged
merged 3 commits into from
Feb 15, 2022
Merged
Show file tree
Hide file tree
Changes from all 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
8 changes: 5 additions & 3 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@ gem 'rack', '2.2.3'
gem 'sidekiq-limit_fetch'
gem 'willow_sword', github: 'notch8/willow_sword'

# xray application monitoring through aws
# gem 'aws-xray-sdk', require: ['aws-xray-sdk/facets/rails/railtie']

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 5.1.7'
# Use sqlite3 as the database for Active Record
Expand Down Expand Up @@ -127,3 +124,8 @@ end
group :production do
gem 'clamby'
end

group :aws do
# xray application monitoring through aws
gem 'aws-xray-sdk', require: ['aws-xray-sdk/facets/rails/railtie']
end
75 changes: 41 additions & 34 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -151,24 +151,30 @@ GEM
ast (2.4.2)
autoprefixer-rails (10.4.2.0)
execjs (~> 2)
awesome_nested_set (3.4.0)
activerecord (>= 4.0.0, < 7.0)
awesome_nested_set (3.5.0)
activerecord (>= 4.0.0, < 7.1)
aws-eventstream (1.2.0)
aws-partitions (1.551.0)
aws-sdk-core (3.125.6)
aws-partitions (1.554.0)
aws-sdk-core (3.126.1)
aws-eventstream (~> 1, >= 1.0.2)
aws-partitions (~> 1, >= 1.525.0)
aws-sigv4 (~> 1.1)
jmespath (~> 1.0)
aws-sdk-kms (1.53.0)
aws-sdk-core (~> 3, >= 3.125.0)
aws-sdk-kms (1.54.0)
aws-sdk-core (~> 3, >= 3.126.0)
aws-sigv4 (~> 1.1)
aws-sdk-s3 (1.111.3)
aws-sdk-core (~> 3, >= 3.125.0)
aws-sdk-s3 (1.112.0)
aws-sdk-core (~> 3, >= 3.126.0)
aws-sdk-kms (~> 1)
aws-sigv4 (~> 1.4)
aws-sdk-xray (1.4.0)
aws-sdk-core (~> 3)
aws-sigv4 (~> 1.0)
aws-sigv4 (1.4.0)
aws-eventstream (~> 1, >= 1.0.2)
aws-xray-sdk (0.13.0)
aws-sdk-xray (~> 1.4.0)
multi_json (~> 1)
axiom-types (0.1.1)
descendants_tracker (~> 0.0.4)
ice_nine (~> 0.11.0)
Expand Down Expand Up @@ -231,9 +237,9 @@ GEM
sprockets (~> 3.7)
typhoeus
builder (3.2.4)
bundler-audit (0.7.0.1)
bundler-audit (0.9.0.1)
bundler (>= 1.2.0, < 3)
thor (>= 0.18, < 2)
thor (~> 1.0)
byebug (11.1.3)
cancancan (1.17.0)
capistrano (3.16.0)
Expand Down Expand Up @@ -349,7 +355,7 @@ GEM
dry-monads (1.4.0)
concurrent-ruby (~> 1.0)
dry-core (~> 0.7)
dry-schema (1.8.0)
dry-schema (1.9.0)
concurrent-ruby (~> 1.0)
dry-configurable (~> 0.13, >= 0.13.0)
dry-core (~> 0.5, >= 0.5)
Expand Down Expand Up @@ -567,7 +573,7 @@ GEM
signet
solrizer (>= 3.4, < 5)
tinymce-rails (~> 4.1)
i18n (1.9.1)
i18n (1.10.0)
concurrent-ruby (~> 1.0)
ice_nine (0.11.2)
iiif-image-api (0.2.0)
Expand All @@ -578,7 +584,7 @@ GEM
jbuilder (2.11.5)
actionview (>= 5.0.0)
activesupport (>= 5.0.0)
jmespath (1.5.0)
jmespath (1.6.0)
jquery-datatables-rails (3.4.0)
actionpack (>= 3.1)
jquery-rails
Expand Down Expand Up @@ -680,7 +686,7 @@ GEM
ffi-compiler (~> 1.0)
rake (~> 13.0)
logger (1.5.0)
loofah (2.13.0)
loofah (2.14.0)
crass (~> 1.0.2)
nokogiri (>= 1.5.9)
mail (2.7.1)
Expand Down Expand Up @@ -763,12 +769,12 @@ GEM
power_converter (0.1.2)
public_suffix (4.0.6)
pul_uv_rails (2.0.1)
puma (4.3.10)
puma (4.3.11)
nio4r (~> 2.0)
qa (5.7.0)
qa (5.8.1)
activerecord-import
deprecation
faraday
faraday (< 2.0)
geocoder
ldpath
nokogiri (~> 1.6)
Expand All @@ -781,7 +787,7 @@ GEM
rack-openid (1.4.2)
rack (>= 1.1.0)
ruby-openid (>= 2.1.8)
rack-protection (2.1.0)
rack-protection (2.2.0)
rack
rack-test (1.1.0)
rack (>= 1.0, < 3)
Expand Down Expand Up @@ -816,14 +822,14 @@ GEM
thor (>= 0.18.1, < 2.0)
rainbow (3.1.1)
rake (13.0.6)
rb-fsevent (0.11.0)
rb-fsevent (0.11.1)
rb-inotify (0.10.1)
ffi (~> 1.0)
rdf (3.2.3)
rdf (3.2.4)
link_header (~> 0.0, >= 0.0.8)
rdf-aggregate-repo (3.2.0)
rdf (~> 3.2)
rdf-isomorphic (3.2.0)
rdf-isomorphic (3.2.1)
rdf (~> 3.2)
rdf-json (3.2.0)
rdf (~> 3.2)
Expand Down Expand Up @@ -877,12 +883,12 @@ GEM
rexml (~> 3.2)
redic (1.5.3)
hiredis
redis (4.1.4)
redis (4.5.1)
redis-namespace (1.8.1)
redis (>= 3.0.4)
redlock (1.2.2)
redis (>= 3.0.0, < 5.0)
regexp_parser (2.2.0)
regexp_parser (2.2.1)
representable (3.1.1)
declarative (< 0.1.0)
trailblazer-option (>= 0.1.1, < 0.2.0)
Expand All @@ -902,24 +908,24 @@ GEM
deprecation (>= 1.0.0)
iiif-image-api (>= 0.1.0)
railties (>= 4.2, < 7)
rsolr (2.4.0)
rsolr (2.5.0)
builder (>= 2.1.2)
faraday (>= 0.9.0)
faraday (>= 0.9, < 3, != 2.0.0)
rspec-activemodel-mocks (1.1.0)
activemodel (>= 3.0)
activesupport (>= 3.0)
rspec-mocks (>= 2.99, < 4.0)
rspec-core (3.10.2)
rspec-support (~> 3.10.0)
rspec-expectations (3.10.2)
rspec-core (3.11.0)
rspec-support (~> 3.11.0)
rspec-expectations (3.11.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.10.0)
rspec-support (~> 3.11.0)
rspec-its (1.3.0)
rspec-core (>= 3.0.0)
rspec-expectations (>= 3.0.0)
rspec-mocks (3.10.3)
rspec-mocks (3.11.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.10.0)
rspec-support (~> 3.11.0)
rspec-rails (4.1.2)
actionpack (>= 4.2)
activesupport (>= 4.2)
Expand All @@ -930,7 +936,7 @@ GEM
rspec-support (~> 3.10)
rspec-retry (0.6.2)
rspec-core (> 3.3)
rspec-support (3.10.3)
rspec-support (3.11.0)
rspec_junit_formatter (0.5.1)
rspec-core (>= 2, < 4, != 2.12.0)
rubocop (0.85.1)
Expand Down Expand Up @@ -1000,11 +1006,11 @@ GEM
activesupport (>= 4.0.0)
show_me_the_cookies (5.0.1)
capybara (>= 2, < 4)
sidekiq (5.2.9)
sidekiq (5.2.10)
connection_pool (~> 2.2, >= 2.2.2)
rack (~> 2.0)
rack-protection (>= 1.5.0)
redis (>= 3.3.5, < 4.2)
redis (~> 4.5, < 4.6.0)
sidekiq-limit_fetch (3.4.0)
sidekiq (>= 4)
signet (0.12.0)
Expand Down Expand Up @@ -1127,6 +1133,7 @@ PLATFORMS
DEPENDENCIES
active-fedora (= 11.5.4)
active_attr
aws-xray-sdk
bigdecimal (= 1.3.5)
bixby (>= 1.0.0)
bootstrap-sass (~> 3.4.1)
Expand Down
2 changes: 1 addition & 1 deletion config/deploy/curly.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

set :rails_env, :development
set :bundle_without, %w[production test].join(' ')
set :bundle_without, %w[production test aws].join(' ')
set :branch, 'sandbox'
set :default_env, path: "$PATH:/usr/sbin/"
set :bundle_path, -> { shared_path.join('vendor/bundle') }
Expand Down
2 changes: 1 addition & 1 deletion config/deploy/local.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true
set :rails_env, :development
set :bundle_without, %w[production test].join(' ')
set :bundle_without, %w[production test aws].join(' ')
set :branch, 'chore/#761-deployment-alternative'
set :default_env, path: "$PATH:/usr/local/bin"
append :linked_files, "db/development.sqlite3"
Expand Down
23 changes: 11 additions & 12 deletions config/initializers/aws_xray.rb
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
# frozen_string_literal: true
# # frozen_string_literal: true
# Rails.application.config.xray = {
# name: "Scholar-#{Rails.env}@uc",
# patch: %I[net_http aws_sdk],
# # record db transactions as subsegments
# active_record: true,
# context_missing: 'LOG_ERROR',
# # Makes sure the log file size does not go beyond a size, beyond which it is rotated.
# # Only the latest rotated log will be retained. That is, the max possible size on disk of log files,
# # if `SCHOLAR_XRAY_MAX_LOG_SIZE` is set to 10, would be 10MB(for the actual log) + 10MB(for the latest rotated log).
# logger: Logger.new("log/#{Rails.env}-xray.log", 1, Integer(ENV.fetch("SCHOLAR_XRAY_MAX_LOG_SIZE", "10"), 10).megabytes)
# }
Rails.application.config.xray = {
name: "Scholar-#{Rails.env}@uc",
patch: %I[net_http aws_sdk],
# record db transactions as subsegments
active_record: true,
context_missing: 'LOG_ERROR',
# Makes sure the log file size does not go beyond a size, beyond which it is rotated.
# Only the latest rotated log will be retained. That is, the max possible size on disk of log files,
# if `SCHOLAR_XRAY_MAX_LOG_SIZE` is set to 10, would be 10MB(for the actual log) + 10MB(for the latest rotated log).
logger: Logger.new("log/#{Rails.env}-xray.log", 1, Integer(ENV.fetch("SCHOLAR_XRAY_MAX_LOG_SIZE", "10"), 10).megabytes)
}