Commit Graph

836 Commits

Author SHA1 Message Date
ionutboangiu
da2052e7b3 Implement FilterService
And use ServiceIndexer to sync with it
2024-12-12 11:55:14 +01:00
ionutboangiu
db301f7901 Remove StorDB service param from service constructors
Use ServiceIndexer instead.
Remove CDRs ListenAndServe method.
Pass the storDB connection directly to constructors instead of the
channel.
2024-12-12 11:55:14 +01:00
ionutboangiu
10dfcc5e48 Remove dmS parameter from service constructors
Use ServiceIndexer instead
2024-12-12 11:55:14 +01:00
ionutboangiu
55ecdf45e4 Remove clsChan in favor of using the service indexer 2024-12-12 11:55:14 +01:00
ionutboangiu
98b5b74b23 Remove cacheS parameter from service constructors
ServiceIndexer will be used instead
2024-12-12 11:55:14 +01:00
ionutboangiu
77af4f95b3 Remove anzCh in favor of using the service indexer 2024-12-10 18:53:13 +01:00
ionutboangiu
0783984bfe Remove srvDep from services that don't use it 2024-12-05 20:12:08 +01:00
ionutboangiu
34de7e2c4e Remove unused dependency waitgroups
to declutter cgr-engine.go a bit. Entire map will be removed in the future
2024-12-04 19:28:50 +01:00
ionutboangiu
79e461e7c5 Remove redundant internal channels
only from services that have dedicated files
2024-12-04 19:28:50 +01:00
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
DanB
2dfa1e7035 Adding initial stopChan to the engine 2024-12-01 20:22:47 +01:00
DanB
6b241ee35b Adding serviceIndexer and StateDependencies 2024-11-28 14:56:03 +01:00
DanB
23e5f0e387 Add generic way to insert services inside services/CGREngine 2024-11-26 14:03:57 +01:00
DanB
76398441da Simplify running of the engine via only one Run command 2024-11-26 12:50:08 +01:00
ionutboangiu
e78722ae4e Init cM,caps,cls,wg inside CGREngine constructor
Also pass the profile to the CGREngine struct the moment profiling started.
2024-11-14 17:48:09 +01:00
ionutboangiu
bb9bfbb19b Rename CommonListenerS constructor
NewServer -> NewCommonListenerS
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
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
DanB
8d37467b63 Reorganising dispatcherS routeID functionality to avoid extra processing of event 2022-08-27 15:53:48 +02:00
adi
424b5bde54 Improved service for efs 2022-08-23 20:31:53 +03: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
7749fcd15b Removed ArgV1ProcessEvent and ThresholdsArgsProcessEvent 2021-09-23 10:42:56 +02:00
Trial97
6a3f8ddc57 Updated config 2021-09-20 10:45:14 +02:00
Trial97
afeedae898 Updated cgr-engine new function 2021-09-15 10:06:13 +02:00
Trial97
968ba9c694 Updated cgr-engine 2021-09-15 10:06:13 +02:00
Trial97
0ed0b0e7a6 Updated more 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
Trial97
d2915a5737 Updated the EEs with the new interface 2021-08-18 16:34:44 +02:00
porosnicuadrian
690504f14a Enabled sessions APIs 2021-08-03 14:56:57 +03:00
Trial97
7a2d234108 Updated caps for birpc server 2021-07-15 18:41:08 +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
655cd2a70a Enabled Chargers service 2021-06-29 10:20:56 +02:00
porosnicuadrian
a224091ea2 Tested CPUProfile apis 2021-06-29 10:20:56 +02:00
porosnicuadrian
4b03790af2 Added CPUProfile apis 2021-06-29 10:20:56 +02:00
Trial97
e5a1e7553a Added some 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
183bddb416 Added back chargers apis + context 2021-06-11 12:34:51 +02:00
andronache
44525fc3e1 Integration tests for storecfgindb in apis 2021-06-09 20:15:57 +02:00
porosnicuadrian
85ad80f8e8 Tested cgr-engine flags 2021-06-08 12:13:31 +02:00
Trial97
cc17e94903 Updated config reload API 2021-05-28 12:44:30 +03:00
porosnicuadrian
9b29d775e8 Updated tutconfigs + fixed FieldAsInterface cases on dynamicDp 2021-05-26 20:05:26 +02:00
porosnicuadrian
788919bdaa Added context for routes methods 2021-05-26 20:05:26 +02:00
Trial97
f3639c01f8 Added connection between thresholds and actions 2021-05-26 15:54:36 +02:00
Trial97
67437dcd6d Added back version flag 2021-05-26 15:54:36 +02:00