-
Notifications
You must be signed in to change notification settings - Fork 30
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
optionally include IP info at start of search/find linked data requests #302
Conversation
Marks the start of each linked data search/find request. Unless `Qa.config.suppress_ip_data_from_log`, this marker will include IP address, city, state, and country as reported by the `geocoder` gem. NOTE: This also removes inclusion of the request_id directly in the logging messages. To include request_id, it is recommended that you set up the logger to do this automatically in `config/environments/development.rb` (or relevant env file) using… ``` config.log_tags = [:request_id] ```
@@ -16,7 +17,8 @@ class RequestHeaderService | |||
def initialize(request:, params:) | |||
@request = request | |||
@params = params | |||
@request_id = assign_request_id | |||
@request_id = request.request_id |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no need to assign a new one since each request comes with an id
@id = id | ||
url = authority_service.build_url(action_config: term_config, action: :term, action_request: normalize_id, request_header: request_header) | ||
Rails.logger.info "#{request_id} - QA Linked Data term url: #{url}" | ||
Rails.logger.info "QA Linked Data term url: #{url}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are several places where #{request_id}
is removed. The same effect can be achieved with standard logging features. See PR notes for more info.
@@ -2,6 +2,7 @@ | |||
require 'json' | |||
|
|||
describe Qa::LinkedDataTermsController, type: :controller do | |||
let(:graph_load_failure) { /^\*\*\*\*\*\*\*\* RDF\:\:Graph\#load failure/ } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pattern for catching new graph load failure logging. Exact failure is will be driven by the exception thrown and does not require validation here. The required validation is that the logging occurred. This pattern allows for that validation.
Is it a concern that geocode-lookup of every IP address for log line may take non-trivial amounts of time, and add to response times when such logging is turned on? |
Marks the start of each linked data search/find request. Unless
Qa.config.suppress_ip_data_from_log
, this marker will include IP address, city, state, and country as reported by thegeocoder
gem.NOTE: This also removes inclusion of the request_id directly in the logging messages. To include request_id, it is recommended that you set up the logger to do this automatically in
config/environments/development.rb
(or relevant env file) using…