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.
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.
- 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
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
- 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
- holds common relevant data between actions.
- currently supports only *cdrlog, making the process more reliable
and less repetitive. It also provides access to more information about
actions when creating CDRs.
- easier to scale.
- removes the need for cloning accounts before executing a group of
actions.
- added Actions method to check if specific action types exist inside.
By default setting rerate to true also sets refund to true, but
flags should take precedence over defaults.
If rerate is true and refund is false, remove any previous
CostDetails from event to force rerate.
Centralize the configuration of processing args.
Additional changes:
- removed unnecessary locking when initializing the exporter
cache map, as the service itself is responsible for locking.
- separated setupCache method into ClearExporterCache and
SetupExporterCache methods.
- removed idle ListenAndServe function that was only waiting for the
stopChan to close. The reload case was unreachable due to the reload
channel being created in Start instead of being passed down.
- removed Shutdown method on EventExporterS and replaced it with the
exported ClearExporterCache method as it provided the same
functionality.
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.
Ignore errors for old git versions where %cI is not defined.
Revise GetCGRVersion error messages.
Revise GetCGRVersion unit test.
Changed initial *topup action to *topup_reset and increase its weight
to ensure it runs first.
Changed ExpiryTime (inside the *topup_reset action definition) from
*unlimited to +150ms.
Added an extra action trigger to the account to execute ACT_TOPUP_INITIAL
when the balance expires.
Added the following test cases:
- Execute triggers before balance expiry and verify nothing happens.
- Wait for the balance to expire (helper now returns balance expiry
time).
- Execute triggers again and verify if ACT_TOPUP_INITIAL was executed.
Updated connections from *localhost to *internal.