class Fog::Joyent::Analytics::Instrumentation

Public Instance Methods

crtime=(new_crtime) click to toggle source
# File lib/fog/joyent/models/analytics/instrumentation.rb, line 33
def crtime=(new_crtime)
  attributes[:crtime] = Time.at(new_crtime.to_i / 1000)
end
decomposition=(value) click to toggle source
# File lib/fog/joyent/models/analytics/instrumentation.rb, line 37
def decomposition=(value)
  attributes[:decomposition] = value
  self.value_dimension = self.decomposition.size + 1
  self.decomposition
end
destroy() click to toggle source
# File lib/fog/joyent/models/analytics/instrumentation.rb, line 61
def destroy
  requires :id
  service.delete_instrumentation(self.identity)
  true
end
save() click to toggle source
# File lib/fog/joyent/models/analytics/instrumentation.rb, line 43
def save
  requires :joyent_module, :stat
  munged_attributes = self.attributes.dup
  remap_attributes(munged_attributes, {
      :joyent_module => 'module',
      :value_dimension => 'value-dimension',
      :value_arity => 'value-arity',
      :retention_time => 'retention-time',
      :idle_max => 'idle-max',
      :persist_data => 'persist-data',
      :value_scope => 'value-scope'
  })

  data = service.create_instrumentation(munged_attributes)
  merge_attributes(data.body)
  true
end
values(start_time, ndatapoints) click to toggle source

Get a set of datapoints back for an instrumentation use start_time and ndatapoints so we can get back a range of datapoints the interval between datapoints should correspond to the granularity of the instrumentation @param [Time] start_time @param [Integer] ndatapoints

# File lib/fog/joyent/models/analytics/instrumentation.rb, line 72
def values(start_time, ndatapoints)
  requires :id, :granularity
  data = service.get_instrumentation_value(self.uris.find {|uri| uri['name'] == 'value_raw'}['uri'], start_time, ndatapoints, self.granularity).body
  data.map do |datum|
    Fog::Joyent::Analytics::Value.new(datum)
  end
end

Public Class Methods

new(attributes={}) click to toggle source
# File lib/fog/joyent/models/analytics/instrumentation.rb, line 23
def initialize(attributes={})
  self.decomposition = []
  self.value_arity = 'scalar'
  self.retention_time = 600
  self.idle_max = 3600
  self.persist_data = false
  self.value_scope = 'interval'
  super
end