Commit Graph

1560 Commits

Author SHA1 Message Date
ionutboangiu
f0b65f0797 cfg: make sessions jsoncfg object fields camelcase 2025-12-05 13:15:52 +01:00
ionutboangiu
8443af3a89 Relicense from GPLv3 to AGPLv3 2025-10-29 19:42:40 +01:00
arberkatellari
746846eaaf Revise tests 2025-06-24 17:57:09 +02:00
arberkatellari
9b08994b5e Allow cache to be created for operational data on internal dataDB 2025-06-24 17:57:09 +02:00
ionutboangiu
676900b4c3 update DB casing for InitDB helpers 2025-05-29 15:41:53 +02:00
ionutboangiu
43cdd396ba add implementation for new ips module 2025-05-29 15:40:20 +02:00
gezimbll
ccdf3ef1f1 added passing events from thresholds to ees 2025-05-26 14:43:43 +02:00
arberkatellari
f6c300c395 Add action type *dynamic_attribute and revise clone functions 2025-05-18 16:12:20 +02:00
ionutboangiu
122afad733 remove previous prometheus integration 2025-03-30 14:01:06 +02:00
ionutboangiu
934d93ef58 add PrometheusAgent implementation 2025-03-30 14:01:06 +02:00
arberkatellari
321910d181 Add WHERE statement availability and non-delete option to ERS SQL reader 2024-12-03 18:36:22 +01:00
ionutboangiu
204601a70f Consider DNS requests when limiting caps 2024-12-01 20:28:56 +01:00
ionutboangiu
3a6d759bac Consider radius requests when limiting caps 2024-11-14 17:56:42 +01:00
gezimbll
b8616282ee added integration tests for ranking scheduling 2024-10-30 22:14:03 +01:00
ionutboangiu
7df0494913 Consider diameter requests when limiting caps
- add possibility to pass custom Error-Message AVP to negative diameter
  answers
- negative answer is now built only when an error occurs
- remove tests that were testing behaviour with max concurrent requests 0
2024-10-29 18:53:22 +01:00
gezimbll
b134df83b7 added it tests and new APIs for TrendS 2024-10-01 20:05:29 +02:00
ionutboangiu
6e971e954c chore: remove unused call & redundant ping methods
- Ping methods defined by engine.NewService for all services
- Call methods were previously replaced by the centralized call method
(on *birpc.Service) for all components
- All services now register V1/V2 objects from apier package for
consistency
2024-09-06 17:37:05 +02:00
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
78e020e2be Implement HTTP endpoint for prometheus
configurable via 'prometheus_url' option in the HTTP section
2024-08-05 13:28:33 +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
gezimbll
85bd7a50e7 updated sags service name to ranking 2024-07-14 13:39:20 +02:00
gezimbll
4d4392d196 revised comments && renamed sars to trends 2024-07-14 13:39:20 +02:00
ionutboangiu
435e4f59b5 Add set_versions flag to cgr-engine
If set to true, it sets/overwrites all versions to the
current ones.
2024-07-14 13:27:09 +02:00
ionutboangiu
eb3bd5cc1d Add redisPoolPipelineLimit configuration field for datadb
Sets the maximum number of commands that can be pipelined before flushing.
0 means no limit and pipelines will only be limited by the time window.
2024-07-05 11:21:16 +02:00
ionutboangiu
ed3fa0d294 Add redisPoolPipelineWindow configuration field for datadb
Sets the duration after which internal pipelines are flushed.
0 disabled implicit pipelining.
2024-07-02 19:58:03 +02:00
arberkatellari
23ae4632fe Add print_config flags to cgr-loader and cgr-migrator 2024-07-01 14:33:24 +02:00
ionutboangiu
c3524735aa Ensure config path stands out when using print_config flag
Done by using the %q fmt verb instead of %s, which wraps the path
within quotes.
2024-06-17 20:15:29 +02:00
gezimbll
1c1d211c7c added config,service for sags 2024-06-12 14:53:30 +02:00
ionutboangiu
d31b4d0984 Add engine flag to print the config object in JSON format
Removed the redundant check_config engine flag. Config sanity was
checked by the NewCGRConfigFromPath function.
2024-06-11 18:34:02 +02:00
gezimbll
8103cd4c9f renamed sarS api&&register the sarS service to servmanager 2024-06-11 10:21:51 +02:00
ionutboangiu
d8946e73ee Make small revisions to a few integration tests
-update cached filter indexes count
-add the flaky constraint to a couple more tests
-fix unstable cores integration test
-fix unstable filterindexes integration test
2024-04-09 20:24:01 +02:00
DanB
8db91ca479 Basic service infrastructure for JanusAgent 2024-04-08 20:09:06 +02:00
ionutboangiu
3062113a61 Make go vet pass
The rpcclient constructor could not see the centralized
Encoding flag because it didn't have the necessary build
constraints. Added the constraints in lib_test.go files
where it wasn't alone. In all the other cases, it was
moved to the first file where it was needed.
2024-04-08 13:14:02 +02:00
ionutboangiu
16eb745f00 Centralize test flags in utils for shared use across tests 2024-04-08 13:14:02 +02:00
ionutboangiu
e0ae593949 Set up internal connection to ERs 2024-04-04 12:31:18 +03:00
ionutboangiu
b9a39e233f Implement ErSv1.ProcessDir api
cores.Server, analyzer object and internal conn channel specific to ERs
are now part of the ERService struct and are passed to its constructor.
2024-04-04 12:31:18 +03:00
ionutboangiu
bd4aa99458 Refactor balance's Factor field name with its plural form
Stored balances previous to this commit, that had a non-nil Factors map, will
now have Factors nil due to field name mismatch.
2024-04-01 19:58:04 +03:00
gezimbll
699989a336 removing cncReqs global variables 2024-03-30 16:36:30 +02:00
ionutboangiu
ee98dbe0ca Update AgentV1DisconnectSession api signature
Will accept utils.CGREvent instead of utils.AttrDisconnectSession as a
parameter.

SessionSv1.ForceDisconnect will take utils.SessionFilterWithEvent as a
parameter instead of *utils.SessionFilter.

Added possibility to pass DisconnectCause as an Event parameter.

The forceSTerminate that's called when the session timer expires will
have DisconnectCause 'SESSION_TIMEOUT' instead of 'FORCED_DISCONNECT'.

Added Dispatcher methods for AlterSessions.

Event will be merged with EventStart of the session before being sent to
AgentV1DisconnectSession.
2024-03-07 17:20:23 +01:00
ionutboangiu
0aea8ac641 Revert "Move CGREvent from utils to engine"
This reverts commit 02195c47ed.
2024-03-04 09:49:15 +01:00
ionutboangiu
02195c47ed Move CGREvent from utils to engine 2024-02-27 17:16:57 +01:00
ionutboangiu
1f7e0b33a2 Update *alter_sessions action
Will now support two extra parameters: address and codec. For *internal
connections, the birpc.Service object will be retrieved from rpcParamsMap
from utils. Supported codecs: <*gob|*json|*http_jsonrpc> (ingored for
*internal address).

Action does not bother with setting defaults anymore, lets the API
handle them.

Improve action comments.

Add unit tests for the action. UnregisterRpcParams' implementation was
required.

Updated *alter_sessions action tariffplan for radius coa integration test
to include address and codec.

Some birpc clients that are set up in integration tests were still registering
a SessionSv1 object. Updated them to register an AgentV1 object instead.
2024-02-27 16:28:48 +01:00
arberkatellari
b88045872f Optimise caching_delay 2024-01-09 09:42:48 -05:00