Module: StatsCloud

Extended by:
LoggerHelper
Defined in:
lib/statscloud.rb,
lib/statscloud/version.rb,
lib/statscloud/cluster_client.rb,
lib/statscloud/statscloud_client.rb,
lib/statscloud/statsmeter_client.rb,
lib/statscloud/errors/client_error.rb,
lib/statscloud/helpers/event_helper.rb,
lib/statscloud/helpers/assets_helper.rb,
lib/statscloud/helpers/logger_helper.rb,
lib/statscloud/helpers/plugins_helper.rb,
lib/statscloud/helpers/socketio_helper.rb,
lib/statscloud/helpers/statscloud_helper.rb,
lib/statscloud/helpers/statsmeter_helper.rb,
lib/generators/stats_cloud/install_generator.rb,
lib/statscloud/helpers/parsed_response_helper.rb

Overview

StatsCloud.io ruby client

Defined Under Namespace

Modules: AssetsHelper, EventHelper, LoggerHelper, PluginsHelper, SocketIOHelper, StatsCloudHelper, StatsmeterHelper Classes: Client, ClusterClient, InstallGenerator, ParsedResponseHelper, StatsmeterClient

Constant Summary collapse

VERSION =

version of statscloud-ruby-client.

Type: String

"1.0.6"
ClientError =
Class.new(StandardError)

Class Method Summary collapse

Methods included from LoggerHelper

logger

Class Method Details

.cluster_statusHash

Returns cluster status.

Returns:

  • (Hash)


88
89
90
91
92
# File 'lib/statscloud.rb', line 88

def cluster_status
  stats_cloud_instance.cluster_status
rescue StandardError => error
  logger.error error
end

.meterStatsCloud::StatsmeterClient

Returns statscloud.io client aka Statsmeter client



51
52
53
54
55
# File 'lib/statscloud.rb', line 51

def meter
  stats_cloud_instance.meter
rescue StandardError => error
  logger.error error
end

.record_event(name, measurement = 0) ⇒ Object

Records a single event.

Parameters:

  • name (+String+)

    name of the event to record.

  • measurement (+Integer+) (defaults to: 0)

    optional measurement, depending on metrics type.



63
64
65
# File 'lib/statscloud.rb', line 63

def record_event(name, measurement = 0)
  stats_cloud_instance.record_event(name, measurement)
end

.record_events(*events) ⇒ Object

Records several events at once.

Parameters:

  • events (+Array+)

    events to send (each should have name and optional measurement fields).



71
72
73
# File 'lib/statscloud.rb', line 71

def record_events(*events)
  stats_cloud_instance.record_events(*events)
end

.record_events_array(events) ⇒ Object

Records an array of events at once.

Parameters:

  • events (+Array+)

    array of events to send (each shoud have name and optional measurement fields).



79
80
81
# File 'lib/statscloud.rb', line 79

def record_events_array(events)
  stats_cloud_instance.record_events_array(events)
end

.start(base_config = nil) ⇒ Thread

Configures statsmeter.io support for application and initializes a statscloud.io client.

Parameters:

  • env (+String+)

    statsmeter.io cluster environment

  • base_config (+Hash+) (defaults to: nil)

    statsmeter.io configuration

Returns:

  • (Thread)


22
23
24
25
26
# File 'lib/statscloud.rb', line 22

def start(base_config = nil)
  stats_cloud_instance.start(base_config)
rescue StandardError => error
  logger.error error
end

.stopNilClass

Stops statscloud.io service.

Returns:

  • (NilClass)


99
100
101
102
103
# File 'lib/statscloud.rb', line 99

def stop
  stats_cloud_instance.stop
rescue StandardError => error
  logger.error error
end

.with_environment(env) ⇒ Object

Configures Statscloud environment.

Returns:

  • StatsCloud::Client



31
32
33
34
35
# File 'lib/statscloud.rb', line 31

def with_environment(env)
  stats_cloud_instance.with_environment(env)
rescue StandardError => error
  logger.error error
end

.with_tags(tags) ⇒ Object

Configures Statscloud tags.

Returns:

  • StatsCloud::Client



40
41
42
43
44
# File 'lib/statscloud.rb', line 40

def with_tags(tags)
  stats_cloud_instance.with_tags(tags)
rescue StandardError => error
  logger.error error
end