Current section
Files
Jump to
Current section
Files
src/themis.erl
-module(themis).-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch]).-export([new/0, print/1, is_metric_name_used/2]).-export_type([store/0, store_error/0]).-type store() :: {store, gleam@dict:dict(internal@metric:metric_name(), internal@metric:metric(internal@metric@gauge:gauge(), internal@prometheus:number_())), gleam@dict:dict(internal@metric:metric_name(), internal@metric:metric(internal@metric@counter:counter(), internal@prometheus:number_()))}.-type store_error() :: metric_name_already_in_use | metric_name_not_found | {metric_error, internal@metric:metric_error()} | {label_error, internal@label:label_error()} | {counter_error, internal@metric@counter:counter_error()}.-file("/git/Themis/src/themis.gleam", 34).-spec new() -> store().new() -> {store, maps:new(), maps:new()}.-file("/git/Themis/src/themis.gleam", 53).-spec print_gauges( gleam@dict:dict(internal@metric:metric_name(), internal@metric:metric(internal@metric@gauge:gauge(), internal@prometheus:number_()))) -> binary().print_gauges(Gauges) -> _pipe = (gleam@dict:fold( Gauges, [], fun(Current, Gauge, Name) -> [<<(internal@metric@gauge:print(Name, Gauge))/binary, "\n"/utf8>> | Current] end )), _pipe@1 = lists:reverse(_pipe), _pipe@2 = gleam_stdlib:identity(_pipe@1), unicode:characters_to_binary(_pipe@2).-file("/git/Themis/src/themis.gleam", 65).-spec print_counters( gleam@dict:dict(internal@metric:metric_name(), internal@metric:metric(internal@metric@counter:counter(), internal@prometheus:number_()))) -> binary().print_counters(Counters) -> _pipe = (gleam@dict:fold( Counters, [], fun(Current, Counter, Name) -> [<<(internal@metric@counter:print(Name, Counter))/binary, "\n"/utf8>> | Current] end )), _pipe@1 = lists:reverse(_pipe), _pipe@2 = gleam_stdlib:identity(_pipe@1), unicode:characters_to_binary(_pipe@2).-file("/git/Themis/src/themis.gleam", 49).-spec print(store()) -> binary().print(Store) -> <<(print_gauges(erlang:element(2, Store)))/binary, (print_counters(erlang:element(3, Store)))/binary>>.-file("/git/Themis/src/themis.gleam", 77).-spec is_metric_name_used(store(), internal@metric:metric_name()) -> boolean().is_metric_name_used(Store, Name) -> gleam@bool:guard( gleam@dict:has_key(erlang:element(2, Store), Name), true, fun() -> false end ).