Class: CloudwatchMetrics::Client
- Inherits:
-
Object
- Object
- CloudwatchMetrics::Client
- Defined in:
- lib/cloudwatch_metrics.rb
Instance Method Summary collapse
- #configuration ⇒ Object
- #configure {|configuration| ... } ⇒ Object
- #record(name:, value:, unit: nil, namespace: nil, dimensions: nil, timestamp: nil) ⇒ Object
- #record_all(name:, values:, counts:, unit: nil, namespace: nil, dimensions: nil, timestamp: nil) ⇒ Object
Instance Method Details
#configuration ⇒ Object
29 30 31 |
# File 'lib/cloudwatch_metrics.rb', line 29 def configuration @configuration ||= CloudwatchMetrics::Configuration.new end |
#configure {|configuration| ... } ⇒ Object
33 34 35 36 37 |
# File 'lib/cloudwatch_metrics.rb', line 33 def configure yield(configuration) Object.const_set(:CW, CloudwatchMetrics) unless CloudwatchMetrics.configuration.no_cw_alias end |
#record(name:, value:, unit: nil, namespace: nil, dimensions: nil, timestamp: nil) ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/cloudwatch_metrics.rb', line 39 def record( name:, value:, unit: nil, namespace: nil, dimensions: nil, timestamp: nil ) metric_data = [{ metric_name: name, value: value, unit: unit, dimensions: map_dimensions(dimensions), timestamp: }] put_data(namespace: full_namespace(namespace), metric_data: metric_data) rescue StandardError => e handle_error(e) end |
#record_all(name:, values:, counts:, unit: nil, namespace: nil, dimensions: nil, timestamp: nil) ⇒ Object
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/cloudwatch_metrics.rb', line 55 def record_all( name:, values:, counts:, unit: nil, namespace: nil, dimensions: nil, timestamp: nil ) metric_data = [{ metric_name: name, values: values, counts: counts, unit: unit, dimensions: map_dimensions(dimensions), timestamp: }] put_data(namespace: full_namespace(namespace), metric_data: metric_data) rescue StandardError => e handle_error(e) end |