Commit Graph

284 Commits

Author SHA1 Message Date
ionutboangiu
c42198f3c2 cfg: allow multiple dict dirs per radius client
ported from commit 47e75fab1
2025-07-08 08:18:30 +02:00
arberkatellari
5b66678313 Add offline internal DB functionality for dataDB,storDB & configDB 2025-05-13 17:07:17 +02:00
DanB
3b195dcf1d Adding StateIndexer, ServiceIndexer, StateDeps 2024-11-23 20:14:07 +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
176c91764f SplitPath: stop at '#' for nesting separator 2024-11-03 13:19:45 +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
9b8ac3199b Revise EfSv1.ReplayEvents API + tests
- renamed parameter type: ArgsReplyFailedPosts -> ReplayEventsParams
- renamed param fields:
  - FailedRequestsInDir -> SourcePath
  - FailedRequestsOutDir -> FailedPath
  - TypeProvider -> Provider
- changed param fields types from *string to string
- used the SourcePath and FailedPath params directly instead of creating separate variables
- used filepath.WalkDir instead of reading the directory and looping over the entries
- used slices.ContainsFunc to check if the file belongs to any module (if 1+ is specified)
- used filepath.Join instead of path.Join
- used the path provided by WalkFunc instead of building the file paths ourselves
- made error returns more descriptive
- added logs for directories/files that are skipped
- paths that cannot be accessed are skipped after logging the error
2024-09-25 20:58:51 +02:00
ionutboangiu
5cb7ce2e93 Rename fibNrAsDuration -> fibNr 2024-09-23 20:28:26 +02:00
ionutboangiu
d801352cce slightly optimize TenantID constructor 2024-09-05 20:46:40 +02:00
ionutboangiu
aa5069e16e Remove go type limits constants
They can be retrieved directly from the std math package.
Slightly optimize the Fib functions and improve comments.
2024-09-05 20:46:40 +02:00
ionutboangiu
ede004bc44 remove deprecated rand.Seed calls 2024-09-05 20:46:40 +02:00
ionutboangiu
2f387b5a0e chore: remove unnecessary parentheses
gofmt -r '(a) -> a' -w **/*.go
2024-09-05 20:46:40 +02:00
ionutboangiu
79f824c575 Add support for Git 2.45+ iso-strict date format
Git 2.45+ introduced a backward incompatible change in the iso-strict
date format, showing time in the Zulu timezone with Z suffix instead
of +00:00. This commit adds parsing for the new date format before
falling back to the old format.

Revise GetCGRVersion error messages.
Revise GetCGRVersion unit test.
2024-06-30 17:54:25 +02:00
Bas Couwenberg
915733e04e Pass commit date and hash to -ldflags separately. 2024-02-27 16:27:07 +01:00
ionutboangiu
6b831d3ba3 Make Paginate function generic
Also move the paginator implementation and its tests to their
own files.
2023-11-09 20:50:36 +01:00
gezimbll
32ed816de7 Replacing IsSliceMember ,CloneStringSlice and SliceStringEqual with slices package functions 2023-11-01 21:38:27 +01:00
ionutboangiu
4c34d321de Add sanity check to prevent xml reader panic
HierarchyPath parser now returns nil when
the path is empty (instead of a string slice with one
EmptyString element).

If isAbsolute is set to true, when calling the AsString
method on a nil HierarchyPath, only the separator will
be returned. Alternatively, if isAbsolute is false, it
will just return . to signal that the path currently
being processed is the one required.This avoids a nil
expr error coming from the xmlquery library.

Use the Query and QueryAll functions from the xmlquery
package to be able to handle the errors ourselves and
avoid panics.

Remove config default value for xmlRootPath. The field
will remain commented in config_defaults for reference.

Add tests for HierarchyPath.AsString function.

Add comments for XmlProvider and xmlRootPath opt.

Update XmlProvider String() func based on the comment
which specifies that it should display the already
parsed values out of cache.
2023-10-19 17:19:30 +02:00
arberkatellari
fcaa3fb360 Make RandomInteger() return int64 2023-07-21 09:03:22 +02: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
ionutboangiu
09c6261903 Fix issue where fib function overflows 2022-08-05 14:30:45 +02:00
adi
0eb61c965a Efs tests + improves 2022-07-30 08:19:08 +02:00
adi
da358161a7 EFs service to logger/ees and APIS 2022-07-30 08:19:08 +02:00
adi
bf870b1e2b Failover ees/loggers improved + tests 2022-07-11 17:27:46 +02:00
ionutboangiu
70ea038f08 Update FibDuration function 2022-07-03 13:08:52 +02:00
adi
c22f43c788 Failed posts and failover for export loggers 2022-06-29 12:00:42 +02: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
ionutboangiu
bfccb7c43c Move functions and struct types to the folders they belong to 2022-01-12 20:16:43 +01:00
ionutboangiu
583cd71a42 Remove unused struct types, functions and tests related to paginator 2022-01-10 19:59:10 +01:00
ionutboangiu
9d2cf432f3 Rename ArgsItemIDs Prefix to ItemsPrefix 2022-01-09 14:48:18 +01:00
ionutboangiu
cfcb55790d Change paginator behaviour for GetFilterIDs API 2022-01-06 12:23:46 +01:00
Trial97
876955f9e2 Started redesigning loaders 2021-11-16 13:05:40 +01:00
Trial97
6bff7dfb9b Updated Redis storage 2021-10-08 11:12:50 +03:00
ionutboangiu
7b7d46251a Implement new function that splits filter rules 2021-07-23 10:59:18 +02:00
nickolasdaniel
9fa61de229 Added FirstIntNonEmpty and FirstDurationNonEmpty functions in utils 2021-07-16 17:15:05 +02:00
porosnicuadrian
291a791f37 Memory profile apis + tests 2021-07-03 16:42:03 +02:00
porosnicuadrian
6451d4ab1c Added context in accounts methods for apis 2021-05-17 17:58:44 +02:00
Trial97
aef563ae17 Added more diff functions 2021-04-22 21:00:44 +02:00
Trial97
c04c0a5adb Added ConfigDB and option to read config from DB 2021-04-16 17:53:36 +02:00
Trial97
3406d3c7c9 Updated based on new rpc library 2021-04-13 13:35:03 +02:00
Trial97
b028a99050 Removed rals config 2021-04-01 16:36:51 +02:00
Trial97
b8437f4a7d Updated utils tests 2021-03-26 13:46:25 +01:00
andronache
806c8295be Finished changing Opts to APIOpts for structs used in api_interfaces 2021-03-23 14:35:11 +01:00
andronache
38b02c642c Changed Opts to APIOpts in multiple structs used in apier/ 2021-03-23 14:35:11 +01:00
andronache
b573e12233 Changed Opts to APIOpts in multiple structs used in apier/ 2021-03-23 14:35:11 +01:00
andronache
c61e2046f3 Changed in multiple structs the field Opts to APIOpts 2021-03-18 16:48:54 +01:00
andronache
804cc12c9e Changed in multiple structs the field Opts to APIOpts 2021-03-18 16:48:54 +01:00
andronache
a6f41adaf9 Replaced TenantIDWithOpts with TenantIDWithAPIOpts 2021-03-18 13:04:28 +01:00