Class: Analytics::UsageTrends::CounterJobWorker
- Inherits:
-
Object
- Object
- Analytics::UsageTrends::CounterJobWorker
- Extended by:
- Gitlab::Utils::Override
- Includes:
- ApplicationWorker
- Defined in:
- app/workers/analytics/usage_trends/counter_job_worker.rb
Constant Summary
Constants included from ApplicationWorker
ApplicationWorker::LOGGING_EXTRA_KEY, ApplicationWorker::SAFE_PUSH_BULK_LIMIT
Constants included from WorkerAttributes
WorkerAttributes::DEFAULT_DATA_CONSISTENCY, WorkerAttributes::NAMESPACE_WEIGHTS, WorkerAttributes::VALID_DATA_CONSISTENCIES, WorkerAttributes::VALID_RESOURCE_BOUNDARIES, WorkerAttributes::VALID_URGENCIES
Instance Method Summary collapse
Methods included from Gitlab::Utils::Override
extended, extensions, included, method_added, override, prepended, queue_verification, verify!
Methods included from Gitlab::SidekiqVersioning::Worker
Methods included from WorkerContext
Instance Method Details
#perform(measurement_identifier, min_id, max_id, recorded_at) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'app/workers/analytics/usage_trends/counter_job_worker.rb', line 18 def perform(measurement_identifier, min_id, max_id, recorded_at) query_scope = ::Analytics::UsageTrends::Measurement.identifier_query_mapping[measurement_identifier].call count = if min_id.nil? || max_id.nil? # table is empty 0 else counter(query_scope, min_id, max_id) end return if count == Gitlab::Database::BatchCounter::FALLBACK UsageTrends::Measurement.insert_all([{ recorded_at: recorded_at, count: count, identifier: measurement_identifier }]) end |