Class: Google::Cloud::Gemserver::Backend::Stats
- Inherits:
-
Object
- Object
- Google::Cloud::Gemserver::Backend::Stats
- Defined in:
- lib/google/cloud/gemserver/backend/stats.rb
Overview
Stats
Stats provides a set of methods that display detailed information about the deployed gemserver. It includes: general Google Cloud Platform project information, how long the gemserver has been running , what private gems are stored, and what gems have been cached.
Instance Attribute Summary collapse
-
#proj ⇒ String
The project ID of the project on Google Cloud Platform the gemserver was deployed to.
Instance Method Summary collapse
-
#initialize ⇒ Stats
constructor
Initialize a Configuration object and project ID for the Stats object enabling it to fetch detailed information about the gemserver.
-
#log_app_description ⇒ Object
Displays information about the project on Google Cloud Platform the gemserver was deployed to.
-
#run ⇒ Object
Displays various sets of information about the gemserver such as how long it has been running, currently stored, private gems and their status, and cached gems.
Constructor Details
#initialize ⇒ Stats
Initialize a Configuration object and project ID for the Stats object enabling it to fetch detailed information about the gemserver.
42 43 44 45 |
# File 'lib/google/cloud/gemserver/backend/stats.rb', line 42 def initialize @config = Google::Cloud::Gemserver::Configuration.new @proj = (@config[:proj_id] || nil).freeze end |
Instance Attribute Details
#proj ⇒ String
The project ID of the project on Google Cloud Platform the gemserver was deployed to.
36 37 38 |
# File 'lib/google/cloud/gemserver/backend/stats.rb', line 36 def proj @proj end |
Instance Method Details
#log_app_description ⇒ Object
Displays information about the project on Google Cloud Platform the gemserver was deployed to.
61 62 63 64 65 66 |
# File 'lib/google/cloud/gemserver/backend/stats.rb', line 61 def log_app_description return "" if ENV["APP_ENV"] == "test" puts "Project Information:" cmd = "gcloud app describe --project #{@proj}" puts run_cmd(cmd).gsub("\n", "\n\t").prepend "\t" end |
#run ⇒ Object
Displays various sets of information about the gemserver such as how long it has been running, currently stored, private gems and their status, and cached gems.
51 52 53 54 55 56 |
# File 'lib/google/cloud/gemserver/backend/stats.rb', line 51 def run resp = "" resp << log_uptime resp << log_private_gems resp << log_cached_gems end |