Sha256: e49006f7cd6e35bf4059475668dea861e848f931205cc17454f3417317602f75

Contents?: true

Size: 892 Bytes

Versions: 5

Compression:

Stored size: 892 Bytes

Contents

#!/usr/bin/env ruby

require "rubygems"
require "bundler/setup"

require 'optparse'
require "simple_metrics"

SimpleMetrics.logger = Logger.new("/dev/null")
SimpleMetrics::DataPointRepository.truncate_collections
SimpleMetrics::DataPointRepository.ensure_collections_exist

bucket = SimpleMetrics::Bucket.first

name = ENV['NAME'] || "test.page.visits.1"
now = Time.now.to_i
minute = 60
hour   = minute * 60

def create_dps(name)
  previous_value = 20
  (1..1).inject([]) do |result, index|
    value = previous_value+rand(20)
    result << SimpleMetrics::DataPoint::Counter.new(:name => name, :value => value)
    previous_value = value
    result
  end
end

counter = 1
current = now - 1 * hour
while (current < now)
  dps = create_dps(name)
  puts "flush data for #{Time.at(current)}, #{counter}"
  SimpleMetrics::Importer.flush_data_points(dps, current)
  current += 10
  counter += 1
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
simple_metrics-0.4.6 bin/populate
simple_metrics-0.4.5 bin/populate
simple_metrics-0.4.4 bin/populate
simple_metrics-0.4.3 bin/populate
simple_metrics-0.4.2 bin/populate