View Source Datadog.Sketch.IndexMapping behaviour (Data Streams Ex v1.2.2)
Basic module for handling various index mapping algorithms. All functions in this module proxy to the respective index mapping implementation module.
Summary
Types
A general struct that has index mapping data. Every index mapping implementation must contain this data.
Callbacks
Checks if an index mapping matches another index mapping.
Returns value after mapping.
Returns the lower bound the mapping can contain.
Returns the relative accuracy of the mapping.
Returns a Protobuf-able struct for the index mapping. Used for sending data to Datadog.
Takes a mapped value and returns the original value within the set accuracy.
Functions
Checks if an index mapping matches another index mapping.
Returns value after mapping.
Returns the lower bound the mapping can contain.
Returns the lower bound the mapping can contain.
Returns a Protobuf-able struct for the index mapping. Used for sending data to Datadog.
Takes a mapped value and returns the original value within the set accuracy.
Checks if the two values are within the tolerance given.
Types
A general struct that has index mapping data. Every index mapping implementation must contain this data.
Callbacks
Checks if an index mapping matches another index mapping.
Returns value after mapping.
Returns the lower bound the mapping can contain.
Returns the relative accuracy of the mapping.
Returns a Protobuf-able struct for the index mapping. Used for sending data to Datadog.
Takes a mapped value and returns the original value within the set accuracy.
Functions
Checks if an index mapping matches another index mapping.
iex> implementation_one = IndexMapping.Logarithmic.new(0.0000000000001)
...> implementation_two = IndexMapping.Logarithmic.new(0.0000000000002)
...> IndexMapping.equals(implementation_one, implementation_two)
true
iex> implementation_one = IndexMapping.Logarithmic.new(0.01)
...> implementation_two = IndexMapping.Logarithmic.new(0.00001)
...> IndexMapping.equals(implementation_one, implementation_two)
false
Returns value after mapping.
iex> index_mapping = IndexMapping.Logarithmic.new(0.01)
...> IndexMapping.index(index_mapping, 115)
237
iex> index_mapping = IndexMapping.Logarithmic.new(0.001)
...> IndexMapping.index(index_mapping, 12345678901234567890)
21979
Returns the lower bound the mapping can contain.
iex> index_mapping = IndexMapping.Logarithmic.new(0.01)
...> IndexMapping.lower_bound(index_mapping, 0)
1.0
iex> index_mapping = IndexMapping.Logarithmic.new(0.01)
...> IndexMapping.lower_bound(index_mapping, 10)
1.2214109013609646
Returns the lower bound the mapping can contain.
iex> index_mapping = IndexMapping.Logarithmic.new(0.01)
...> IndexMapping.relative_accuracy(index_mapping)
0.009999999999999898
Returns a Protobuf-able struct for the index mapping. Used for sending data to Datadog.
iex> index_mapping = IndexMapping.Logarithmic.new(0.01)
...> IndexMapping.to_proto(index_mapping)
%Datadog.Sketch.Protobuf.IndexMapping{gamma: 1.02020202020202, interpolation: :NONE}
Takes a mapped value and returns the original value within the set accuracy.
iex> index_mapping = IndexMapping.Logarithmic.new(0.01)
...> IndexMapping.value(index_mapping, 237)
115.59680764552533
iex> index_mapping = IndexMapping.Logarithmic.new(0.001)
...> IndexMapping.value(index_mapping, 21979)
1.23355147396003e19
Checks if the two values are within the tolerance given.
Examples
iex> IndexMapping.within_tolerance(90, 134, 50)
true
iex> IndexMapping.within_tolerance(0.00128, 0.00864, 0.01)
false