Class: InfluxDB::PointValue

Inherits:
Object
  • Object
show all
Defined in:
lib/metrics/influx/point_value.rb

Overview

Convert data point to string using Line protocol

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ PointValue

Returns a new instance of PointValue.



6
7
8
9
10
11
# File 'lib/metrics/influx/point_value.rb', line 6

def initialize(data)
  @series    = escape data[:series], :measurement
  @values    = escape_values data[:values]
  @tags      = escape_tags data[:tags]
  @timestamp = data[:timestamp]
end

Instance Attribute Details

#seriesObject (readonly)

Returns the value of attribute series.



4
5
6
# File 'lib/metrics/influx/point_value.rb', line 4

def series
  @series
end

#tagsObject (readonly)

Returns the value of attribute tags.



4
5
6
# File 'lib/metrics/influx/point_value.rb', line 4

def tags
  @tags
end

#timestampObject (readonly)

Returns the value of attribute timestamp.



4
5
6
# File 'lib/metrics/influx/point_value.rb', line 4

def timestamp
  @timestamp
end

#valuesObject (readonly)

Returns the value of attribute values.



4
5
6
# File 'lib/metrics/influx/point_value.rb', line 4

def values
  @values
end

Instance Method Details

#dumpObject



13
14
15
16
17
18
19
# File 'lib/metrics/influx/point_value.rb', line 13

def dump
  dump =  @series.dup
  dump << ",#{@tags}" if @tags
  dump << " #{@values}"
  dump << " #{@timestamp}" if @timestamp
  dump
end