summaryrefslogtreecommitdiffstats
path: root/src/stats.c
Commit message (Collapse)AuthorAgeFilesLines
* Fix build for OSXArran Cudbard-Bell2016-05-201-1/+13
| | | | | | | Change-Id: I580a500edcf4812e570be586890abef746083a8c Reviewed-on: https://gerrit.osmocom.org/74 Tested-by: Jenkins Builder Reviewed-by: Holger Freyther <holger@freyther.de>
* stats: Reorder functions in stats.cJacob Erlbeck2015-11-261-59/+61
| | | | | | | Due to prior refactoring, the functions do not have an sensible order in the file. This commit tries to improve that a little bit. Sponsored-by: On-Waves ehf
* stats: Move statsd related code into a separate fileJacob Erlbeck2015-11-261-139/+9
| | | | | | | | | | | This commit moves the stats specific code parts into stats_statsd.c while keeping the generic parts in stats.c. The code in stats.c no longer contains references to statsd symbols. Note that the VTY code still needs to know about every stats reporter backend. Sponsored-by: On-Waves ehf
* stats: Fix not reported stat item valuesJacob Erlbeck2015-11-091-1/+3
| | | | | | | | | | | | Currently the global stat item index is being advanced in osmo_stat_item_group_handler, so that the second and further groups in the list will skip new item values. This commit moves the call to osmo_stat_item_discard_all into osmo_stats_report to a place where all groups have been processed already. Sponsored-by: On-Waves ehf
* stats: Fix handling of multiple resportersJacob Erlbeck2015-11-091-2/+2
| | | | | | | | | | | | | Currently the reporter loop is aborted, if the event would be ignored due to an insufficient max_level. Thus the reporters that happen to be stored afterwards would be skipped even if their level were sufficient. This commit replaces the conditional 'return' statement by a considtional 'continue' statement to ensure the processing of the list tail. Sponsored-by: On-Waves ehf
* stats: Send all values on reporter updateJacob Erlbeck2015-11-091-8/+25
| | | | | | | | | | | | | | | | | | | | | Currently only counter changes and new item values are being reported. This makes it cumbersome to configure reporting clients, since there is nothing like a list of all parameters. This commit changes this behaviour such that all currently existing counters and items that would be reported eventually, are passed to the reporter when it has been reconfigured or enabled. If a counter has not been incremented, 0 is sent. If a stat item value has not been added, the last item value (or the default value if there is none) is resent again. Note that this will not catch transient counters/items that will be created later on, e.g. triggered by new peers or subscribers. To just force this kind of dump on a running reporter, it is sufficient to invoke the 'enable' command in its configuration node. Sponsored-by: On-Waves ehf
* stats: Fix name prefix handlingJacob Erlbeck2015-11-091-11/+23
| | | | | | | | | | | | | | Currently the having an unset prefix leads to an abort() in the statsd reporter due to an fprintf format string error. In addition the prefix cannot be reset to its initial state (NULL) by using 'no prefix', which just sets the prefix to the empty string, causing a single leading dot to appear in front of the name. This commit changes the implemenation to consistly use NULL for the unset name prefix ('no prefix') and to handle this case correctly in the statsd reporter. Sponsored-by: On-Waves ehf
* stats: Fix build on FreeBSDHolger Hans Peter Freyther2015-08-211-1/+2
| | | | | include stdint.h for int64_t and use netinet/in.h and not netinet/ip.h for getting sockaddr_in and such.
* stats: Do not assign the wrong addresssHolger Hans Peter Freyther2015-11-021-1/+1
| | | | | | | | we need to put the default value into inaddr and not put a 32bit value into the addr pointer. Spotted by cppcheck: [src/stats.c:231]: (error) Uninitialized variable: inaddr
* stats: Remove warnings about never read variablesHolger Hans Peter Freyther2015-11-021-8/+5
| | | | | | | | | | | | | | | | | | Nothing is being done with these return values. Remove them for now and update the TODO entry that is present at two of the three places. stats.c: In function ‘rate_ctr_handler’: stats.c:570:6: warning: variable ‘rc’ set but not used [-Wunused-but-set-variable] int rc; ^ stats.c: In function ‘osmo_stat_item_handler’: stats.c:617:6: warning: variable ‘rc’ set but not used [-Wunused-but-set-variable] int rc; ^ stats.c: In function ‘handle_counter’: stats.c:651:6: warning: variable ‘rc’ set but not used [-Wunused-but-set-variable] int rc;
* log: Add new DLSTATS log levelJacob Erlbeck2015-11-021-4/+1
| | | | | | | | This log level is used by the stats subsystem log reporter to report statistics to level INFO. Note that the default level of DLSTATS is NOTICE. Sponsored-by: On-Waves ehf
* stats: Limit reporting by class idJacob Erlbeck2015-11-021-0/+29
| | | | | | | | | | | | | | | This commit adds class_id fields to the rate_ctr and stat_item group descriptions. The stats reporter code is extended to only process groups whose class_id does not exceed a per reporter max_class level. If the class_id is not set, the code assumes 'global' for groups with idx == 0 and 'subscriber' otherwise. The following vty command is added to config-stats: level (global|peer|subscriber) Set the maximum group level Sponsored-by: On-Waves ehf
* stats: Report group indices as unsigned intJacob Erlbeck2015-11-021-8/+9
| | | | | | | | | | | | Currently the unsigned group index value is silently being cast to (signed) int in the log and statsd reporter code. If the resulting value is negative (which can happen for instance with MMCTX counters), the index is assumed to be unset. This commit changes the affected types to unsigned. The index value 0 is then the only value indicating an unset group. Sponsored-by: On-Waves ehf
* stats: Add osmo_ name prefix to identifiersJacob Erlbeck2015-11-021-107/+107
| | | | | | | | | | Since the the stat_item and stats functions and data types are meant to be exported, they get an osmo_ prefix. Sponsored-by: On-Waves ehf [hfreyther: Prepended the enum values too. This was requested by Jacob]
* stats: Add log reporterJacob Erlbeck2015-10-291-0/+63
| | | | | | | This reporter passes the measurement values to the logging subsystem as DSTATS (which is currently DLGLOBAL) level INFO messages. Sponsored-by: On-Waves ehf
* stats: Use function pointers in reporter objectsJacob Erlbeck2015-10-291-25/+26
| | | | | | | | | | | | Currently case statements are used to select the right reporter functions. This makes it difficult to add new reporter types, especially if they are not going to reside in the same file. This commit introduces per reporter function pointer for open, close, send_count, and send_item. They are checked for non-NULL before being called or skipped. Sponsored-by: On-Waves ehf
* stats: Make net config optionalJacob Erlbeck2015-10-291-0/+14
| | | | | | | | To support reporters without network configuration, this commit introduces the have_net_config flag to provide corresponding error messages. Sponsored-by: On-Waves ehf
* stats: Support statsd Multi-Metric PacketsJacob Erlbeck2015-10-291-11/+97
| | | | | | | | | | | | | | | | If the MTU is given, combine several messages into a single UDP packet until the limit is reached. Flush all reporters after the values have been scanned. New vty commands (node config-stats): mtu <100-65535> Enable multi-metric packets and set the maximum packet size (in byte) no mtu Disable multi-metric packets Note that single messages that are longer than the given MTU (minus 28 octets protocol overhead) will be dropped. Sponsored-by: On-Waves ehf
* stats: Add support for osmo_countersJacob Erlbeck2015-10-291-0/+32
| | | | | | | | | This commit changes the reporting code to also show all modified osmo_counter values. Since there is no grouping of these values, the name string just consists of the optional prefix and the counter name. Sponsored-by: On-Waves ehf
* stats: Report stat item valuesJacob Erlbeck2015-10-291-0/+49
| | | | | | | | | Currently only rate counter are being supported. This commit adds support for stat items. All groups are polled for changed values. Sponsored-by: On-Waves ehf
* stats: Implement timer based reportingJacob Erlbeck2015-10-291-3/+43
| | | | | | | | This calls stats_flush in regular intervals which polls the statistical values and calls the active reporters when values have changed. Sponsored-by: On-Waves ehf
* stats: Add the reporting frameworkJacob Erlbeck2015-10-291-0/+387
This commit provides the stats reporting framework that can manage several types of measurement reporters. Initially support for rate_ctr and the statsd protocol is included. Sponsored-by: On-Waves ehf