Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:Ledest:erlang
erlang
4138-megaco-Types-and-spec-for-megaco-get_stats...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 4138-megaco-Types-and-spec-for-megaco-get_stats-0-1-2.patch of Package erlang
From 6ac4535b27c57474f29caf8e64ed0e10262edab0 Mon Sep 17 00:00:00 2001 From: Micael Karlberg <bmk@erlang.org> Date: Tue, 2 Jan 2024 17:21:46 +0100 Subject: [PATCH 18/46] [megaco] Types and spec for megaco:get_stats/0,1,2 OTP-18920 --- lib/megaco/doc/src/megaco.xml | 97 +++++++++++++++++++++++++++-------- lib/megaco/src/app/megaco.erl | 36 +++++++++++-- 2 files changed, 107 insertions(+), 26 deletions(-) diff --git a/lib/megaco/doc/src/megaco.xml b/lib/megaco/doc/src/megaco.xml index 5c975139e7..223cc2b589 100644 --- a/lib/megaco/doc/src/megaco.xml +++ b/lib/megaco/doc/src/megaco.xml @@ -373,6 +373,39 @@ </desc> </datatype> + <datatype> + <name name="counter"/> + <!-- + <desc> + <p> + TBD + </p> + </desc> + --> + </datatype> + + <datatype> + <name name="global_counter"/> + <!-- + <desc> + <p> + TBD + </p> + </desc> + --> + </datatype> + + <datatype> + <name name="counter_value"/> + <!-- + <desc> + <p> + TBD + </p> + </desc> + --> + </datatype> + </datatypes> <section> @@ -2376,34 +2409,54 @@ megaco_incr_timer() = #megaco_incr_timer{} <marker id="stats"></marker> <marker id="get_stats"></marker> + <marker id="get_stats_0"></marker> </desc> </func> <func> - <name since="">get_stats() -> {ok, TotalStats} | {error, Reason}</name> - <name since="">get_stats(GlobalCounter) -> {ok, CounterStats} | {error, Reason}</name> - <name since="">get_stats(ConnHandle) -> {ok, ConnHandleStats} | {error, Reason}</name> - <name since="">get_stats(ConnHandle, Counter) -> {ok, integer()} | {error, Reason}</name> + <name name="get_stats" arity="0" clause_i="1" since=""/> + <fsummary></fsummary> + <desc> + <p>Retreive all (SNMP) statistic counters maintained by the + megaco application. </p> + <p>The global + counters handle events that cannot be attributed to + a single connection (e.g. protocol errors that occur + before the connection has been properly setup).</p> + <marker id="get_stats_1_1"></marker> + </desc> + </func> + + <func> + <name name="get_stats" arity="1" clause_i="1" since=""/> + <fsummary></fsummary> + <desc> + <p>Retreive a (SNMP) (global) statistic counter maintained by the + megaco application. </p> + <p>The global + counters handle events that cannot be attributed to + a single connection (e.g. protocol errors that occur + before the connection has been properly setup).</p> + <marker id="get_stats_1_2"></marker> + </desc> + </func> + + <func> + <name name="get_stats" arity="1" clause_i="2" since=""/> + <fsummary></fsummary> + <desc> + <p>Retreive all (SNMP) statistic counters maintained by the + megaco application, for a specific connection.</p> + <marker id="get_stats_2"></marker> + </desc> + </func> + + <func> + <name name="get_stats" arity="2" clause_i="1" since=""/> <fsummary></fsummary> - <type> - <v>TotalStats = [total_stats()]</v> - <v>total_stats() = {conn_handle(), [stats()]} | {global_counter(), integer()}</v> - <v>GlobalCounter = global_counter()</v> - <v>GlobalCounterStats = integer()</v> - <v>ConnHandle = conn_handle()</v> - <v>ConnHandleStats = [stats()]</v> - <v>stats() = {counter(), integer()}</v> - <v>Counter = counter()</v> - <v>counter() = medGwyGatewayNumTimerRecovery | medGwyGatewayNumErrors</v> - <v>global_counter() = medGwyGatewayNumErrors</v> - <v>Reason = term()</v> - </type> <desc> - <p>Retreive the (SNMP) statistic counters maintained by the - megaco application. The global - counters handle events that cannot be attributed to - a single connection (e.g. protocol errors that occur - before the connection has been properly setup).</p> + <p>Retreive a (SNMP) statistic counter maintained by the + megaco application.</p> <marker id="reset_stats"></marker> </desc> </func> diff --git a/lib/megaco/src/app/megaco.erl b/lib/megaco/src/app/megaco.erl index 640300adab..bcdaeec164 100644 --- a/lib/megaco/src/app/megaco.erl +++ b/lib/megaco/src/app/megaco.erl @@ -197,6 +197,12 @@ -type trace_data() :: term(). -type trace_handler() :: fun((trace_event(), trace_data()) -> trace_data()). +-type global_counter() :: medGwyGatewayNumErrors. +-type counter() :: medGwyGatewayNumTimerRecovery | + medGwyGatewayNumErrors. +-type counter_value() :: non_neg_integer(). + + -include("megaco_internal.hrl"). @@ -530,14 +536,36 @@ test_reply(ConnHandle, Version, EncodingMod, EncodingConfig, %% Func: get_stats/0, get_stats/1, get_stats/2 %% Description: Retreive statistics (counters) for TCP %%----------------------------------------------------------------- + +-spec get_stats() -> {ok, [TotalStats]} | {error, Reason} when + TotalStats :: {conn_handle(), [Stats]} | + {global_counter(), counter_value()}, + Stats :: {counter(), counter_value()}, + Reason :: term(). + get_stats() -> megaco_messenger:get_stats(). -get_stats(SendHandle) -> - megaco_messenger:get_stats(SendHandle). +-spec get_stats(GCounter) -> {ok, Value} | {error, Reason} when + GCounter :: global_counter(), + Value :: counter_value(), + Reason :: term(); + (ConnHandle) -> {ok, [Stats]} | {error, Reason} when + ConnHandle :: conn_handle(), + Stats :: {counter(), counter_value()}, + Reason :: term(). + +get_stats(ConnHandleOrGCounter) -> + megaco_messenger:get_stats(ConnHandleOrGCounter). + +-spec get_stats(ConnHandle, Counter) -> {ok, Value} | {error, Reason} when + ConnHandle :: conn_handle(), + Counter :: counter(), + Value :: counter_value(), + Reason :: term(). -get_stats(SendHandle, Counter) -> - megaco_messenger:get_stats(SendHandle, Counter). +get_stats(ConnHandle, Counter) -> + megaco_messenger:get_stats(ConnHandle, Counter). %%----------------------------------------------------------------- -- 2.35.3
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor