Commit Graph

2884 Commits

Author SHA1 Message Date
armirveliaj
5b039c1d0b Add new trends config option: scheduled_ids 2024-10-01 20:04:54 +02: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
gezimblliku
d20f1a50fd added ees_conns on stats 2024-09-24 10:41:18 +02:00
ionutboangiu
65e8128303 Implement ErSv1.RunReader api 2024-09-23 20:28:26 +02:00
ionutboangiu
d27e7aae20 Improve nats integration test
- made use of the test setup helpers.
- used t.Cleanup instead of defer.
- instead of waiting 50ms for the nats-server to start, used a helper
hook to attempt connections in fibonacci intervals. On success it
keeps a reference to the connection for later usage.
- handle error for stream delete function executed during cleanup.
- shorten time.Sleep durations when waiting for exports to finish.
- extract the cache itemID checking logic into a separate func
- retry failed requests in fibonacci intervals for up to 500ms
2024-09-23 20:28:26 +02:00
ionutboangiu
5cb7ce2e93 Rename fibNrAsDuration -> fibNr 2024-09-23 20:28:26 +02:00
ionutboangiu
e1adb674b8 Remove redundant dir parameter from processFile methods
Applies to both file readers and loader (for loader, the blank statement
was used anyway).

It's redundant because for file readers, the rdr.sourceDir value was
always passed as the parameter when it was already part of the method's
object.

Parameter had to also be removed from the WatchDir function and the
functions it depends on.
2024-09-23 20:28:26 +02:00
ionutboangiu
449bc5c08a Add active_session_delimiter option for fs_agent
Used for 'show_channels' requests and responses.
2024-09-23 20:28:26 +02:00
gezimblliku
0f81b78321 updated trend profile && trends service implementation 2024-09-23 11:48:04 +02:00
ionutboangiu
d801352cce slightly optimize TenantID constructor 2024-09-05 20:46:40 +02:00
ionutboangiu
0063ef3822 Add support for mongodb+srv conn format
Option can be found in db opts under the name 'mongoConnScheme'.
2024-09-05 20:46:40 +02:00
ionutboangiu
1c73e42307 Revise ERs event exporting
Make use of the previously added ees_success_ids and ees_failed_ids
configuration fields.

Remove Processed opts and everything related to them since they should
not be used anymore.

Fixed test compilation errors caused by the change.
2024-09-05 20:46:40 +02:00
ionutboangiu
795fc18195 Add ees_conns field option for ERs section
Add ees_success_ids and ees_failed_ids fields in reader config. The
former will be used to set EeIDs when the event processing returns
no error, while the latter will be used otherwise (implementation
will follow).

Add config sanity checks for the added options.
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
e863c63db2 fix failing binc unmarshal test
now returns unexpected EOF instead of just EOF following
ugorji/go/codec library update (1.2.11->1.2.12)
2024-09-05 20:46:40 +02:00
ionutboangiu
c2ded003fa Implement additional retrieval methods for ordered map
Map() is used to return a shallow copy of the underlying map.
GetByIndex() is used to return the key-value pair at the specified index.
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
fee2712a23 chore: replace interface{} with any 2024-09-05 20:46:40 +02:00
ionutboangiu
8426892ac6 revise integration tests script 2024-08-21 20:59:10 +02:00
ionutboangiu
23cddba662 fix unstable msgpack unit test 2024-08-21 20:59:10 +02:00
ionutboangiu
1b24a504dc add flaky build constraint to unstable tests 2024-08-21 20:59:10 +02:00
ionutboangiu
0f70af84e9 centralize test flags for shared use across tests 2024-08-15 18:17:33 +02:00
arberkatellari
c7221f0d1e Add reader id within the *vars in ERs 2024-08-12 18:34:50 +02:00
gezimblliku
73a7590f1c added profiles,configs and services for trend && ranking 2024-08-02 09:37:52 +02:00
Gezim Blliku
80249e1074 implemented janusagent & added to services 2024-07-21 19:07:43 +02:00
armirveliaj
6dc612a32a Add print_config flags to cgr-loader and cgr-migrator 2024-07-03 10:39:59 +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
arberkatellari
de5db4a938 Add caching_delay to config and loaders 2024-03-06 16:16:08 +01:00
arberkatellari
727f90fc6b Add CAPs counting to cgr-console status command 2024-03-04 19:17:53 +01:00
Bas Couwenberg
915733e04e Pass commit date and hash to -ldflags separately. 2024-02-27 16:27:07 +01:00
gezimbll
368c046805 added *http filter type 2024-02-09 15:59:00 +01:00
ionutboangiu
75cf4a75cc Update EC.FieldAsInterface to use Charging for referencing rating/accounting
ChargingID is expected to have either *rating or *accounting prefix.
2024-01-06 17:12:57 +01:00
ionutboangiu
37578d3743 Add FieldAsInterface implementation for EventCharges
and for types within EventCharges that are required for this
functionality.
2024-01-06 17:12:57 +01:00
gezimbll
b3956da736 Added new filter *contains 2023-12-19 16:03:35 +01:00
ionutboangiu
d29f84169c Move cdrs to its own package
Moved engine/cdr.go to utils/cdr.go.
Moved engine/cdrs.go and engine/cdrs_test.go to cdrs package.
Moved api functions from cdrs/cdrs.go to cdrs/apis.go. Same for the
tests.
Deleted CDRsV1 type and its methods.
2023-12-12 10:09:18 +01:00
ionutboangiu
560f42bf8d Add store block back inside *CDRServer.processEvents
Added *store and *rerate dynamic opts for cdrs.
2023-12-12 10:09:18 +01:00
ionutboangiu
f5d69cb41b Implement ProcessStoredEvents API 2023-11-16 15:38:18 +01:00
ionutboangiu
e218ca06a8 Add consts for AdminSv1 CDRs api names 2023-11-15 17:25:21 +01:00
ionutboangiu
1ef2afaa97 Update/remove dependencies
Remove cenkalti/rpc2 dependency and update client constructor.
Commented tests that only start and stop engine.

Fixed compilation errors caused by Azure/go-amqp update.

Remove cgrates/ugocodec dependency since we have everything
we need in ugoriji/go/codec and add tests for it.
2023-11-15 14:03:21 +01:00
ionutboangiu
d5039b3ce8 Add CDRs CRUD queries back and remove TP functions 2023-11-09 20:50:36 +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
6bcc374d45 Update EndOfMonth coreutils test 2023-10-19 17:19:30 +02: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
ionutboangiu
b09512a5c5 Implement *strip converter + tests 2023-10-09 21:08:28 +02:00
ionutboangiu
d0a435aa6d Migrate to new jetstream API
Upgraded go.mod nats version due to an issue caused by version mismatch
between driver and server (uncertain).

Renamed function from getProcessOptions to getProcessedOptions.

## *NatsER.Serve

- Replaced ChanQueueSubscribe with QueueSubscribe for Core NATS consumer
to handle the message processing directly.

- Since QueueSubscribe is now used regardless of jetstream status, the
message handler has been assigned to a separate variable that can be
reused.

-  The message handler is now dealing with the message processing
directly, therefore the select case listening for the channel which is
feeding NATS messages can be removed together with the channel itself
and the select. Currently, the goroutine within Serve only has to block
until the rdrExit chan is closed.

- Moved the resource check inside the handler right before starting the
message processing goroutine.

## *NatsEE.parseOpts

- Renamed function from parseOpt to parseOpts.

- Handled the error coming from GetNatsOpts function.

## *NatsEE.Connect

- Updated function to return early in case of non-nil nats.Conn value
to reduce nesting.

## *NatsEE.ExportEvent

- Use defer to release resources and RUnlock.

## *NatsEE.Close

- Use defer to Unlock.

- Update function to return early in case of nil nats.Conn value to
reduce nesting.

## ees.GetNatsOpts

- Chose switch over if else when parsing client certificate and keys
opts.

- Updated function to return the errors directly instead of assigning
them to a separate variable right before returning.

## ers.GetNatsOpts

- Chose switch over if else when parsing client certificate and keys
opts.

- Updated function to return the errors directly instead of assigning
them to a separate variable right before returning.

Removed tab from commented natsJetStreamMaxWaitProcessed option
value in config_defaults.go under ers section.

Added integration test for ERs NATS.

Updated ees/ers implementation to use the jetstream package which
separates the jetstream context from Core NATS.

Removed the jsOpts fields from the NatsEE struct. We are now using the
jetStreamMaxWait option directly through a timeout context.

Added streamName option for NATS reader since it is now required to be
specified when creating a consumer (it is not inferred based on subject
anymore).

Updated nats ers integration tests.

Updated tests to also use the new jetstream package.

Updated tests to start the nats-server using their official driver
instead of using the std go exec package. time.Sleeps are now not
required anymore to wait for the server.

In test configurations for nats readers, made sure that natsStreamName
option is populated. It is now required for consumers to know where to
subscribe.
2023-09-28 20:48:39 +02:00
NikolasPetriti
8ef305d64c Add coverage tests for utils and config 2023-09-12 18:10:23 +02:00
arberkatellari
770454c007 Renew DlgList, DNSAgent & add SRV/A support 2023-08-28 12:27:53 +02:00
arberkatellari
6eda4303f5 Revise DNS Agent and Service 2023-08-28 12:27:53 +02:00