Skip to content
Closed
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: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

## [v1.15.5](https://github.com/DFE-Digital/dfe-analytics/tree/v1.15.5) (2025-04-07)

[Full Changelog](https://github.com/DFE-Digital/dfe-analytics/compare/v1.15.4...v1.15.5)

**Merged pull requests:**

- Add link to DfE Analytics terraform docs from setup readme. [\#190](https://github.com/DFE-Digital/dfe-analytics/pull/190) ([asatwal](https://github.com/asatwal))

## [v1.15.4](https://github.com/DFE-Digital/dfe-analytics/tree/v1.15.4) (2025-01-22)

[Full Changelog](https://github.com/DFE-Digital/dfe-analytics/compare/v1.15.3...v1.15.4)
Expand Down
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
dfe-analytics (1.15.4)
dfe-analytics (1.15.5)
google-cloud-bigquery (~> 1.38)
httparty (~> 0.21)
multi_xml (~> 0.6.0)
Expand Down
14 changes: 7 additions & 7 deletions lib/dfe/analytics.rb
Original file line number Diff line number Diff line change
Expand Up @@ -98,13 +98,13 @@ def self.configure
def self.initialize!
unless defined?(ActiveRecord)
# bail if we don't have AR at all
Rails.logger.info('ActiveRecord not loaded; DfE Analytics not initialized')
Rails.logger.error('ActiveRecord not loaded; DfE Analytics not initialized')
return
end

unless Rails.env.production? || File.exist?(Rails.root.join('config/initializers/dfe_analytics.rb'))
message = "Warning: DfE Analytics is not set up. Run: 'bundle exec rails generate dfe:analytics:install'"
Rails.logger.info(message)
Rails.logger.error(message)
puts message
return
end
Expand All @@ -123,17 +123,17 @@ def self.initialize!
models_for_entity(entity).each do |m|
m.include(DfE::Analytics::TransactionChanges)
if m.include?(DfE::Analytics::Entities)
Rails.logger.info("DEPRECATION WARNING: DfE::Analytics::Entities was manually included in a model (#{m.name}), but it's included automatically since v1.4. You're running v#{DfE::Analytics::VERSION}. To silence this warning, remove the include from model definitions in app/models.")
Rails.logger.warn("DEPRECATION WARNING: DfE::Analytics::Entities was manually included in a model (#{m.name}), but it's included automatically since v1.4. You're running v#{DfE::Analytics::VERSION}. To silence this warning, remove the include from model definitions in app/models.")
else
m.include(DfE::Analytics::Entities)
break
end
end
end
rescue ActiveRecord::PendingMigrationError
Rails.logger.info('Database requires migration; DfE Analytics not initialized')
Rails.logger.error('Database requires migration; DfE Analytics not initialized')
rescue ActiveRecord::ActiveRecordError
Rails.logger.info('No database connection; DfE Analytics not initialized')
Rails.logger.error('No database connection; DfE Analytics not initialized')
end

def self.enabled?
Expand Down Expand Up @@ -276,13 +276,13 @@ def self.parse_maintenance_window
end_time = Time.zone.parse(parsed_end_time.to_s)

if start_time > end_time
Rails.logger.info('Start time is after end time in maintenance window configuration')
Rails.logger.warn('Start time is after end time in maintenance window configuration')
return [nil, nil]
end

[start_time, end_time]
rescue ArgumentError => e
Rails.logger.info("DfE::Analytics: Unexpected error in maintenance window configuration: #{e.message}")
Rails.logger.error("DfE::Analytics: Unexpected error in maintenance window configuration: #{e.message}")
[nil, nil]
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/dfe/analytics/send_events.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module Analytics
class SendEvents < AnalyticsJob
def self.do(events)
unless DfE::Analytics.enabled?
Rails.logger.info('DfE::Analytics::SendEvents.do() called but DfE::Analytics is disabled. Please check DfE::Analytics.enabled? before sending events to BigQuery')
Rails.logger.warn('DfE::Analytics::SendEvents.do() called but DfE::Analytics is disabled. Please check DfE::Analytics.enabled? before sending events to BigQuery')
return
end

Expand Down
2 changes: 1 addition & 1 deletion lib/dfe/analytics/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

module DfE
module Analytics
VERSION = '1.15.4'
VERSION = '1.15.5'
end
end
16 changes: 8 additions & 8 deletions spec/dfe/analytics_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
end

it 'recovers and logs' do
expect(Rails.logger).to receive(:info).with(/No database connection/)
expect(Rails.logger).to receive(:error).with(/No database connection/)
expect { DfE::Analytics.initialize! }.not_to raise_error
end
end
Expand All @@ -37,7 +37,7 @@
end

it 'recovers and logs' do
expect(Rails.logger).to receive(:info).with(/No database connection/)
expect(Rails.logger).to receive(:error).with(/No database connection/)
expect { DfE::Analytics.initialize! }.not_to raise_error
end
end
Expand All @@ -46,7 +46,7 @@
it 'recovers and logs' do
allow(DfE::Analytics::Fields).to receive(:check!).and_raise(ActiveRecord::PendingMigrationError)

expect(Rails.logger).to receive(:info).with(/Database requires migration/)
expect(Rails.logger).to receive(:error).with(/Database requires migration/)
expect { DfE::Analytics.initialize! }.not_to raise_error
end
end
Expand All @@ -55,7 +55,7 @@
it 'recovers and logs' do
hide_const('ActiveRecord')

expect(Rails.logger).to receive(:info).with(/ActiveRecord not loaded/)
expect(Rails.logger).to receive(:error).with(/ActiveRecord not loaded/)
expect { DfE::Analytics.initialize! }.not_to raise_error
end
end
Expand Down Expand Up @@ -137,11 +137,11 @@
end

it 'logs deprecation warnings' do
allow(Rails.logger).to receive(:info).and_call_original
allow(Rails.logger).to receive(:warn).and_call_original

DfE::Analytics.initialize!

expect(Rails.logger).to have_received(:info).twice.with(/DEPRECATION WARNING/)
expect(Rails.logger).to have_received(:warn).twice.with(/DEPRECATION WARNING/)
end
end
end
Expand Down Expand Up @@ -260,7 +260,7 @@
end

it 'logs an error and returns [nil, nil]' do
expect(Rails.logger).to receive(:info).with(/Start time is after end time/)
expect(Rails.logger).to receive(:warn).with(/Start time is after end time/)
expect(described_class.parse_maintenance_window).to eq([nil, nil])
end
end
Expand All @@ -272,7 +272,7 @@
end

it 'logs an error and returns [nil, nil]' do
expect(Rails.logger).to receive(:info).with(/Unexpected error/)
expect(Rails.logger).to receive(:error).with(/Unexpected error/)
expect(described_class.parse_maintenance_window).to eq([nil, nil])
end
end
Expand Down
Loading