Commit Graph

28 Commits

Author SHA1 Message Date
ionutboangiu
c29f1fdd35 Remove services/cgr-engine.go
Trying to move services init before CGREngine constructor makes it pointless,
as it's only used as a dependency storage for services init.
2024-12-04 09:06:59 +01:00
ionutboangiu
59f8b1379e Use channel instead of wait func (CLS) 2024-11-14 17:48:09 +01:00
ionutboangiu
21409fc92e Add new CommonListenerService 2024-11-14 17:48:09 +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
4b427aeaf6 Revise flag names/usage descriptions 2024-11-01 15:59:39 +01:00
ionutboangiu
78ae609f1d Simplify flag parsing by switching to ExitOnError
Will automatically handle 'ErrHelp' by exiting with status 0 when help is
requested and status 2 for other parsing errors.
2024-11-01 15:59:39 +01:00
ionutboangiu
792bbb3aff Add set_versions flag to cgr-engine
If set to true, it sets/overwrites all versions to the
current ones.
2024-11-01 15:59:39 +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
113e2a2bdf Replace interface{} with any 2023-05-31 10:22:28 +02:00
ionutboangiu
60a4da69e0 Implement start/stop/status methods for servmanager + tests 2022-10-21 10:16:23 +02:00
adi
63c0841b11 Implelemnted kafka logger 2022-06-29 12:00:42 +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
Trial97
11feb738fc Updated generating script 2021-12-20 16:17:24 +01:00
Trial97
904a6817e4 Updated internal connections 2021-11-17 18:36:40 +01:00
Trial97
a4ebbfe67b Updated services 2021-11-17 18:36:40 +01:00
Trial97
96e50f3962 Added config infrastructure for the new loaders 2021-11-16 13:05:40 +01:00
Trial97
cb809f976e Updated internal datadb 2021-10-28 18:03:43 +03:00
Trial97
6a3f8ddc57 Updated config 2021-09-20 10:45:14 +02:00
andronache
f25198eb21 Fixed rates not turning on 2021-09-19 12:15:42 +02:00
Trial97
968ba9c694 Updated cgr-engine 2021-09-15 10:06:13 +02:00
Trial97
d12cf14dbe Added example for cgrmanager 2021-09-13 16:08:39 +02:00
Trial97
0ed0b0e7a6 Updated more services 2021-09-13 16:08:39 +02:00
Trial97
87ce843810 Updated services 2021-09-13 16:08:39 +02:00
Trial97
766f5e303a Updated cgr-engine service 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