soar_analytics

Analytics toolset for the SOAR architecture that provides for easy analysis of matters such as performance


License
MIT
Install
gem install soar_analytics -v 0.0.1

Documentation

SoarAnalytics

This gem provides the analytics helpers that can be plugged into the SOAR architecture. The output is in the form of key value pairs that can easily be analyzed using queries on your auditing event logs.

Installation

Add this line to your application's Gemfile:

gem 'soar_analytics'

And then execute:

$ bundle

Or install it yourself as:

$ gem install soar_analytics

Testing

Behavioural driven testing can be performed by testing so:

$ bundle exec rspec -cfd spec/*

Usage

Initialize and configure the analytics with the auditing provider so:

SoarAnalytics.auditing = myauditing

Reporter

The Reporter class is the most basic reporting which simply reports a value in a key value pair using the specified auditing level. Not very useful for most applcations but forms the basis of other specialized reporters in this gem. The flow identifier parameter is optional.

flow_id = SoarFlow::ID::generate_flow_id
reporter = SoarAnalytics::Reporter.new('my_reporter')
value = 123
reporter.report(value,:warn,flow_id)

ThresholdReporter

The ThresholdReporter class can be configured with various thresholds that determines the auditing level of the audit event when reported. This allows you to set levels at which you can define informational, warning and error conditions based on the value reported. Useful in examples such as where a database operation should take less than an certain amount of time. Anything above that value will then be reported as warnings or errors. The flow identifier parameter is optional.

flow_id = SoarFlow::ID::generate_flow_id
threshold_reporter = SoarAnalytics::ThresholdReporter.new(name: 'my_threshold_reporter', info_threshold: 1, warn_threshold: 2, error_threshold: 3)
value = 2
threshold_reporter.report(value,flow_id)

TimeDeltaReporter

Probably the most useful reporter in this gem is the TimeDeltaReporter which calculates and reports on the time difference since the initialization of the object. This is a specialization of the ThresholdReporter. Only the parameter 'name' is required during the initialization. The rest are optional and defaults to info level for all time deltas greater or equal to zero. The flow identifier parameter is also optional.

flow_id = SoarFlow::ID::generate_flow_id
timer = SoarAnalytics::TimeDeltaReporter.new(name: "db_access_time", info_threshold: 1, warn_threshold: 2, error_threshold: 3)
sleep(1)
timer.report(flow_id)

Contributing

Bug reports and feature requests are welcome by email to barney dot de dot villiers at hetzner dot co dot za. This gem is sponsored by Hetzner (Pty) Ltd (http://hetzner.co.za)

License

The gem is available as open source under the terms of the MIT License.