Class: DatadogAPIClient::V1::LogsArithmeticProcessor

Inherits:
Object
  • Object
show all
Defined in:
lib/datadog_api_client/v1/models/logs_arithmetic_processor.rb

Overview

Use the Arithmetic Processor to add a new attribute (without spaces or special characters in the new attribute name) to a log with the result of the provided formula. This enables you to remap different time attributes with different units into a single attribute, or to compute operations on attributes within the same log. The formula can use parentheses and the basic arithmetic operators ‘-`, `+`, `*`, `/`. By default, the calculation is skipped if an attribute is missing. Select “Replace missing attribute by 0” to automatically populate missing attribute values with 0 to ensure that the calculation is done. An attribute is missing if it is not found in the log attributes, or if it cannot be converted to a number. Notes: - The operator `-` needs to be space split in the formula as it can also be contained in attribute names. - If the target attribute already exists, it is overwritten by the result of the formula. - Results are rounded up to the 9th decimal. For example, if the result of the formula is `0.1234567891`, the actual value stored for the attribute is `0.123456789`. - If you need to scale a unit of measure, see [Scale Filter](docs.datadoghq.com/logs/log_configuration/parsing/?tab=filter#matcher-and-filter).

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ LogsArithmeticProcessor

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    attributes Model attributes in the form of hash



84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
# File 'lib/datadog_api_client/v1/models/logs_arithmetic_processor.rb', line 84

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V1::LogsArithmeticProcessor` initialize method"
  end

  # check to see if the attribute exists and convert string to symbol for hash key
  attributes = attributes.each_with_object({}) { |(k, v), h|
    if (!self.class.attribute_map.key?(k.to_sym))
      fail ArgumentError, "`#{k}` is not a valid attribute in `DatadogAPIClient::V1::LogsArithmeticProcessor`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
    end
    h[k.to_sym] = v
  }

  if attributes.key?(:'expression')
    self.expression = attributes[:'expression']
  end

  if attributes.key?(:'is_enabled')
    self.is_enabled = attributes[:'is_enabled']
  else
    self.is_enabled = false
  end

  if attributes.key?(:'is_replace_missing')
    self.is_replace_missing = attributes[:'is_replace_missing']
  else
    self.is_replace_missing = false
  end

  if attributes.key?(:'name')
    self.name = attributes[:'name']
  end

  if attributes.key?(:'target')
    self.target = attributes[:'target']
  end

  if attributes.key?(:'type')
    self.type = attributes[:'type']
  else
    self.type = 'arithmetic-processor'
  end
end

Instance Attribute Details

#expressionObject

Arithmetic operation between one or more log attributes.



27
28
29
# File 'lib/datadog_api_client/v1/models/logs_arithmetic_processor.rb', line 27

def expression
  @expression
end

#is_enabledObject

Whether or not the processor is enabled.



30
31
32
# File 'lib/datadog_api_client/v1/models/logs_arithmetic_processor.rb', line 30

def is_enabled
  @is_enabled
end

#is_replace_missingObject

If ‘true`, it replaces all missing attributes of expression by `0`, `false` skip the operation if an attribute is missing.



33
34
35
# File 'lib/datadog_api_client/v1/models/logs_arithmetic_processor.rb', line 33

def is_replace_missing
  @is_replace_missing
end

#nameObject

Name of the processor.



36
37
38
# File 'lib/datadog_api_client/v1/models/logs_arithmetic_processor.rb', line 36

def name
  @name
end

#targetObject

Name of the attribute that contains the result of the arithmetic operation.



39
40
41
# File 'lib/datadog_api_client/v1/models/logs_arithmetic_processor.rb', line 39

def target
  @target
end

#typeObject

Returns the value of attribute type.



41
42
43
# File 'lib/datadog_api_client/v1/models/logs_arithmetic_processor.rb', line 41

def type
  @type
end