View Source Datadog.Sketch.Store behaviour (Data Streams Ex v1.2.2)
Different stores use different data structures and techniques to store data. Each with unique trade offs and memory usage. All functions in this module proxy to the respective index mapping implementation module.
All stores implement the Enumerable
protocol to iterate over all stored
data easily.
Summary
Types
A concise way to specify an index and count in one arg.
A basic struct. This is used to keep tight type definitions. Each store implements this struct differently.
Callbacks
Adds a number to the store.
Adds a bin type to the store.
Adds multiple bin types to the store.
Adds a number to the store count
number of times.
Checks if the store has any information in it.
Return the key for the value at rank.
Returns the maximum index of the store.
Returns the minimum index of the store.
Maps over all values and multiplies by the given weight.
Returns a struct for Protobuf encoding. Used for sending data to Datadog.
Returns the total amount of counts stored.
Functions
Adds a number to the store.
Adds a bin type to the store.
Adds multiple bin types to the store.
Adds a number to the store count
number of times.
Checks if the store has any information in it.
Return the key for the value at rank.
Returns the maximum index of the store.
Returns the minimum index of the store.
Maps over all values and multiplies by the given weight.
Returns a struct for Protobuf encoding. Used for sending data to Datadog.
Returns the total amount of counts stored.
Types
A concise way to specify an index and count in one arg.
@type t() :: struct()
A basic struct. This is used to keep tight type definitions. Each store implements this struct differently.
Callbacks
Adds a number to the store.
Adds a bin type to the store.
Adds multiple bin types to the store.
Adds a number to the store count
number of times.
@callback empty?(t()) :: bool()
Checks if the store has any information in it.
Return the key for the value at rank.
Returns the maximum index of the store.
Returns the minimum index of the store.
Maps over all values and multiplies by the given weight.
Returns a struct for Protobuf encoding. Used for sending data to Datadog.
Returns the total amount of counts stored.
Functions
Adds a number to the store.
Examples
iex> %Store.Dense{} = Store.add(Store.Dense.new(), 100)
Adds a bin type to the store.
Examples
iex> %Store.Dense{} = Store.add_bin(Store.Dense.new(), %{index: 100, count: 13.13})
Adds multiple bin types to the store.
Examples
iex> %Store.Dense{} = Store.add_bins(Store.Dense.new(), [
...> %{index: 100, count: 13.13},
...> %{index: 20, count: 2342.4}
...> ])
Adds a number to the store count
number of times.
Examples
iex> %Store.Dense{} = Store.add_with_count(Store.Dense.new(), 100, 13.13)
iex> %Store.Dense{} = Store.add_with_count(Store.Dense.new(), 987, 8.3e12)
@spec empty?(t()) :: bool()
Checks if the store has any information in it.
Examples
iex> store = Store.Dense.new()
...> Store.empty?(store)
true
iex> store = Store.add(Store.Dense.new(), 754)
...> Store.empty?(store)
false
Return the key for the value at rank.
Examples
iex> store = Store.add(Store.Dense.new(), 128)
...> Store.key_at_rank(store, 0.0)
128
Returns the maximum index of the store.
Examples
iex> store = Store.Dense.new()
...> Store.max_index(store)
0
Returns the minimum index of the store.
Examples
iex> store = Store.Dense.new()
...> Store.min_index(store)
0
Maps over all values and multiplies by the given weight.
Examples
iex> store = Store.add_bins(Store.Dense.new(), [
...> %{index: 4, count: 10.0},
...> %{index: 2, count: 20.0},
...> %{index: 6, count: 30.0}
...> ])
...> store = Store.reweight(store, 2)
...> Store.total_count(store)
120.0
Returns a struct for Protobuf encoding. Used for sending data to Datadog.
Examples
iex> %Datadog.Sketch.Protobuf.Store{} = Store.to_proto(Store.Dense.new())
Returns the total amount of counts stored.
Examples
iex> store = Store.Dense.new()
...> Store.total_count(store)
0.0
iex> store = Store.add_with_count(Store.Dense.new(), 754, 42.42)
...> Store.total_count(store)
42.42