5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-16 14:11:41 +00:00

ser más explicitxs

This commit is contained in:
f 2022-04-29 20:06:07 -03:00
parent d56eeb465a
commit 7dad3e9e54

View file

@ -33,39 +33,30 @@ class UriCollectionJob < PeriodicJob
site.hostnames.each do |host|
break if stop?
dimensions = { host: host }
uris.each do |uri|
break if stop?
dimensions[:uri] = uri
rollup('host|uri', beginning, **dimensions)
reduce_rollup('host|uri', beginning, **dimensions)
rollup('host|uri', beginning, host: host, uri: uri)
reduce_rollup('host|uri', beginning, host: host, uri: uri)
end
dimensions.delete(:uri)
# Reducir todas las visitas a cantidad de visitas por host
recursive_rollup(name: 'host|uri',
new_name: 'host',
interval_previous: starting_interval,
interval: starting_interval,
dimensions: dimensions,
dimensions: { host: host },
beginning: beginning)
# Acumular por mes y año
reduce_rollup('host', beginning, **dimensions)
reduce_rollup('host', beginning, host: host)
columns = %i[http_referer geoip2_data_country_name]
columns.each do |column|
# Obtener orígenes de visitas por host
AccessLog.where(host: host).distinct(column).pluck(column).each do |value|
dimensions.delete_if do |k, _|
columns.include? k
end
name = "host|#{column}"
dimensions = { host: host }
dimensions[column] = value
rollup(name, beginning, **dimensions)