./ct_report/coverage/mongoose_graphql_stats_global.COVER.html

1 -module(mongoose_graphql_stats_global).
2 -behaviour(mongoose_graphql).
3
4 -export([execute/4]).
5
6 -import(mongoose_graphql_helper, [make_error/2]).
7
8 -ignore_xref([execute/4]).
9
10 -include("../mongoose_graphql_types.hrl").
11 -include("mongoose.hrl").
12 -include("jlib.hrl").
13
14 execute(_Ctx, globalStats, <<"uptimeSeconds">>, _Args) ->
15 4 globalStats(<<"uptimeseconds">>);
16 execute(_Ctx, globalStats, <<"registeredUsers">>, _Args) ->
17 4 globalStats(<<"registeredusers">>);
18 execute(_Ctx, globalStats, <<"onlineUsersNode">>, _Args) ->
19 4 globalStats(<<"onlineusersnode">>);
20 execute(_Ctx, globalStats, <<"onlineUsers">>, _Args) ->
21 4 globalStats(<<"onlineusers">>);
22 execute(_Ctx, globalStats, <<"incomingS2S">>, _Args) ->
23 4 stats_api:incoming_s2s_number();
24 execute(_Ctx, globalStats, <<"outgoingS2S">>, _Args) ->
25 4 stats_api:outgoing_s2s_number().
26
27 globalStats(Name) ->
28 16 case stats_api:stats(Name) of
29 16 {ok, _} = Result -> Result;
30
:-(
Error -> make_error(Error, #{})
31 end.
Line Hits Source