Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions lib/core/aggregator.ex
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,10 @@ defmodule TelemetryMetricsPrometheus.Core.Aggregator do
end

@spec get_aggregation(key :: key(), table :: atom()) :: {} | aggregation()
defp get_aggregation(key, table) when is_atom(key) do
get_aggregation(to_string(key), table)
end

defp get_aggregation(key, table) do
case :ets.lookup(table, key) do
[] -> {}
Expand All @@ -96,6 +100,10 @@ defmodule TelemetryMetricsPrometheus.Core.Aggregator do
@spec put_aggregation(aggregation :: nil | aggregation(), key :: key(), table :: atom()) :: true
def put_aggregation(nil, _, _), do: true

def put_aggregation(aggregation, key, tid) when is_atom(key) do
put_aggregation(aggregation, to_string(key), tid)
end

def put_aggregation(aggregation, key, tid) do
:ets.insert(tid, {key, aggregation})
end
Expand Down