Commit Graph

13330 Commits

Author SHA1 Message Date
ionutboangiu
b0758d082d Remove redundant http_pprof cgr-engine flag
runtime profiling is now configurable within the http cfg section and
is enabled by default
2024-08-12 18:36:45 +02:00
ionutboangiu
435ba54743 Register prometheus and pprof endpoints using https mux 2024-08-12 18:36:45 +02:00
ionutboangiu
594e8404dc Add http pprof_path cfg option 2024-08-12 18:36:45 +02:00
ionutboangiu
73fc386036 Add stordb pgSSLCertMode option 2024-08-12 18:36:45 +02:00
arberkatellari
9a79b092a5 Add exporter id within the *vars in EEs for templates 2024-08-12 18:34:01 +02:00
ionutboangiu
6079fb23bc Update default config sample 2024-08-09 09:24:04 +02:00
armirveliaj
0d78fb878c Add coverage tests on agents and services 2024-08-09 09:18:46 +02:00
armirveliaj
2f9f07a976 Add new unit tests on ees and ers 2024-08-09 09:18:46 +02:00
arberkatellari
0bab7d5557 Add reader id within the *vars in ERs 2024-08-09 09:14:24 +02:00
ionutboangiu
13ad7f3603 Slightly improve alignment inside config_defaults file 2024-08-09 09:13:10 +02:00
ionutboangiu
ca438d91cb Update postgres driver version 2024-08-09 09:13:10 +02:00
ionutboangiu
d0183597f1 Add postgres stor_db SSL opts 2024-08-09 09:13:10 +02:00
armirveliaj
ea149965ae Add new unit tests on services 2024-08-06 23:05:46 +02:00
armirveliaj
5905b54f7f Add new unit tests on loaders 2024-08-06 23:05:46 +02:00
arberkatellari
7ca9d89fbe Revize session_indexes 2024-08-06 23:04:58 +02:00
ionutboangiu
48b13c919b Complete monitoring ansible playbook
- add dashboard provisioning for grafana
- add README file
2024-08-06 08:48:36 +02:00
ionutboangiu
6c9b5d2908 Add monitoring ansible playbook 2024-08-05 13:28:33 +02:00
ionutboangiu
78e020e2be Implement HTTP endpoint for prometheus
configurable via 'prometheus_url' option in the HTTP section
2024-08-05 13:28:33 +02:00
ionutboangiu
cc25eae687 Add node_exporter ansible role 2024-08-05 13:28:33 +02:00
ionutboangiu
76b7be1adc Add grafana ansible role 2024-08-05 13:28:33 +02:00
ionutboangiu
398aa2a2a6 Add prometheus ansible role 2024-08-05 13:28:33 +02:00
gezimblliku
59b61f2354 added janusagent documentation 2024-08-04 21:12:01 +02:00
gezimblliku
22b96ca1e3 added tests for filter statmetric 2024-08-04 21:10:50 +02:00
armirveliaj
3d9a94c5c5 Add new unit tests 2024-08-04 21:04:41 +02:00
arberkatellari
8ed6d8352f Allow CORS on httpagent 2024-08-02 10:25:03 +02:00
armirveliaj
96e940cab3 Add new unit tests on janusagent 2024-08-02 09:36:54 +02:00
armirveliaj
29524f9be4 Add new unit tests on migrator 2024-08-02 09:36:54 +02:00
armirveliaj
f6f49f47a2 Add new unit tests on engine 2024-08-02 09:36:54 +02:00
armirveliaj
35af82ef18 Add new unit tests on agents 2024-08-02 09:36:54 +02:00
ionutboangiu
63129feb4c prevent memprof file overwrites for small intervals
Previously, the timestamp was accurate only down to seconds. For smaller intervals,
this would truncate the previous file(s). Now, for small intervals, the number of
microseconds is appended to the file name.

Added the possibility to disable timestamps in the memory profile file names and use
increments of 1 instead.

Updated the memory profiling integration tests.
2024-08-02 09:35:36 +02:00
ionutboangiu
218ad92635 Ensure reference fileCPU is not overwritten
Would previously happen if memory profiling was already started.
Now using os.File.Stat beforehand to check if a handler of the file
is already active and confirm the status of profiling. This required
changing the type of the reference fileCPU from io.Closer to *os.File.
Asserting the type would have worked as well.
2024-08-02 09:35:36 +02:00
ionutboangiu
1c490a9020 Revise memory profiling implementation
- merge StopChanMemProf with StopMemoryProfiling
- remove fileMEM and stopMemProf from struct and constructors
- add separate mutex for memory profiling, ensure thread safety
- handle all significant errors
- log error if StopMemoryProfiling fails during CoreS Shutdown
- ignore errors if profiling inactive in Shutdown and deferred Stop
- move validations inside V1 functions
- return error if StartMemoryProfiling already started
- return error if StopMemoryProfiling already stopped or never started
- close profiling loop on error, not the cgr-engine
- StopMemoryProfiling closes channel and profiling loop writes final profile
- rename Path to DirPath for mandatory field error
- rename memprof_nrfiles flag to memprof_maxfiles
- increase default memprof_interval
- consider MaxFiles <= 0 as unlimited
- move memory profiling logic after starting services
- use CoreService Start/StopMemoryProfiling in main
- remove final memory profile block (created by deferred Stop)
- convert MemProfiling to method on CoreService and rename to profileMemory
- use Ticker for recurrent actions instead of Timer
- compute mem_final.prof full path in StartMemoryProfiling
- suffix profile files with current time instead of numbers
- update dispatcher methods after changes
- move MemoryPrf from utils to cores, rename to MemoryProfilingParams
- add logs for starting/stopping profiling
2024-08-02 09:35:36 +02:00
ionutboangiu
9d4561f79c Revise CPU Profiling implementation
cgr-engine.go:
- use filepath.Join instead of path.Join
- handle *CoreService.StopCPUProfiling error inside deferred function
- same with the error from *os.File.Close()

cores/core.go:
- StartCPUProfile now returns an io.Closer (as opposed to an io.WriteCloser)
- handle pprof.StartCPUProfile error and ensure file is closed before returning
- log file close error as a warning if it occurs
- return missing mandatory error with correct path field name ('DirPath')
- no need to check if fileCPU is nil for profiling status
  - pprof.StartCPUProfiling will return an error if profiling is already started
  - os.File.Close() will return ErrClosed if profiling is already stopped
- differentiate between calling StopCPUProfiling when profiling hasn't started
and when it was already stopped by returning appropriate errors

- improved comments and error messages
2024-08-02 09:35:36 +02:00
ionutboangiu
6f4d2144a6 Add test & constant for set_versions flag
Also added set_versions help entry to cgr-engine doc.
2024-08-02 09:35:36 +02:00
ionutboangiu
958aa267cf Refactor HTTP profiling and flag handling
- hardcode the base path for profiling endpoints to '/debug/pprof/'
- change profiling flag 'httprof_path' to boolean 'http_pprof'
  (because of the above)
- remove redundant profiling endpoint registrations (handled by pprof.Index)
- move profiling registration log after actual registration
- make profiling registration log more descriptive
- use utils.Logger instead of log.Print for the log mentioned above
- refactor flags test into a table test (adding also verification for default
  flag values)
- change 'scheduledShutdown' flag type from string to time.Duration (to avoid
  unnecessary time parsing)
- revise flags usage descriptions
- rename flag 'singlecpu' to 'singleCPU'
- switch to 'ExitOnError' for flag parsing to simplify error handling and
  automatically handle 'ErrHelp' by exiting with status 0 when help is
  requested and status 2 for other parsing errors. Before the following error
  log would have been received:
  '<InitS> error received: <flag: help requested>, exiting!'
- update cgr-engine documentation
2024-08-02 09:35:36 +02:00
arberkatellari
9eeee38824 Improve kamailio serivice test 2024-07-22 15:31:02 +02:00
arberkatellari
7fa3249d54 Add Kamailio agent session restoration support 2024-07-22 15:31:02 +02:00
arberkatellari
5ccb77c5dc Add mongo support for sessions backup 2024-07-22 15:31:02 +02:00
gezimblliku
692279ef8b handle errors from exportrequest fields in ees 2024-07-21 19:05:53 +02:00
ionutboangiu
4cba4a699d Implement SharedActionsData for action groups
- holds common relevant data between actions.
- currently supports only *cdrlog, making the process more reliable
and less repetitive. It also provides access to more information about
actions when creating CDRs.
- easier to scale.
- removes the need for cloning accounts before executing a group of
actions.
- added Actions method to check if specific action types exist inside.
2024-07-21 19:04:53 +02:00
arberkatellari
dd5e5b1147 Revise debitCreditBalance 2024-07-14 14:11:16 +02:00
gezimblliku
3034c2882e added tests for disconnecting janus external sessions 2024-07-14 14:09:44 +02:00
gezimblliku
122c1c152c implemented V1DisconnectSession method for janusagent 2024-07-14 14:09:44 +02:00
ionutboangiu
747bfd9967 Remove global CGRConfig used by tests 2024-07-14 14:08:49 +02:00
ionutboangiu
962000656b Remove global err used by tests
Removed many leftover error checks for NewDefaultCGRConfig,
which does not return an error anymore.
2024-07-14 14:08:49 +02:00
armirveliaj
69fda516a6 Add new unit tests on loaders 2024-07-14 14:07:21 +02:00
armirveliaj
54a90fe543 Add new unit test on engine 2024-07-14 14:07:21 +02:00
armirveliaj
b0c64286e8 Add new unit tests on config 2024-07-14 14:07:21 +02:00
armirveliaj
a26c9bb29a Add new unit tests on agents 2024-07-14 14:07:21 +02:00
armirveliaj
05f7981cae Add new unit tests on agents 2024-07-14 14:07:21 +02:00