psu-libraries / scholarsphere-3

A web application for ingest, curation, search, and display of digital assets. Powered by Hydra technologies (Rails, Hydra-head, Blacklight, Solr, Fedora Commons, etc.)
Apache License 2.0
78 stars 24 forks source link

User stats is failing each morning #929

Closed carolyncole closed 7 years ago

carolyncole commented 7 years ago

rake scholarsphere:stats:user_stats exited with a non-zero status. WARNING: Use strings for Figaro configuration. false was converted to "false". DEPRECATION WARNING: The configuration option config.serve_static_assets has been renamed to config.serve_static_files to clarify its role (it merely enables serving everything in the public folder and is unrelated to the asset pipeline). The serve_static_assets alias will be removed in Rails 5.0. Please migrate your configuration files accordingly. (called from block in <top (required)> at /opt/heracles/deploy/scholarsphere/releases/20170605152656/config/environments/production.rb:50) rake aborted! NoMethodError: undefined method each' for true:TrueClass /opt/heracles/deploy/scholarsphere/shared/bundle/ruby/2.3.0/bundler/gems/sufia-603e8fc8bd4f/app/services/sufia/user_stat_importer.rb:120:intally_results' /opt/heracles/deploy/scholarsphere/shared/bundle/ruby/2.3.0/bundler/gems/sufia-603e8fc8bd4f/app/services/sufia/user_stat_importer.rb:53:in block in process_files' /opt/heracles/deploy/scholarsphere/shared/bundle/ruby/2.3.0/bundler/gems/sufia-603e8fc8bd4f/app/services/sufia/user_stat_importer.rb:50:ineach' /opt/heracles/deploy/scholarsphere/shared/bundle/ruby/2.3.0/bundler/gems/sufia-603e8fc8bd4f/app/services/sufia/user_stat_importer.rb:50:in process_files' /opt/heracles/deploy/scholarsphere/shared/bundle/ruby/2.3.0/bundler/gems/sufia-603e8fc8bd4f/app/services/sufia/user_stat_importer.rb:30:inblock in import' /opt/heracles/deploy/scholarsphere/shared/bundle/ruby/2.3.0/bundler/gems/sufia-603e8fc8bd4f/app/services/sufia/user_stat_importer.rb:23:in each' /opt/heracles/deploy/scholarsphere/shared/bundle/ruby/2.3.0/bundler/gems/sufia-603e8fc8bd4f/app/services/sufia/user_stat_importer.rb:23:inimport' /opt/heracles/deploy/scholarsphere/shared/bundle/ruby/2.3.0/bundler/gems/sufia-603e8fc8bd4f/tasks/stats_tasks.rake:6:in block (3 levels) in <top (required)>' /opt/heracles/deploy/scholarsphere/shared/bundle/ruby/2.3.0/gems/rake-12.0.0/exe/rake:27:in<top (required)>' /opt/heracles/deploy/.rbenv/versions/2.3.3/bin/bundle:22:in load' /opt/heracles/deploy/.rbenv/versions/2.3.3/bin/bundle:22:in

' Tasks: TOP => sufia:stats:user_stats (See full trace by running task with --trace) 2017-06-09 03:00:22 -0400 (26368) Sufia::UserStatImporter: Begin import of User stats. 2017-06-09 03:00:40 -0400 (26368) ActiveFedora: loading fedora config from /opt/heracles/deploy/scholarsphere/releases/20170605152656/config/fedora.yml 2017-06-09 03:00:40 -0400 (26368) ActiveFedora: loading solr config from /opt/heracles/deploy/scholarsphere/releases/20170605152656/config/solr.yml 2017-06-09 03:00:49 -0400 (26368) Attempted to init base path prod, but it already exists 2017-06-09 03:00:49 -0400 (26368) Sufia::UserStatImporter: Retried FileViewStat on #<struct Struct::UserRecord id=1720, user_key="yft5050", last_stats_update=Sun, 24 Mar 2013 00:00:00 +0000> for file 12j62s508f too many times. 2017-06-09 03:00:49 -0400 (26368) Sufia::UserStatImporter: Last exception Private key file for Google analytics was expected at '/scholarsphere/config_production_new/scholarsphere/ga-privatekey.p12', but no file was found.

carolyncole commented 7 years ago

updated the configurations to allow for information to be gathered on production from google analytics. The directory and the private key configured were wrong.

Now there is another error undefined method `sufia__pageview' for #

carolyncole commented 7 years ago

At this point the following is running from the rails console:

importer = Sufia::UserStatImporter.new(verbose: true, delay_secs: 1.0)
importer.import

Why the rake task is still not running is mysterious. Will need to dig into that tomorrow.

mtribone commented 7 years ago

Is the method not being defined from here: https://github.com/psu-stewardship/scholarsphere/blob/develop/lib/tasks/scholarsphere/stats.rake#L11

mtribone commented 7 years ago

Maybe here: https://github.com/samvera/sufia/blob/f189645d84bc2c796df444ed0b85d8ca84bc84c2/app/models/sufia/statistic.rb#L36

carolyncole commented 7 years ago

We are only allowed 10,000 queries to the reporting API per day.