Class: ThreeScale::Backend::Stats::Aggregators::Usage
- Inherits:
-
Object
- Object
- ThreeScale::Backend::Stats::Aggregators::Usage
- Defined in:
- lib/3scale/backend/stats/aggregators/usage.rb
Class Method Summary collapse
-
.aggregate(transaction, bucket = nil) ⇒ Object
Aggregates the usage of a transaction.
Methods included from Base
aggregate_values, storage, storage_cmd
Methods included from Keys
application_key_prefix, application_response_code_value_key, application_usage_value_key, applications_key_prefix, changed_keys_bucket_key, changed_keys_key, counter_key, metric_key_prefix, response_code_key_prefix, service_key_prefix, service_response_code_value_key, service_usage_value_key, set_of_apps_with_traffic, transaction_keys
Methods included from ThreeScale::Backend::StorageKeyHelpers
Class Method Details
.aggregate(transaction, bucket = nil) ⇒ Object
Aggregates the usage of a transaction. If a bucket time is specified, all new or updated stats keys will be stored in a Redis Set.
19 20 21 22 23 24 25 26 27 |
# File 'lib/3scale/backend/stats/aggregators/usage.rb', line 19 def aggregate(transaction, bucket = nil) transaction.usage.each do |metric_id, raw_value| metric_keys = Keys.transaction_keys(transaction, :metric, metric_id) cmd = storage_cmd(raw_value) value = Backend::Usage.get_from raw_value aggregate_values(value, transaction., metric_keys, cmd, bucket) end end |