Sha256: f03c6fa2485ce8b929a0eef3034487eeb3f74d91624591bab59b5f5889bf2111
Contents?: true
Size: 962 Bytes
Versions: 2
Compression:
Stored size: 962 Bytes
Contents
module ThreeScaleToolbox module Tasks class CopyMetricsTask include CopyTask def call source_metrics = source.metrics target_metrics = target.metrics puts "original service has #{source_metrics.size} metrics" puts "target service has #{target_metrics.size} metrics" missing = missing_metrics(source_metrics, target_metrics) missing.each do |metric| metric.delete('links') Entities::Metric.create(service: target, attrs: metric) end puts "created #{missing.size} metrics on the target service" end private def missing_metrics(source_metrics, target_metrics) ThreeScaleToolbox::Helper.array_difference(source_metrics, target_metrics) do |source, target| ThreeScaleToolbox::Helper.compare_hashes(source, target, ['system_name']) end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
3scale_toolbox-0.11.0 | lib/3scale_toolbox/tasks/copy_metrics_task.rb |
3scale_toolbox-0.10.0 | lib/3scale_toolbox/tasks/copy_metrics_task.rb |