From e9d13a7c5931b9ad4e86bf218ff6aff79ac132c0 Mon Sep 17 00:00:00 2001 From: f Date: Sat, 30 Apr 2022 10:49:32 -0300 Subject: [PATCH] mostrar demora --- app/jobs/uri_collection_job.rb | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/app/jobs/uri_collection_job.rb b/app/jobs/uri_collection_job.rb index 196d2e50..ae4b098e 100644 --- a/app/jobs/uri_collection_job.rb +++ b/app/jobs/uri_collection_job.rb @@ -38,7 +38,10 @@ class UriCollectionJob < PeriodicJob host_dimensions = { host: host } columns.each_key do |column| + time_start = Time.now columns[column] = AccessLog.where(**host_dimensions).distinct(column).pluck(column) + + puts "#{column}: #{Time.now - time_start}" end # Las URIs son la fuente de verdad de las visitas, porque son las @@ -51,39 +54,58 @@ class UriCollectionJob < PeriodicJob name = 'host|uri' dimensions = { host: host, uri: uri } + time_start = Time.now rollup(name, beginning, **dimensions) + puts "#{dimensions.values.join}: #{Time.now - time_start}" + + time_start = Time.now reduce_rollup(name, beginning, **dimensions) + puts "reduced: #{Time.now - time_start}" columns.each_pair do |column, values| # Obtener orígenes de visitas por host values.each do |value| + time_start = Time.now + column_name = "host|uri|#{column}" dimensions[column] = value rollup(column_name, beginning, **dimensions) + puts "#{dimensions.values.join}: #{Time.now - time_start}" + + time_start = Time.now reduce_rollup(column_name, beginning, **dimensions) + puts "reduced: #{Time.now - time_start}" end end end # Reducir todas las visitas a cantidad de visitas por host + time_start = Time.now square_rollup(name: 'host|uri', new_name: 'host', interval: starting_interval, dimensions: host_dimensions, beginning: beginning) + puts "#{host}: #{Time.now - time_start}" # Acumular por mes y año + time_start = Time.now reduce_rollup('host', beginning, **host_dimensions) + puts "reduced: #{Time.now - time_start}" columns.each_key do |column| + time_start = Time.now square_rollup(name: "host|uri|#{column}", new_name: "host|#{column}", interval: starting_interval, dimensions: host_dimensions, beginning: beginning) + puts "#{host} #{column}: #{Time.now - time_start}" + time_start = Time.now reduce_rollup("host|#{column}", beginning, **host_dimensions) + puts "reduced: #{Time.now - time_start}" end end