Class: Metrico::Point
- Inherits:
-
Object
- Object
- Metrico::Point
- Defined in:
- lib/metrico/point.rb
Constant Summary collapse
- ESCAPES =
{ measurement: [' '.freeze, ','.freeze], tag_key: ['='.freeze, ' '.freeze, ','.freeze], tag_value: ['='.freeze, ' '.freeze, ','.freeze], field_key: ['='.freeze, ' '.freeze, ','.freeze, '"'.freeze], field_value: ["\\".freeze, '"'.freeze], }.freeze
Instance Attribute Summary collapse
-
#fields ⇒ Object
Returns the value of attribute fields.
-
#name ⇒ Object
Returns the value of attribute name.
-
#tags ⇒ Object
Returns the value of attribute tags.
Instance Method Summary collapse
-
#initialize(name, fields, tags = {}) ⇒ Point
constructor
A new instance of Point.
-
#to_s ⇒ Object
docs.influxdata.com/influxdb/v1.3/write_protocols/line_protocol_tutorial/ InfluxDB Line Protocol weather,location=us-midwest temperature=82 1465839830100400200 | ——————– ————– | | | | | | | | |
-----------
——–-
———-
———+ |measurement|,tag_set| |field_set| |timestamp|-----------
——–-
———-
———+.
Constructor Details
#initialize(name, fields, tags = {}) ⇒ Point
5 6 7 8 9 10 |
# File 'lib/metrico/point.rb', line 5 def initialize(name, fields, = {}) @name = measurement(name) @fields = escape_fields(fields) = { hostname: Metrico.config.hostname }.merge() = () end |
Instance Attribute Details
#fields ⇒ Object
Returns the value of attribute fields.
3 4 5 |
# File 'lib/metrico/point.rb', line 3 def fields @fields end |
#name ⇒ Object
Returns the value of attribute name.
3 4 5 |
# File 'lib/metrico/point.rb', line 3 def name @name end |
#tags ⇒ Object
Returns the value of attribute tags.
3 4 5 |
# File 'lib/metrico/point.rb', line 3 def end |
Instance Method Details
#to_s ⇒ Object
docs.influxdata.com/influxdb/v1.3/write_protocols/line_protocol_tutorial/ InfluxDB Line Protocol weather,location=us-midwest temperature=82 1465839830100400200
| -------------------- -------------- |
| | | |
| | | |
-----------
——–-
———-
———+ |measurement|,tag_set| |field_set| |timestamp| -----------
——–-
———-
———+
21 22 23 24 25 26 27 |
# File 'lib/metrico/point.rb', line 21 def to_s str = "#{name}" str << ",#{tags}" if str << " #{fields}" str << " #{timestamp}" str end |