.. _cdrstats-main: CDR Stats Server ================ Collects CDRs from various sources (eg: CGR-CDRS, CGR-Mediator, CGR-SM, third-party CDR source via RPC) and builds real-time stats based on them. Each StatsQueue has attached *ActionTriggers* with monitoring and actions capabilities. Principles of functionality: - Standalone component (can be started individually on remote hardware, isolated form other CGRateS compoenents). - Performance oriented. Should be able to process tens of thousands of CDRs per second. - Cache driven technology. But SaveInterval can be set to store this information on redis. - Stats are build within *StatsQueues* a CDR Stats Server being able to support unlimited number of StatsQueues. Each CDR will be passed to all of StatsQueues available and will be processed by individual StatsQueue based on configuration. - Stats will be build inside Metrics (eg: ASR, ACD, ACC, TCC) and attached to specific StatsQueue. - Each StatsQueue will have attached one *ActionTriggers* profile which will monitor Metrics values and react on thresholds reached (unlimited number of thresholds and reactions configurable). - CDRs are processed by StatsQueues if they pass CDR field filters. - CDRs are auto-removed from StatsQueues in a *fifo* manner if the QueueLength is reached or if they do not longer fit within TimeWindow defined. Configuration ------------- Individual StatsQueue configurations are loaded inside TariffPlan defitions, one configuration object is internally represented as: :: type CdrStats struct { Id string // Config id, unique per config instance QueueLength int // Number of items in the stats buffer TimeWindow time.Duration // Will only keep the CDRs who's call setup time is not older than time.Now()-TimeWindow SaveInterval time.Duration // Interval to store the info into database Metrics []string // ASR, ACD, ACC, TCC, TCD, PDD SetupInterval []time.Time // CDRFieldFilter on SetupInterval, 2 or less items (>= start interval,< stop_interval) TOR []string // CDRFieldFilter on TORs CdrHost []string // CDRFieldFilter on CdrHosts CdrSource []string // CDRFieldFilter on CdrSources ReqType []string // CDRFieldFilter on ReqTypes Direction []string // CDRFieldFilter on Directions Tenant []string // CDRFieldFilter on Tenants Category []string // CDRFieldFilter on Categories Account []string // CDRFieldFilter on Accounts Subject []string // CDRFieldFilter on Subjects DestinationPrefix []string // CDRFieldFilter on DestinationPrefixes UsageInterval []time.Duration // CDRFieldFilter on UsageInterval, 2 or less items (>= Usage, = Pdd, =Cost,