<!-- Kamailio Pull Request Template -->
<!-- IMPORTANT: - for detailed contributing guidelines, read: https://github.com/kamailio/kamailio/blob/master/.github/CONTRIBUTING.md - pull requests must be done to master branch, unless they are backports of fixes from master branch to a stable branch - backports to stable branches must be done with 'git cherry-pick -x ...' - code is contributed under BSD for core and main components (tm, sl, auth, tls) - code is contributed GPLv2 or a compatible license for the other components - GPL code is contributed with OpenSSL licensing exception -->
#### Pre-Submission Checklist <!-- Go over all points below, and after creating the PR, tick all the checkboxes that apply --> <!-- All points should be verified, otherwise, read the CONTRIBUTING guidelines from above--> <!-- If you're unsure about any of these, don't hesitate to ask on sr-dev mailing list --> - [x] Commit message has the format required by CONTRIBUTING guide - [x] Commits are split per component (core, individual modules, libs, utils, ...) - [x] Each component has a single commit (if not, squash them into one commit) - [x] No commits to README files for modules (changes must be done to docbook files in `doc/` subfolder, the README file is autogenerated)
#### Type Of Change - [ ] Small bug fix (non-breaking change which fixes an issue) - [x] New feature (non-breaking change which adds new functionality) - [ ] Breaking change (fix or feature that would change existing functionality)
#### Checklist: <!-- Go over all points below, and after creating the PR, tick the checkboxes that apply --> - [ ] PR should be backported to stable branches - [x] Tested changes locally - [x] Related to issue #3372
#### Description Implementing the suggesting lcr counters per gateway
You can view, comment on, or merge this pull request online at:
https://github.com/kamailio/kamailio/pull/3391
-- Commit Summary --
* lcr: add counters per gateway
-- File Changes --
M src/modules/lcr/lcr_mod.c (306) M src/modules/lcr/lcr_mod.h (52) M src/modules/lcr/lcr_rpc.c (460)
-- Patch Links --
https://github.com/kamailio/kamailio/pull/3391.patch https://github.com/kamailio/kamailio/pull/3391.diff
@Ozzyboshi pushed 1 commit.
599b41bec813c77bee3ae5bc206fb07c07530d3f lcr: add counters per gateway documentation
The patch seems substantial in size, probably @juha-h, as main author of lcr module, should look over it before merging.
I did some reading of the code and looks like it does not affect current behavior nor have any performance impact if the the stats are off.
But if I understood correctly, in the PR, matching of a SIP request/reply to an lcr gw is done based on IP address/port (`fetch_gw_id` function). On my LCR module web page, I have: ``` LCR Instance 'default' Gateway 'test'
Inbound Properties Common Name or IP Address | Transport
Outbound Properties IP Address or Domain Name | Port | Transport ``` That is, it is possible that LCR module does not have any knowledge of the IP address/port of a gateway.
The only way I can find if a request comes from a gateway specified by Common Name is in the script like this: ``` $var(gw_in_id) = $sht(htable=>cn::$tls_peer_subject_cn::gw_id); ``` That is, looking a common name match from htable.
So unless I didn't read the code correctly, I don't consider it a good idea to have a stats feature that applies only to some gateways.
@Ozzyboshi pushed 1 commit.
c83962357a38abfa005b2ebfe8de08869697aa96 lcr: add counters per gateway documentation
@Ozzyboshi pushed 1 commit.
615abbfde6ae889744e2f969a519f28b11da3737 lcr: add counters per gateway documentation
Yes,counters will be only incremented if ip and port are maching as you said. This is because ip and port is how I usually store in the lcr table and my commit is just based on my needs. Maybe someone in the future can improve my commit to cover all cases. For now I just added a notice on the docs describing this behaviour.
@Ozzyboshi pushed 1 commit.
3280817a4d5fcadfe191a8de3da5ef04b77241af lcr: add counters per gateway documentation
Alessio Garzi writes:
Yes,counters will be only incremented if ip and port are maching as you said. This is because ip and port is how I usually store in the lcr table and my commit is just based on my needs. Maybe someone in the future can improve my commit to cover all cases. For now I just added a notice on the docs describing this behaviour.
As I wrote, I don't consider it a good idea to include a feature that only works in some situations.
Is there some reason why you can't implement the same in the script without modifying lcr module?
Is there some reason why you can't implement the same in the script without modifying lcr module?
sorry I don't understand which script you are referring to but anyway, my inital attempt was to introduce this feature on the kex module, the problem arises when we have lcr reloads, things became to complex to keep in sync, I remember I wrote something about it here. Anyway I am ok if you dont want to include this, I will close the PL.
Closed #3391.