Class: Linr::Data

Inherits:
Object
  • Object
show all
Defined in:
lib/linr/data.rb

Overview

Describes series send to InfluxDB

Examples:

Data.new(
  measurement: cpu_load_short,
  tags: { host: "server01", region: "us-west" },
  fields: { value: 0.64 },
  timestamp: 1434055562
)

See Also:

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(source) ⇒ Data


17
18
19
20
21
22
# File 'lib/linr/data.rb', line 17

def initialize(source)
  @measurement = source.fetch(:measurement)
  @fields      = source.fetch(:fields)
  @tags        = source[:tags]
  @timestamp   = source[:timestamp]
end

Instance Attribute Details

#fieldsObject (readonly)

Returns the value of attribute fields


13
14
15
# File 'lib/linr/data.rb', line 13

def fields
  @fields
end

#measurementObject (readonly)

Returns the value of attribute measurement


12
13
14
# File 'lib/linr/data.rb', line 12

def measurement
  @measurement
end

#tagsObject (readonly)

Returns the value of attribute tags


14
15
16
# File 'lib/linr/data.rb', line 14

def tags
  @tags
end

#timestampObject (readonly)

Returns the value of attribute timestamp


15
16
17
# File 'lib/linr/data.rb', line 15

def timestamp
  @timestamp
end