Class: InfluxDB2::PointSettings

Inherits:
Object
  • Object
show all
Defined in:
lib/influxdb2/client/write_api.rb

Overview

Settings to store default tags.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(default_tags: nil) ⇒ PointSettings

Returns a new instance of PointSettings.

Parameters:

  • default_tags (Hash) (defaults to: nil)

    Default tags which will be added to each point written by api.



87
88
89
# File 'lib/influxdb2/client/write_api.rb', line 87

def initialize(default_tags: nil)
  @default_tags = default_tags || {}
end

Instance Attribute Details

#default_tagsObject (readonly)

Returns the value of attribute default_tags.



90
91
92
# File 'lib/influxdb2/client/write_api.rb', line 90

def default_tags
  @default_tags
end

Class Method Details

.get_value(value) ⇒ Object



96
97
98
99
100
101
102
# File 'lib/influxdb2/client/write_api.rb', line 96

def self.get_value(value)
  if value.start_with?('${env.')
    ENV[value[6..-2]]
  else
    value
  end
end

Instance Method Details

#add_default_tag(key, expression) ⇒ Object



92
93
94
# File 'lib/influxdb2/client/write_api.rb', line 92

def add_default_tag(key, expression)
  @default_tags[key] = expression
end