fixeria has submitted this change. ( https://gerrit.osmocom.org/c/erlang/osmo-s1gw/+/40831?usp=email )
Change subject: enb_uptime: track eNB uptime
......................................................................
enb_uptime: track eNB uptime
Change-Id: Ie8a06fafa2ce3e7a5aec1eb8e71af3053599cf24
Related: SYS#7594
---
M include/s1gw_metrics.hrl
A src/enb_uptime.erl
M src/s1ap_proxy.erl
3 files changed, 109 insertions(+), 4 deletions(-)
Approvals:
Jenkins Builder: Verified
fixeria: Looks good to me, approved
jolly: Looks good to me, but someone else must approve
osmith: Looks good to me, but someone else must approve
diff --git a/include/s1gw_metrics.hrl b/include/s1gw_metrics.hrl
index db087c5..83ec768 100644
--- a/include/s1gw_metrics.hrl
+++ b/include/s1gw_metrics.hrl
@@ -37,9 +37,10 @@
-define(S1GW_CTR_S1AP_PROXY_OUT_PKT_REPLY_ALL, [ctr, s1ap, proxy, out_pkt, reply, all]).
-define(S1GW_CTR_S1AP_PROXY_OUT_PKT_REPLY_ERAB_SETUP_RSP, [ctr, s1ap, proxy, out_pkt, reply, erab_setup_rsp]).
-%% GTP-U (traffic) related counters
+%% per-eNB counters
%% NOTE: these counters shall not be listed in ?S1GW_COUNTERS,
%% but created dynamically for each connecting eNB.
+-define(S1GW_CTR_ENB_UPTIME(ENBId), [ctr, enb, ENBId, uptime]).
-define(S1GW_CTR_GTPU_PACKETS(ENBId, UDL), [ctr, enb, ENBId, gtpu, packets, UDL]).
-define(S1GW_CTR_GTPU_BYTES_UE(ENBId, UDL), [ctr, enb, ENBId, gtpu, bytes, ue, UDL]).
-define(S1GW_CTR_GTPU_BYTES_TOTAL(ENBId, UDL), [ctr, enb, ENBId, gtpu, bytes, total, UDL]).
diff --git a/src/enb_uptime.erl b/src/enb_uptime.erl
new file mode 100644
index 0000000..4c6f76a
--- /dev/null
+++ b/src/enb_uptime.erl
@@ -0,0 +1,99 @@
+%% Copyright (C) 2025 by sysmocom - s.f.m.c. GmbH <info(a)sysmocom.de>
+%% Author: Vadim Yanitskiy <vyanitskiy(a)sysmocom.de>
+%%
+%% All Rights Reserved
+%%
+%% SPDX-License-Identifier: AGPL-3.0-or-later
+%%
+%% This program is free software; you can redistribute it and/or modify
+%% it under the terms of the GNU Affero General Public License as
+%% published by the Free Software Foundation; either version 3 of the
+%% License, or (at your option) any later version.
+%%
+%% This program is distributed in the hope that it will be useful,
+%% but WITHOUT ANY WARRANTY; without even the implied warranty of
+%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+%% GNU General Public License for more details.
+%%
+%% You should have received a copy of the GNU Affero General Public License
+%% along with this program. If not, see <https://www.gnu.org/licenses/>.
+%%
+%% Additional Permission under GNU AGPL version 3 section 7:
+%%
+%% If you modify this Program, or any covered work, by linking or
+%% combining it with runtime libraries of Erlang/OTP as released by
+%% Ericsson on https://www.erlang.org (or a modified version of these
+%% libraries), containing parts covered by the terms of the Erlang Public
+%% License (https://www.erlang.org/EPLICENSE), the licensors of this
+%% Program grant you additional permission to convey the resulting work
+%% without the need to license the runtime libraries of Erlang/OTP under
+%% the GNU Affero General Public License. Corresponding Source for a
+%% non-source form of such a combination shall include the source code
+%% for the parts of the runtime libraries of Erlang/OTP used as well as
+%% that of the covered work.
+
+-module(enb_uptime).
+
+-export([start_link/0,
+ genb_id_ind/2,
+ shutdown/1]).
+
+-include_lib("kernel/include/logger.hrl").
+
+-include("s1gw_metrics.hrl").
+
+-define(INTERVAL, 5_000).
+
+
+%% ------------------------------------------------------------------
+%% public API
+%% ------------------------------------------------------------------
+
+-spec start_link() -> pid().
+start_link() ->
+ T0 = erlang:monotonic_time(),
+ spawn_link(fun() -> loop(#{time => T0}) end).
+
+
+-spec genb_id_ind(pid(), string()) -> ok.
+genb_id_ind(Pid, GlobalENBId) ->
+ Pid ! {?FUNCTION_NAME, GlobalENBId},
+ ok.
+
+
+-spec shutdown(pid()) -> ok.
+shutdown(Pid) ->
+ Pid ! stop,
+ ok.
+
+
+%% ------------------------------------------------------------------
+%% private API
+%% ------------------------------------------------------------------
+
+loop(#{genb_id := GlobalENBId, time := T0} = S) ->
+ receive
+ stop ->
+ s1gw_metrics:ctr_reset(?S1GW_CTR_ENB_UPTIME(GlobalENBId)),
+ ok;
+ Event ->
+ ?LOG_ERROR("Rx unexpected event: ~p", [Event])
+ after ?INTERVAL ->
+ T1 = erlang:monotonic_time(),
+ Diff = erlang:convert_time_unit(T1 - T0, native, second),
+ s1gw_metrics:ctr_inc(?S1GW_CTR_ENB_UPTIME(GlobalENBId), Diff),
+ ?LOG_INFO("Td ~p second(s)", [Diff]),
+ loop(S#{time => T1})
+ end;
+
+loop(#{} = S) ->
+ receive
+ {genb_id_ind, GlobalENBId} ->
+ catch exometer:new(?S1GW_CTR_ENB_UPTIME(GlobalENBId), counter),
+ loop(S#{genb_id => GlobalENBId});
+ Event ->
+ ?LOG_ERROR("Rx unexpected event: ~p", [Event])
+ end.
+
+
+%% vim:set ts=4 sw=4 et:
diff --git a/src/s1ap_proxy.erl b/src/s1ap_proxy.erl
index 06e5302..8111ad6 100644
--- a/src/s1ap_proxy.erl
+++ b/src/s1ap_proxy.erl
@@ -78,7 +78,8 @@
mme_ue_id :: undefined | mme_ue_id(),
enb_ue_id :: undefined | enb_ue_id(),
erab_id :: undefined | erab_id(),
- path :: [s1ap_ie_id()]
+ path :: [s1ap_ie_id()],
+ enb_uptime :: pid()
}).
-type proxy_state() :: #proxy_state{}.
@@ -127,7 +128,8 @@
init([ConnInfo]) ->
process_flag(trap_exit, true),
- {ok, #proxy_state{conn_info = ConnInfo,
+ {ok, #proxy_state{enb_uptime = enb_uptime:start_link(),
+ conn_info = ConnInfo,
erabs = dict:new(),
path = []}}.
@@ -167,7 +169,8 @@
{noreply, S}.
-terminate(Reason, #proxy_state{}) ->
+terminate(Reason, #proxy_state{} = S) ->
+ enb_uptime:shutdown(S#proxy_state.enb_uptime),
?LOG_NOTICE("Terminating, reason ~p", [Reason]),
ok.
@@ -375,6 +378,8 @@
#'SuccessfulOutcome'{procedureCode = ?'id-S1Setup'}}, S) ->
?LOG_DEBUG("Processing S1 SETUP RESPONSE"),
gtpu_kpi_enb_register(S),
+ enb_uptime:genb_id_ind(S#proxy_state.enb_uptime,
+ S#proxy_state.genb_id_str),
%% there's nothing to patch in this PDU, so we forward it as-is
{forward, S};
--
To view, visit https://gerrit.osmocom.org/c/erlang/osmo-s1gw/+/40831?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: erlang/osmo-s1gw
Gerrit-Branch: master
Gerrit-Change-Id: Ie8a06fafa2ce3e7a5aec1eb8e71af3053599cf24
Gerrit-Change-Number: 40831
Gerrit-PatchSet: 2
Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: jolly <andreas(a)eversberg.eu>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Attention is currently required from: fixeria.
osmith has posted comments on this change by osmith. ( https://gerrit.osmocom.org/c/osmo-ci/+/40861?usp=email )
Change subject: jobs/gerrit: binpkgs: update debian versions
......................................................................
Patch Set 1:
(1 comment)
File jobs/gerrit-verifications.yml:
https://gerrit.osmocom.org/c/osmo-ci/+/40861/comment/0049089e_742f01a9?usp=… :
PS1, Line 107: debian:11 debian:13
> AFAIU, so far we have been building packages for `debian:10` and `debian:12`, but not for `debian:11 […]
Yes, this is intentional. The idea is that we build for the most recent and oldest versions, assuming that then the version in the middle is unlikely to fail if the other two succeed. I think so far this has worked in all cases (and if it occasionally doesn't, it is not a big problem). So this is a trade-off for getting the builds done faster while still testing the most interesting versions.
--
To view, visit https://gerrit.osmocom.org/c/osmo-ci/+/40861?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: osmo-ci
Gerrit-Branch: master
Gerrit-Change-Id: Ifc1d603c9e6e5054ad2f121f53ba3fb7e4d05286
Gerrit-Change-Number: 40861
Gerrit-PatchSet: 1
Gerrit-Owner: osmith <osmith(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Comment-Date: Tue, 12 Aug 2025 06:15:56 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: fixeria <vyanitskiy(a)sysmocom.de>
Attention is currently required from: fixeria, laforge.
matanp has posted comments on this change by matanp. ( https://gerrit.osmocom.org/c/osmo-msc/+/40853?usp=email )
Change subject: transaction: Fix potenial use after free of members
......................................................................
Patch Set 2:
(1 comment)
Commit Message:
https://gerrit.osmocom.org/c/osmo-msc/+/40853/comment/4216be81_02d037ac?usp… :
PS2, Line 9: In the case of multithreading
> We do not employ multithreading in osmo-msc and unlikely ever will, so I don't think it makes sense […]
Shall I remove this commit or wait to @laforge@osmocom.org?
--
To view, visit https://gerrit.osmocom.org/c/osmo-msc/+/40853?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Change-Id: I177959fb298ae04c4e8df877582fc9a1bd4dc2cf
Gerrit-Change-Number: 40853
Gerrit-PatchSet: 2
Gerrit-Owner: matanp <matan1008(a)gmail.com>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Attention: laforge <laforge(a)osmocom.org>
Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Comment-Date: Tue, 12 Aug 2025 04:36:28 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: fixeria <vyanitskiy(a)sysmocom.de>