Class: IngestSample

Inherits:
Object
  • Object
show all
Defined in:
lib/netuitive/ingest_sample.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(metricId, timestamp, val, min, max, avg, sum, cnt) ⇒ IngestSample

Returns a new instance of IngestSample.



4
5
6
7
8
9
10
11
12
13
# File 'lib/netuitive/ingest_sample.rb', line 4

def initialize(metricId, timestamp, val, min, max, avg, sum, cnt)
    @metricId=metricId
    @timestamp=timestamp
    @val=val
    @min=min
    @max=max
    @avg=avg
    @sum=sum
    @cnt=cnt
end

Instance Attribute Details

#avgObject

Returns the value of attribute avg.



3
4
5
# File 'lib/netuitive/ingest_sample.rb', line 3

def avg
  @avg
end

#cntObject

Returns the value of attribute cnt.



3
4
5
# File 'lib/netuitive/ingest_sample.rb', line 3

def cnt
  @cnt
end

#maxObject

Returns the value of attribute max.



3
4
5
# File 'lib/netuitive/ingest_sample.rb', line 3

def max
  @max
end

#metricIdObject

Returns the value of attribute metricId.



3
4
5
# File 'lib/netuitive/ingest_sample.rb', line 3

def metricId
  @metricId
end

#minObject

Returns the value of attribute min.



3
4
5
# File 'lib/netuitive/ingest_sample.rb', line 3

def min
  @min
end

#sumObject

Returns the value of attribute sum.



3
4
5
# File 'lib/netuitive/ingest_sample.rb', line 3

def sum
  @sum
end

#timestampObject

Returns the value of attribute timestamp.



3
4
5
# File 'lib/netuitive/ingest_sample.rb', line 3

def timestamp
  @timestamp
end

#valObject

Returns the value of attribute val.



3
4
5
# File 'lib/netuitive/ingest_sample.rb', line 3

def val
  @val
end

Instance Method Details

#to_json(options = {}) ⇒ Object



14
15
16
17
# File 'lib/netuitive/ingest_sample.rb', line 14

def to_json(options = {})
    millis=@timestamp.to_f * 1000 
    {'metricId' => @metricId,'timestamp' => millis.round, 'val' => @val,'min' => @min, 'max' => @max, 'avg' => @avg,'sum' => @sum, 'cnt' => @cnt}.to_json
end