Class: StatsCloud::Client
- Inherits:
-
Object
- Object
- StatsCloud::Client
- Includes:
- Singleton, AssetsHelper, LoggerHelper, PluginsHelper, StatsCloudHelper
- Defined in:
- lib/statscloud/statscloud_client.rb
Overview
Module which implements StatsCloud framework support.
Instance Method Summary collapse
-
#cluster_status ⇒ Hash
Returns cluster status.
-
#meter ⇒ StatsCloud::StatsmeterClient
Returns statscloud.io client aka Statsmeter client.
-
#start(base_config = nil) ⇒ Thread
Configures statsmeter.io support for application and initializes a statscloud.io client.
-
#stop ⇒ NilClass
Stops statscloud.io service.
-
#with_environment(env) ⇒ Object
Configures Statscloud environment.
-
#with_tags(tags) ⇒ Object
Configures Statscloud tags.
Methods included from PluginsHelper
#check_plugins, #start_plugins_job
Methods included from LoggerHelper
Instance Method Details
#cluster_status ⇒ Hash
Returns cluster status.
76 77 78 79 80 81 |
# File 'lib/statscloud/statscloud_client.rb', line 76 def cluster_status return unless @cluster_client cluster = @cluster_client.get_cluster(@token, @app)&.body check_cluster_status(cluster) cluster[:status][:status] if cluster end |
#meter ⇒ StatsCloud::StatsmeterClient
Returns statscloud.io client aka Statsmeter client
67 68 69 |
# File 'lib/statscloud/statscloud_client.rb', line 67 def meter @statsmeter_client end |
#start(base_config = nil) ⇒ Thread
Configures statsmeter.io support for application and initializes a statscloud.io client.
35 36 37 38 39 40 41 42 43 44 |
# File 'lib/statscloud/statscloud_client.rb', line 35 def start(base_config = nil) initialize_values generate_configuration(base_config) collect_statscloud_assets(@config, @source_mappings) config_values clear_data configure_statscloud_plugins configure_cluster connect_to_cluster end |
#stop ⇒ NilClass
Stops statscloud.io service.
88 89 90 91 92 93 |
# File 'lib/statscloud/statscloud_client.rb', line 88 def stop @statsmeter_client&.close @statsmeter_client = nil @cluster_client&.undeploy_cluster(@token, @app) @cluster_client = nil end |
#with_environment(env) ⇒ Object
Configures Statscloud environment.
49 50 51 52 |
# File 'lib/statscloud/statscloud_client.rb', line 49 def with_environment(env) config_environment(env) self end |
#with_tags(tags) ⇒ Object
Configures Statscloud tags.
57 58 59 60 |
# File 'lib/statscloud/statscloud_client.rb', line 57 def () () self end |