82 Commits

Author SHA1 Message Date
ionutboangiu
e05be683ae change license from GPLv3 to AGPLv3 2025-10-13 09:57:41 +02:00
ionutboangiu
109ed8fe34 prometheus: replace string literals with constants 2025-05-03 21:44:51 +02:00
ionutboangiu
c2fb0df6c6 normalize metric types for mixed connection types 2025-05-03 21:44:51 +02:00
ionutboangiu
d8c75dd2c3 cores: add GOMAXPROCS, GC percent and memlimit metrics
- gathered when Debug=true
- removed Lookups (always 0)
2025-03-25 14:27:52 +01:00
ionutboangiu
089dfc00ae Use SyncedChan to handle shutdown 2025-01-14 19:00:37 +01:00
ionutboangiu
17405af987 Revise service manager logs
Logging is now done as ServiceManager level. Removed any other logs.
2025-01-10 20:18:08 +01:00
ionutboangiu
c8a3ebe5e8 Use channel instead of context to handle shutdown 2025-01-10 20:18:08 +01:00
ionutboangiu
5bf8f1756c Extract cores.Server into new commonlisteners package
Functionality is the same.
Server has been renamed to CommonListenerS.
2024-11-04 21:23:15 +01:00
ionutboangiu
c895681980 Improve CoreSv1.Status API with more detailed metrics
- add new metrics (off by default)
- add Debug boolean option for full metric details
- add Timezone option for 'running_since' field
- update default metrics shown and their constants
- remove utils.GetStartTime(), now use process metrics
2024-11-03 13:19:45 +01:00
ionutboangiu
ce856c7815 Add http pprof_path cfg option
Remove redundant http_pprof cgr-engine flag since runtime profiling is now
configurable within the http cfg section and is enabled by default
2024-11-01 15:59:39 +01:00
ionutboangiu
c7dbcaea03 Revise CPU/Memory profiling
CPU profiling changes:

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 *os.File (as opposed to an io.WriteCloser),
  because os.File.Stat is used beforehand to check if a handler of the file is
  already active and confirm the status of profiling.  Asserting the type would
  have worked as well.
- 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

Memory profiling changes:

- 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
- added the possibility to disable timestamps in the memory profile file names
  and use increments of 1 instead.

Other changes:

- improved integration tests for flags (now table tests)
- improved profiling integration tests
2024-11-01 15:59:39 +01:00
ionutboangiu
1b24a504dc add flaky build constraint to unstable tests 2024-08-21 20:59:10 +02:00
arberkatellari
bd571376a7 Update kamevapi version 2024-03-08 16:38:50 +01:00
arberkatellari
727f90fc6b Add CAPs counting to cgr-console status command 2024-03-04 19:17:53 +01:00
Bas Couwenberg
915733e04e Pass commit date and hash to -ldflags separately. 2024-02-27 16:27:07 +01:00
ionutboangiu
113e2a2bdf Replace interface{} with any 2023-05-31 10:22:28 +02:00
ionutboangiu
0653e9b5d7 Apply go fmt 2022-08-24 09:32:23 +03:00
adi
d98594d1ad Updated memory profiling code 2022-08-23 20:31:53 +03:00
adi
204db7cb3e Space in logger 2022-08-23 20:31:53 +03:00
porosnicuadrian
51e4159be0 Updated Panic API on cores 2022-04-26 08:33:23 +02:00
andronache98
ecdf5e54ea Changed headers 2022-03-09 14:14:30 +01:00
andronache98
9ec56f5155 Changed headers 2022-03-09 14:14:30 +01:00
porosnicuadrian
04f77ad5e4 Updates on prometheus code 2022-01-06 08:20:21 +01:00
porosnicuadrian
2be78a74c1 Added exporting to prometheus to stats 2022-01-03 12:25:42 +01:00
Trial97
904a6817e4 Updated internal connections 2021-11-17 18:36:40 +01:00
Trial97
cb809f976e Updated internal datadb 2021-10-28 18:03:43 +03:00
ionutboangiu
06961f22f6 Add opts struct for CDRS subsystem 2021-10-04 13:37:36 +02:00
Trial97
6a3f8ddc57 Updated config 2021-09-20 10:45:14 +02:00
Trial97
0ed0b0e7a6 Updated more services 2021-09-13 16:08:39 +02:00
Trial97
cea082eb7f Updated CGREngine structure 2021-09-13 16:08:39 +02:00
Trial97
5098d3e65f Started adding the structure for cgr-engine 2021-09-13 16:08:39 +02:00
Trial97
f96dfab0ab Updated sessions opts constants 2021-08-26 16:48:48 +02:00
Trial97
9aa153c0b0 Finished implementing all the exporters 2021-08-18 16:34:44 +02:00
ionutboangiu
218e8f42ec Fix typo stoped > stopped 2021-07-31 15:32:15 +02:00
Trial97
9076390f15 Removed unused code 2021-07-23 10:58:30 +02:00
Trial97
8585cd940a Added tests for analyzers over birpc 2021-07-15 18:41:08 +02:00
Trial97
0bdbe2df4d Updated caps birpc server 2021-07-15 18:41:08 +02:00
Trial97
7a2d234108 Updated caps for birpc server 2021-07-15 18:41:08 +02:00
porosnicuadrian
89c6fc81c9 LIttle fix for MemProf final file 2021-07-08 09:56:26 +02:00
porosnicuadrian
2aeacca908 Finished adding final_memprof file in stop api 2021-07-08 09:56:26 +02:00
porosnicuadrian
fe1f6c37da Fixes in cores/services and cgr-engine by adding memoryPorfiling 2021-07-03 16:42:03 +02:00
porosnicuadrian
4b03790af2 Added CPUProfile apis 2021-06-29 10:20:56 +02:00
Trial97
34e093f98e Added all dispatcherS APIs 2021-06-17 15:41:41 +02:00
nickolasdaniel
8748ad29c8 Implemented Shutdown API and renamed cmd/cgr- test files 2021-06-14 15:54:58 +02:00
porosnicuadrian
faaf19d806 Updated tests for path sanitizations 2021-06-01 20:36:06 +03:00
Trial97
099ae99836 Added some diff functions 2021-04-21 16:38:30 +02:00
andronache
7ec0be2c2c Removed faulty test 2021-04-13 13:35:34 +02:00
Trial97
cfbe6e709d Added AdminSv1 service 2021-04-13 13:35:03 +02:00
Trial97
3406d3c7c9 Updated based on new rpc library 2021-04-13 13:35:03 +02:00
DanB
c560d81a5d Corrected fields in EventCharges 2021-04-06 18:17:10 +02:00