mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-27 19:26:24 +00:00
Merge branch 'blazer' into panel.sutty.nl
This commit is contained in:
commit
4994196d6f
1 changed files with 22 additions and 0 deletions
|
@ -38,7 +38,10 @@ class UriCollectionJob < PeriodicJob
|
||||||
|
|
||||||
host_dimensions = { host: host }
|
host_dimensions = { host: host }
|
||||||
columns.each_key do |column|
|
columns.each_key do |column|
|
||||||
|
time_start = Time.now
|
||||||
columns[column] = AccessLog.where(**host_dimensions).distinct(column).pluck(column)
|
columns[column] = AccessLog.where(**host_dimensions).distinct(column).pluck(column)
|
||||||
|
|
||||||
|
puts "#{column}: #{Time.now - time_start}"
|
||||||
end
|
end
|
||||||
|
|
||||||
# Las URIs son la fuente de verdad de las visitas, porque son las
|
# Las URIs son la fuente de verdad de las visitas, porque son las
|
||||||
|
@ -51,39 +54,58 @@ class UriCollectionJob < PeriodicJob
|
||||||
name = 'host|uri'
|
name = 'host|uri'
|
||||||
dimensions = { host: host, uri: uri }
|
dimensions = { host: host, uri: uri }
|
||||||
|
|
||||||
|
time_start = Time.now
|
||||||
rollup(name, beginning, **dimensions)
|
rollup(name, beginning, **dimensions)
|
||||||
|
puts "#{dimensions.values.join}: #{Time.now - time_start}"
|
||||||
|
|
||||||
|
time_start = Time.now
|
||||||
reduce_rollup(name, beginning, **dimensions)
|
reduce_rollup(name, beginning, **dimensions)
|
||||||
|
puts "reduced: #{Time.now - time_start}"
|
||||||
|
|
||||||
columns.each_pair do |column, values|
|
columns.each_pair do |column, values|
|
||||||
# Obtener orígenes de visitas por host
|
# Obtener orígenes de visitas por host
|
||||||
values.each do |value|
|
values.each do |value|
|
||||||
|
time_start = Time.now
|
||||||
|
|
||||||
column_name = "host|uri|#{column}"
|
column_name = "host|uri|#{column}"
|
||||||
dimensions[column] = value
|
dimensions[column] = value
|
||||||
|
|
||||||
rollup(column_name, beginning, **dimensions)
|
rollup(column_name, beginning, **dimensions)
|
||||||
|
puts "#{dimensions.values.join}: #{Time.now - time_start}"
|
||||||
|
|
||||||
|
time_start = Time.now
|
||||||
reduce_rollup(column_name, beginning, **dimensions)
|
reduce_rollup(column_name, beginning, **dimensions)
|
||||||
|
puts "reduced: #{Time.now - time_start}"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# Reducir todas las visitas a cantidad de visitas por host
|
# Reducir todas las visitas a cantidad de visitas por host
|
||||||
|
time_start = Time.now
|
||||||
square_rollup(name: 'host|uri',
|
square_rollup(name: 'host|uri',
|
||||||
new_name: 'host',
|
new_name: 'host',
|
||||||
interval: starting_interval,
|
interval: starting_interval,
|
||||||
dimensions: host_dimensions,
|
dimensions: host_dimensions,
|
||||||
beginning: beginning)
|
beginning: beginning)
|
||||||
|
puts "#{host}: #{Time.now - time_start}"
|
||||||
|
|
||||||
# Acumular por mes y año
|
# Acumular por mes y año
|
||||||
|
time_start = Time.now
|
||||||
reduce_rollup('host', beginning, **host_dimensions)
|
reduce_rollup('host', beginning, **host_dimensions)
|
||||||
|
puts "reduced: #{Time.now - time_start}"
|
||||||
|
|
||||||
columns.each_key do |column|
|
columns.each_key do |column|
|
||||||
|
time_start = Time.now
|
||||||
square_rollup(name: "host|uri|#{column}",
|
square_rollup(name: "host|uri|#{column}",
|
||||||
new_name: "host|#{column}",
|
new_name: "host|#{column}",
|
||||||
interval: starting_interval,
|
interval: starting_interval,
|
||||||
dimensions: host_dimensions,
|
dimensions: host_dimensions,
|
||||||
beginning: beginning)
|
beginning: beginning)
|
||||||
|
puts "#{host} #{column}: #{Time.now - time_start}"
|
||||||
|
|
||||||
|
time_start = Time.now
|
||||||
reduce_rollup("host|#{column}", beginning, **host_dimensions)
|
reduce_rollup("host|#{column}", beginning, **host_dimensions)
|
||||||
|
puts "reduced: #{Time.now - time_start}"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue