exsentry v0.2.1 ExSentry.Utils
Various utility functions that don’t fit anywhere else. Not intended for end users.
Summary
Functions
Given a list of {headername, value} tuples, returns a map of
%{headername => merged_values} pairs suitable for inclusion in a
Sentry “Http” object as headers
Merges two maps of tags, returning a JSON-compatible structure like [ [tag1, value1], [tag2, value2], ... ]. Allows duplicates
Returns a copy of map
with all nil values (and their keys) removed
Returns the number of seconds since the Unix epoch
Returns the string-formatted version of the given app
Returns a map of {app: version} pairs
Functions
Given a list of {headername, value} tuples, returns a map of
%{headername => merged_values} pairs suitable for inclusion in a
Sentry “Http” object as headers
.
iex> headers = [{"header1", "value1"}, {"header2", "value2"}, {"header1", "value3"}]
iex> headers |> ExSentry.Utils.merge_http_headers
%{"header1" => "value1, value3", "header2" => "value2"}
Specs
merge_tags(map, map) :: [[{:atom, any}]]
Merges two maps of tags, returning a JSON-compatible structure like [ [tag1, value1], [tag2, value2], ... ]. Allows duplicates.
iex> t1 = %{a: 1, b: 2}
iex> t2 = %{a: 3}
iex> ExSentry.Utils.merge_tags(t1, t2)
[[:a, 1], [:b, 2], [:a, 3]]
Specs
strip_nils_from_map(map) :: map
Returns a copy of map
with all nil values (and their keys) removed.
iex> %{a: 1, b: nil, c: 3} |> ExSentry.Utils.strip_nils_from_map
%{a: 1, c: 3}
Specs
version(atom) :: String.t
Returns the string-formatted version of the given app.