Skip to content

Commit c09f1a8

Browse files
authored
Merge fdf98fd into 8f2bf66
2 parents 8f2bf66 + fdf98fd commit c09f1a8

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

src/mongoose_metrics.erl

+3-1
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,9 @@ pick_by_all_metrics_are_global(WhenGlobal, WhenNot) ->
174174

175175
-spec name_by_all_metrics_are_global(Host :: jid:lserver() | global,
176176
Name :: list()) -> FinalName :: list().
177-
name_by_all_metrics_are_global(Host, Name) ->
177+
name_by_all_metrics_are_global(global, Name) -> [global | Name];
178+
name_by_all_metrics_are_global(Host0, Name) ->
179+
Host = binary:replace(Host0, <<$.>>, <<$_>>, [global]),
178180
pick_by_all_metrics_are_global([global | Name], [Host | Name]).
179181

180182
get_report_interval() ->

test/mongooseim_metrics_SUITE.erl

+8-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ all() ->
1818

1919
groups() ->
2020
[
21-
{ordinary_mode, [], ?ALL_CASES},
21+
{ordinary_mode, [], [dots_in_host_are_turned_to_underscore | ?ALL_CASES]},
2222
{all_metrics_are_global, [], ?ALL_CASES}
2323
].
2424

@@ -83,6 +83,13 @@ subscriptions_initialised(_C) ->
8383
mongoose_metrics:init(),
8484
true = wait_for_update(exometer:get_value([carbon, packets], count), 60).
8585

86+
dots_in_host_are_turned_to_underscore(_C) ->
87+
mongoose_metrics:init(),
88+
mongoose_metrics:ensure_metric(<<"host.with.dots">>, [a, metric, value], histogram),
89+
mongoose_metrics:update(<<"host.with.dots">>, [a, metric, value], 10),
90+
{ok, _} = exometer:get_value([<<"host_with_dots">>, a, metric, value]).
91+
92+
8693
wait_for_update({ok, [{count,X}]}, 0) ->
8794
X > 0;
8895
wait_for_update({ok, [{count,X}]}, _N) when X > 0 ->

0 commit comments

Comments
 (0)