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

Log the updated options from central config in addition to cumulative… #758

Merged
merged 1 commit into from
Apr 7, 2020
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
5 changes: 3 additions & 2 deletions lib/elastic_apm/central_config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,10 @@ def handle_success(resp)
assign(update)
end

if @modified_options.any?
if update && update.any?
info 'Updated config from Kibana'
debug 'Modified: %s', @modified_options.inspect
debug 'Modified: %s', update.inspect
debug 'Modified original options: %s', @modified_options.inspect
end
end

Expand Down
7 changes: 6 additions & 1 deletion spec/elastic_apm/central_config_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@ module ElasticAPM
RSpec.describe CentralConfig do
after { WebMock.reset! }

let(:config) { Config.new service_name: 'MyApp' }
let(:config) do
Config.new(service_name: 'MyApp',
log_level: Logger::DEBUG
)
end
subject { described_class.new(config) }

describe '#start' do
Expand Down Expand Up @@ -33,6 +37,7 @@ module ElasticAPM
it 'queries APM Server and applies config' do
req_stub = stub_response({ transaction_sample_rate: '0.5' })
expect(config.logger).to receive(:info)
expect(config.logger).to receive(:debug).twice

subject.fetch_and_apply_config
subject.promise.wait
Expand Down