Commit b1226f6f authored by Nick Thomas's avatar Nick Thomas

Convert Geo::Scheduler::SchedulerWorker to use Gitlab::Geo::LogHelpers

parent 8ba33b5d
...@@ -4,6 +4,7 @@ module Geo ...@@ -4,6 +4,7 @@ module Geo
include ApplicationWorker include ApplicationWorker
include GeoQueue include GeoQueue
include ExclusiveLeaseGuard include ExclusiveLeaseGuard
include ::Gitlab::Geo::LogHelpers
include ::Gitlab::Utils::StrongMemoize include ::Gitlab::Utils::StrongMemoize
DB_RETRIEVE_BATCH_SIZE = 1000 DB_RETRIEVE_BATCH_SIZE = 1000
...@@ -68,7 +69,14 @@ module Geo ...@@ -68,7 +69,14 @@ module Geo
private private
# Subclasses should override this method to provide additional metadata
# in log messages
def worker_metadata def worker_metadata
{}
end
def base_log_data(message)
super(message).merge(worker_metadata)
end end
def db_retrieve_batch_size def db_retrieve_batch_size
...@@ -185,18 +193,6 @@ module Geo ...@@ -185,18 +193,6 @@ module Geo
Gitlab::Geo.current_node_enabled? Gitlab::Geo.current_node_enabled?
end end
end end
def log_info(message, extra_args = {})
args = { class: self.class.name, message: message }.merge(extra_args)
args.merge!(worker_metadata) if worker_metadata
Gitlab::Geo::Logger.info(args)
end
def log_error(message, extra_args = {})
args = { class: self.class.name, message: message }.merge(extra_args)
args.merge!(worker_metadata) if worker_metadata
Gitlab::Geo::Logger.error(args)
end
end end
end end
end end
require 'spec_helper'
describe Geo::Scheduler::SchedulerWorker do
it 'includes ::Gitlab::Geo::LogHelpers' do
expect(described_class).to include_module(::Gitlab::Geo::LogHelpers)
end
it 'needs many other specs'
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment