Commit Graph

5539 Commits

Author SHA1 Message Date
ionutboangiu
c762de5c28 move rankings to dedicated package 2025-03-10 13:49:34 +01:00
ionutboangiu
47fb25b4ef move trends to dedicated package
reivse/add comments and order of funcs/definitions
2025-03-10 13:49:34 +01:00
ionutboangiu
24d886c8e0 Pass CGRConfig to DataManager
instead of just CacheCfg. Prevents the need of global config var in
engine/datamanager.go
2025-03-10 13:49:34 +01:00
ionutboangiu
2c8c9b326e remove previous prometheus integration 2025-03-09 17:27:31 +01:00
gezimbll
8fd871b304 added log level field on stordb opts for controlling sql verbosity 2025-02-25 19:42:11 +01:00
ionutboangiu
deaf5f4918 Move config/objdp.go to utils package
and rename the file to objectdp.go
2025-02-24 13:36:32 +01:00
ionutboangiu
3254e0d35f Export RSRParser Path field
configsanity and its tests need access to it
2025-02-24 13:36:32 +01:00
ionutboangiu
b1a5874215 Move config/rsrparser.go to utils package 2025-02-24 13:36:32 +01:00
ionutboangiu
36a7d174ab Remove RSRSep opt from general section
- allows RSRParser to be split gracefully from config (was depending on
  RSRSep, which was retrieved from the global config variable)
- default separator (;) was the only one used except for splitting
  inline attribute values (where ANDSep is used)
2025-02-24 13:36:32 +01:00
ionutboangiu
c60712f454 Bump go version to 1.24.0 2025-02-21 13:22:04 +01:00
armirveliaj
4b1e6e7def Add coverage tests on engine 2025-02-20 12:05:39 +01:00
armirveliaj
ad0b45b4d2 Add coverage tests on accounts && engine 2025-02-20 12:05:39 +01:00
gezimbll
18b0e4d417 added new dynopts function GetDurationPointerOpts 2025-02-20 09:54:13 +01:00
gezimbll
14515404bb added helper method for repetive logic on GetOpts funcs 2025-02-13 19:18:40 +01:00
ionutboangiu
f89cad421e Revise service toggle test 2025-02-07 13:23:59 +01:00
gezimbll
df3dcfb840 replaced CGREvent parameter to DataProvider for GetOpts functions 2025-02-07 13:18:43 +01:00
gezimbll
06ccafb5fd added tests for opts with dynamic values 2025-01-22 17:36:26 +01:00
gezimbll
c602dbc2a5 added rsparser field in dynamicOpts
changed Value field to unexported and created a Value() method
on each dynOpts type that contains logic to create a rsparser
in case the value field a configuration starts with prefix "~"
otherwise it will return the specified value
2025-01-22 17:36:26 +01:00
armirveliaj
7db65ca62c Clean up DispatcherS 2025-01-17 17:29:46 +01:00
ionutboangiu
04f746c634 Implement LoggerService + refactoring (incomplete) 2025-01-14 19:00:37 +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
gezimbll
2b04066504 added parsing the event for *usage opts in accounts 2025-01-10 12:31:44 +01:00
ionutboangiu
70f230788b Make test client constructor error clearer 2025-01-08 20:32:55 +01:00
ionutboangiu
2339bff30d Fix compilation errors in unit tests
due to DynamicStringSliceOpt.Value being renamed to Values
2025-01-08 20:32:55 +01:00
DanB
39952a3388 SessionS Authorize and ProcessCDR methods tested 2024-12-30 19:55:42 +01:00
armirveliaj
8921bf8b99 Revise && add new unit tests 2024-12-20 18:01:15 +01:00
DanB
3c57a8ddca Properly name Values instead of Value within DynamicStringSliceOpt 2024-12-19 16:01:31 +01:00
gezimbll
f30c8681b1 added unit tests in engine 2024-12-17 18:20:29 +01:00
gezimbll
36420e2b84 revised sortingStatIDs method for each rankingSorter 2024-12-16 20:36:25 +01:00
gezimbll
cd3159d8ea revised trend compress method and added store_interval tests for trends&rankings 2024-12-13 15:31:43 +01:00
DanB
476f5ba877 Services with IntRPCConn method 2024-11-30 19:13:19 +01:00
gezimbll
1c6c733a3f added dispatcher methods for rankings and trends 2024-11-22 20:29:27 +01:00
gezimbll
bb0116c543 added it test && loaders templates for ranking and trend profiles 2024-11-22 20:29:27 +01:00
armirveliaj
795d83325c Add coverage tests on engine 2024-11-14 17:48:40 +01:00
ionutboangiu
4c8cf69f70 Auto-configure loader in test suite if needed 2024-11-07 15:38:37 +01:00
ionutboangiu
709d70a031 Add DBCfg var for postgres 2024-11-04 21:22:58 +01:00
ionutboangiu
113f1ccf31 Implement cgr-loader test helper 2024-11-04 21:22:58 +01:00
ionutboangiu
c498af5211 Allow benchmarks to use the testing suite 2024-11-04 21:22:58 +01:00
gezimbll
132a2b3bf9 rankings,trends: added implementation,services and tests 2024-11-04 19:03:21 +01:00
ionutboangiu
d42a1e0177 Fix annoying staticcheck unused param warnings 2024-11-03 13:19:45 +01:00
ionutboangiu
bd79a0f9e7 Optimize removeFilterIndexesForFilter func (#4357)
Previously made two trips (get and set) for each group of items from
an index key being removed. Now, we fetch indexes once at the beginning
and store the updated indexes once at the end.
2024-11-03 13:19:45 +01:00
ionutboangiu
0dfe689d8e Add postgres stor_db SSL opts 2024-11-03 13:19:45 +01:00
ionutboangiu
a251547408 Use correct consts for stordb types 2024-11-01 15:59:39 +01:00
ionutboangiu
0b48672df0 Improve readability of CheckVersions func
also removed extra spaces from 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
ionutboangiu
e0c05ecfa7 Add redis pipeline window and limit cfg opts
Set redisPoolPipelineWindow to control duration before pipeline
flush (0 disables implicit pipelining) and redisPoolPipelineLimit
for max commands per pipeline (0 means no limit, only time window
applies).
2024-10-29 18:54:51 +01:00
ionutboangiu
099f6023ee Improve engine setup helpers
- added hook support (executed after parsing config but before starting
  engine)
- renamed TestEnvironment.Setup -> TestEngine.Run as it represents the
  setup for a single cgr-engine instance
- replaced t.Log with t.Error for engine process kill error
- improved option comments

- added support for dynamic configuration for dbs
- ConfigJSON field can now be used to partially overwrite an existing
configuration
- extra cgr-engine flags can now be passed to the Run method
- added default db configs for mongo/internal
- implemented helper to load using cgr-loader
2024-10-23 21:11:25 +02:00
ionutboangiu
3e98e37db3 Revise NewRPCClient helper function 2024-10-23 21:11:25 +02:00