influxer 0.2.4 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.rubocop.yml +12 -0
- data/.travis.yml +1 -17
- data/Changelog.md +7 -0
- data/Gemfile +7 -0
- data/README.md +6 -20
- data/Rakefile +4 -0
- data/gemfiles/rails42.gemfile +4 -1
- data/influxer.gemspec +6 -6
- data/lib/influxer/client.rb +4 -44
- data/lib/influxer/config.rb +23 -14
- data/lib/influxer/engine.rb +0 -1
- data/lib/influxer/metrics/metrics.rb +40 -7
- data/lib/influxer/metrics/relation/calculations.rb +13 -7
- data/lib/influxer/metrics/relation/time_query.rb +14 -8
- data/lib/influxer/metrics/relation/where_clause.rb +62 -0
- data/lib/influxer/metrics/relation.rb +67 -76
- data/lib/influxer/metrics/scoping.rb +4 -4
- data/lib/influxer/model.rb +4 -0
- data/lib/influxer/rails/client.rb +47 -0
- data/lib/influxer/version.rb +1 -1
- data/lib/influxer.rb +4 -2
- data/spec/cases/points_spec.rb +34 -0
- data/spec/client_spec.rb +21 -24
- data/spec/fixtures/empty_result.json +21 -0
- data/spec/fixtures/single_series.json +29 -0
- data/spec/metrics/metrics_spec.rb +139 -113
- data/spec/metrics/relation_spec.rb +160 -105
- data/spec/metrics/scoping_spec.rb +11 -17
- data/spec/model/user_spec.rb +44 -0
- data/spec/spec_helper.rb +38 -8
- data/spec/support/metrics/action_metrics.rb +3 -0
- data/spec/support/metrics/custom_metrics.rb +4 -0
- data/spec/support/{dummy_metrics.rb → metrics/dummy_metrics.rb} +2 -1
- data/spec/support/metrics/user_metrics.rb +4 -0
- data/spec/support/metrics/visits_metrics.rb +4 -0
- data/spec/support/shared_contexts/shared_query.rb +16 -0
- data/spec/support/user.rb +14 -0
- metadata +42 -71
- data/gemfiles/rails40.gemfile +0 -7
- data/gemfiles/rails41.gemfile +0 -7
- data/lib/influxer/metrics/fanout.rb +0 -65
- data/lib/influxer/metrics/relation/fanout_query.rb +0 -49
- data/lib/tasks/influxer_tasks.rake +0 -4
- data/spec/config_spec.rb +0 -17
- data/spec/dummy/README.rdoc +0 -28
- data/spec/dummy/Rakefile +0 -6
- data/spec/dummy/app/assets/images/.keep +0 -0
- data/spec/dummy/app/assets/javascripts/application.js +0 -13
- data/spec/dummy/app/assets/stylesheets/application.css +0 -15
- data/spec/dummy/app/controllers/application_controller.rb +0 -5
- data/spec/dummy/app/controllers/concerns/.keep +0 -0
- data/spec/dummy/app/helpers/application_helper.rb +0 -2
- data/spec/dummy/app/mailers/.keep +0 -0
- data/spec/dummy/app/metrics/testo_metrics.rb +0 -3
- data/spec/dummy/app/models/.keep +0 -0
- data/spec/dummy/app/models/concerns/.keep +0 -0
- data/spec/dummy/app/models/testo.rb +0 -6
- data/spec/dummy/app/views/layouts/application.html.erb +0 -14
- data/spec/dummy/bin/bundle +0 -3
- data/spec/dummy/bin/rails +0 -4
- data/spec/dummy/bin/rake +0 -4
- data/spec/dummy/config/application.rb +0 -23
- data/spec/dummy/config/boot.rb +0 -5
- data/spec/dummy/config/database.yml +0 -25
- data/spec/dummy/config/environment.rb +0 -5
- data/spec/dummy/config/environments/development.rb +0 -37
- data/spec/dummy/config/environments/production.rb +0 -83
- data/spec/dummy/config/environments/test.rb +0 -38
- data/spec/dummy/config/influxdb.yml +0 -5
- data/spec/dummy/config/initializers/backtrace_silencers.rb +0 -7
- data/spec/dummy/config/initializers/cookies_serializer.rb +0 -3
- data/spec/dummy/config/initializers/filter_parameter_logging.rb +0 -4
- data/spec/dummy/config/initializers/inflections.rb +0 -16
- data/spec/dummy/config/initializers/mime_types.rb +0 -4
- data/spec/dummy/config/initializers/session_store.rb +0 -3
- data/spec/dummy/config/initializers/wrap_parameters.rb +0 -14
- data/spec/dummy/config/locales/en.yml +0 -23
- data/spec/dummy/config/routes.rb +0 -56
- data/spec/dummy/config/secrets.yml +0 -25
- data/spec/dummy/config.ru +0 -4
- data/spec/dummy/db/migrate/20140730133818_add_testos.rb +0 -11
- data/spec/dummy/db/migrate/20140731162044_add_column_to_testos.rb +0 -5
- data/spec/dummy/db/schema.rb +0 -22
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/lib/assets/.keep +0 -0
- data/spec/dummy/log/.keep +0 -0
- data/spec/dummy/public/404.html +0 -67
- data/spec/dummy/public/422.html +0 -67
- data/spec/dummy/public/500.html +0 -66
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/fixtures/fanout_series.json +0 -23
- data/spec/metrics/fanout_spec.rb +0 -61
- data/spec/model/testo_spec.rb +0 -27
@@ -1,83 +0,0 @@
|
|
1
|
-
Dummy::Application.configure do
|
2
|
-
# Settings specified here will take precedence over those in config/application.rb.
|
3
|
-
|
4
|
-
# Code is not reloaded between requests.
|
5
|
-
config.cache_classes = true
|
6
|
-
|
7
|
-
# Eager load code on boot. This eager loads most of Rails and
|
8
|
-
# your application in memory, allowing both threaded web servers
|
9
|
-
# and those relying on copy on write to perform better.
|
10
|
-
# Rake tasks automatically ignore this option for performance.
|
11
|
-
config.eager_load = true
|
12
|
-
|
13
|
-
# Full error reports are disabled and caching is turned on.
|
14
|
-
config.consider_all_requests_local = false
|
15
|
-
config.action_controller.perform_caching = true
|
16
|
-
|
17
|
-
# Enable Rack::Cache to put a simple HTTP cache in front of your application
|
18
|
-
# Add `rack-cache` to your Gemfile before enabling this.
|
19
|
-
# For large-scale production use, consider using a caching reverse proxy like nginx, varnish or squid.
|
20
|
-
# config.action_dispatch.rack_cache = true
|
21
|
-
|
22
|
-
# Disable Rails's static asset server (Apache or nginx will already do this).
|
23
|
-
config.serve_static_assets = false
|
24
|
-
|
25
|
-
# Compress JavaScripts and CSS.
|
26
|
-
config.assets.js_compressor = :uglifier
|
27
|
-
# config.assets.css_compressor = :sass
|
28
|
-
|
29
|
-
# Do not fallback to assets pipeline if a precompiled asset is missed.
|
30
|
-
config.assets.compile = false
|
31
|
-
|
32
|
-
# Generate digests for assets URLs.
|
33
|
-
config.assets.digest = true
|
34
|
-
|
35
|
-
# Version of your assets, change this if you want to expire all your assets.
|
36
|
-
config.assets.version = '1.0'
|
37
|
-
|
38
|
-
# Specifies the header that your server uses for sending files.
|
39
|
-
# config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
|
40
|
-
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
|
41
|
-
|
42
|
-
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
|
43
|
-
# config.force_ssl = true
|
44
|
-
|
45
|
-
# Set to :debug to see everything in the log.
|
46
|
-
config.log_level = :info
|
47
|
-
|
48
|
-
# Prepend all log lines with the following tags.
|
49
|
-
# config.log_tags = [ :subdomain, :uuid ]
|
50
|
-
|
51
|
-
# Use a different logger for distributed setups.
|
52
|
-
# config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
|
53
|
-
|
54
|
-
# Use a different cache store in production.
|
55
|
-
# config.cache_store = :mem_cache_store
|
56
|
-
|
57
|
-
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
|
58
|
-
# config.action_controller.asset_host = "http://assets.example.com"
|
59
|
-
|
60
|
-
# Precompile additional assets.
|
61
|
-
# application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
|
62
|
-
# config.assets.precompile += %w( search.js )
|
63
|
-
|
64
|
-
# Ignore bad email addresses and do not raise email delivery errors.
|
65
|
-
# Set this to true and configure the email server for immediate delivery to raise delivery errors.
|
66
|
-
# config.action_mailer.raise_delivery_errors = false
|
67
|
-
|
68
|
-
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
|
69
|
-
# the I18n.default_locale when a translation cannot be found).
|
70
|
-
config.i18n.fallbacks = true
|
71
|
-
|
72
|
-
# Send deprecation notices to registered listeners.
|
73
|
-
config.active_support.deprecation = :notify
|
74
|
-
|
75
|
-
# Disable automatic flushing of the log to improve performance.
|
76
|
-
# config.autoflush_log = false
|
77
|
-
|
78
|
-
# Use default logging formatter so that PID and timestamp are not suppressed.
|
79
|
-
config.log_formatter = ::Logger::Formatter.new
|
80
|
-
|
81
|
-
# Do not dump schema after migrations.
|
82
|
-
config.active_record.dump_schema_after_migration = false
|
83
|
-
end
|
@@ -1,38 +0,0 @@
|
|
1
|
-
Dummy::Application.configure do
|
2
|
-
# Settings specified here will take precedence over those in config/application.rb.
|
3
|
-
# The test environment is used exclusively to run your application's
|
4
|
-
# test suite. You never need to work with it otherwise. Remember that
|
5
|
-
# your test database is "scratch space" for the test suite and is wiped
|
6
|
-
# and recreated between test runs. Don't rely on the data there!
|
7
|
-
config.cache_classes = true
|
8
|
-
|
9
|
-
# Do not eager load code on boot. This avoids loading your whole application
|
10
|
-
# just for the purpose of running a single test. If you are using a tool that
|
11
|
-
# preloads Rails for running tests, you may have to set it to true.
|
12
|
-
config.eager_load = false
|
13
|
-
|
14
|
-
# Configure static asset server for tests with Cache-Control for performance.
|
15
|
-
config.serve_static_assets = true
|
16
|
-
config.static_cache_control = 'public, max-age=3600'
|
17
|
-
|
18
|
-
# Show full error reports and disable caching.
|
19
|
-
config.consider_all_requests_local = true
|
20
|
-
config.action_controller.perform_caching = false
|
21
|
-
|
22
|
-
# Raise exceptions instead of rendering exception templates.
|
23
|
-
config.action_dispatch.show_exceptions = false
|
24
|
-
|
25
|
-
# Disable request forgery protection in test environment.
|
26
|
-
config.action_controller.allow_forgery_protection = false
|
27
|
-
|
28
|
-
# Tell Action Mailer not to deliver emails to the real world.
|
29
|
-
# The :test delivery method accumulates sent emails in the
|
30
|
-
# ActionMailer::Base.deliveries array.
|
31
|
-
config.action_mailer.delivery_method = :test
|
32
|
-
|
33
|
-
# Print deprecation notices to the stderr.
|
34
|
-
config.active_support.deprecation = :stderr
|
35
|
-
|
36
|
-
# Raises error for missing translations
|
37
|
-
# config.action_view.raise_on_missing_translations = true
|
38
|
-
end
|
@@ -1,7 +0,0 @@
|
|
1
|
-
# Be sure to restart your server when you modify this file.
|
2
|
-
|
3
|
-
# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
|
4
|
-
# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
|
5
|
-
|
6
|
-
# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
|
7
|
-
# Rails.backtrace_cleaner.remove_silencers!
|
@@ -1,16 +0,0 @@
|
|
1
|
-
# Be sure to restart your server when you modify this file.
|
2
|
-
|
3
|
-
# Add new inflection rules using the following format. Inflections
|
4
|
-
# are locale specific, and you may define rules for as many different
|
5
|
-
# locales as you wish. All of these examples are active by default:
|
6
|
-
# ActiveSupport::Inflector.inflections(:en) do |inflect|
|
7
|
-
# inflect.plural /^(ox)$/i, '\1en'
|
8
|
-
# inflect.singular /^(ox)en/i, '\1'
|
9
|
-
# inflect.irregular 'person', 'people'
|
10
|
-
# inflect.uncountable %w( fish sheep )
|
11
|
-
# end
|
12
|
-
|
13
|
-
# These inflection rules are supported but not enabled by default:
|
14
|
-
# ActiveSupport::Inflector.inflections(:en) do |inflect|
|
15
|
-
# inflect.acronym 'RESTful'
|
16
|
-
# end
|
@@ -1,14 +0,0 @@
|
|
1
|
-
# Be sure to restart your server when you modify this file.
|
2
|
-
|
3
|
-
# This file contains settings for ActionController::ParamsWrapper which
|
4
|
-
# is enabled by default.
|
5
|
-
|
6
|
-
# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
|
7
|
-
ActiveSupport.on_load(:action_controller) do
|
8
|
-
wrap_parameters format: [:json] if respond_to?(:wrap_parameters)
|
9
|
-
end
|
10
|
-
|
11
|
-
# To enable root element in JSON for ActiveRecord objects.
|
12
|
-
# ActiveSupport.on_load(:active_record) do
|
13
|
-
# self.include_root_in_json = true
|
14
|
-
# end
|
@@ -1,23 +0,0 @@
|
|
1
|
-
# Files in the config/locales directory are used for internationalization
|
2
|
-
# and are automatically loaded by Rails. If you want to use locales other
|
3
|
-
# than English, add the necessary files in this directory.
|
4
|
-
#
|
5
|
-
# To use the locales, use `I18n.t`:
|
6
|
-
#
|
7
|
-
# I18n.t 'hello'
|
8
|
-
#
|
9
|
-
# In views, this is aliased to just `t`:
|
10
|
-
#
|
11
|
-
# <%= t('hello') %>
|
12
|
-
#
|
13
|
-
# To use a different locale, set it with `I18n.locale`:
|
14
|
-
#
|
15
|
-
# I18n.locale = :es
|
16
|
-
#
|
17
|
-
# This would use the information in config/locales/es.yml.
|
18
|
-
#
|
19
|
-
# To learn more, please read the Rails Internationalization guide
|
20
|
-
# available at http://guides.rubyonrails.org/i18n.html.
|
21
|
-
|
22
|
-
en:
|
23
|
-
hello: "Hello world"
|
data/spec/dummy/config/routes.rb
DELETED
@@ -1,56 +0,0 @@
|
|
1
|
-
Dummy::Application.routes.draw do
|
2
|
-
# The priority is based upon order of creation: first created -> highest priority.
|
3
|
-
# See how all your routes lay out with "rake routes".
|
4
|
-
|
5
|
-
# You can have the root of your site routed with "root"
|
6
|
-
# root 'welcome#index'
|
7
|
-
|
8
|
-
# Example of regular route:
|
9
|
-
# get 'products/:id' => 'catalog#view'
|
10
|
-
|
11
|
-
# Example of named route that can be invoked with purchase_url(id: product.id)
|
12
|
-
# get 'products/:id/purchase' => 'catalog#purchase', as: :purchase
|
13
|
-
|
14
|
-
# Example resource route (maps HTTP verbs to controller actions automatically):
|
15
|
-
# resources :products
|
16
|
-
|
17
|
-
# Example resource route with options:
|
18
|
-
# resources :products do
|
19
|
-
# member do
|
20
|
-
# get 'short'
|
21
|
-
# post 'toggle'
|
22
|
-
# end
|
23
|
-
#
|
24
|
-
# collection do
|
25
|
-
# get 'sold'
|
26
|
-
# end
|
27
|
-
# end
|
28
|
-
|
29
|
-
# Example resource route with sub-resources:
|
30
|
-
# resources :products do
|
31
|
-
# resources :comments, :sales
|
32
|
-
# resource :seller
|
33
|
-
# end
|
34
|
-
|
35
|
-
# Example resource route with more complex sub-resources:
|
36
|
-
# resources :products do
|
37
|
-
# resources :comments
|
38
|
-
# resources :sales do
|
39
|
-
# get 'recent', on: :collection
|
40
|
-
# end
|
41
|
-
# end
|
42
|
-
|
43
|
-
# Example resource route with concerns:
|
44
|
-
# concern :toggleable do
|
45
|
-
# post 'toggle'
|
46
|
-
# end
|
47
|
-
# resources :posts, concerns: :toggleable
|
48
|
-
# resources :photos, concerns: :toggleable
|
49
|
-
|
50
|
-
# Example resource route within a namespace:
|
51
|
-
# namespace :admin do
|
52
|
-
# # Directs /admin/products/* to Admin::ProductsController
|
53
|
-
# # (app/controllers/admin/products_controller.rb)
|
54
|
-
# resources :products
|
55
|
-
# end
|
56
|
-
end
|
@@ -1,25 +0,0 @@
|
|
1
|
-
# Be sure to restart your server when you modify this file.
|
2
|
-
|
3
|
-
# Your secret key is used for verifying the integrity of signed cookies.
|
4
|
-
# If you change this key, all old signed cookies will become invalid!
|
5
|
-
|
6
|
-
# Make sure the secret is at least 30 characters and all random,
|
7
|
-
# no regular words or you'll be exposed to dictionary attacks.
|
8
|
-
# You can use `rake secret` to generate a secure secret key.
|
9
|
-
|
10
|
-
# Make sure the secrets in this file are kept private
|
11
|
-
# if you're sharing your code publicly.
|
12
|
-
|
13
|
-
development:
|
14
|
-
secret_key_base: 0acf417376117dfb765e573f21090cf03217b8f0a8eaa301813c8a25c66139b5615f0e93fada39ec81599953468e792344810390008ca6ec90db825dc6b096c8
|
15
|
-
|
16
|
-
test:
|
17
|
-
secret_key_base: 164c31e4e77c1f37bbe4ce13c8f975beb0c21472e1eee6f08f2186b10b198586fcac88d161b9c2ac455acfac444c1cad4bf7c695f58e04ca2bf75c4028a9e967
|
18
|
-
influxdb:
|
19
|
-
username: test
|
20
|
-
password: test
|
21
|
-
|
22
|
-
# Do not keep production secrets in the repository,
|
23
|
-
# instead read values from the environment.
|
24
|
-
production:
|
25
|
-
secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
|
data/spec/dummy/config.ru
DELETED
data/spec/dummy/db/schema.rb
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
# encoding: UTF-8
|
2
|
-
# This file is auto-generated from the current state of the database. Instead
|
3
|
-
# of editing this file, please use the migrations feature of Active Record to
|
4
|
-
# incrementally modify your database, and then regenerate this schema definition.
|
5
|
-
#
|
6
|
-
# Note that this schema.rb definition is the authoritative source for your
|
7
|
-
# database schema. If you need to create the application database on another
|
8
|
-
# system, you should be using db:schema:load, not running all the migrations
|
9
|
-
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
|
10
|
-
# you'll amass, the slower it'll run and the greater likelihood for issues).
|
11
|
-
#
|
12
|
-
# It's strongly recommended that you check this file into your version control system.
|
13
|
-
|
14
|
-
ActiveRecord::Schema.define(version: 20140731162044) do
|
15
|
-
|
16
|
-
create_table "testos", force: true do |t|
|
17
|
-
t.datetime "created_at"
|
18
|
-
t.datetime "updated_at"
|
19
|
-
t.integer "receipt_id"
|
20
|
-
end
|
21
|
-
|
22
|
-
end
|
data/spec/dummy/db/test.sqlite3
DELETED
Binary file
|
data/spec/dummy/lib/assets/.keep
DELETED
File without changes
|
data/spec/dummy/log/.keep
DELETED
File without changes
|
data/spec/dummy/public/404.html
DELETED
@@ -1,67 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html>
|
3
|
-
<head>
|
4
|
-
<title>The page you were looking for doesn't exist (404)</title>
|
5
|
-
<meta name="viewport" content="width=device-width,initial-scale=1">
|
6
|
-
<style>
|
7
|
-
body {
|
8
|
-
background-color: #EFEFEF;
|
9
|
-
color: #2E2F30;
|
10
|
-
text-align: center;
|
11
|
-
font-family: arial, sans-serif;
|
12
|
-
margin: 0;
|
13
|
-
}
|
14
|
-
|
15
|
-
div.dialog {
|
16
|
-
width: 95%;
|
17
|
-
max-width: 33em;
|
18
|
-
margin: 4em auto 0;
|
19
|
-
}
|
20
|
-
|
21
|
-
div.dialog > div {
|
22
|
-
border: 1px solid #CCC;
|
23
|
-
border-right-color: #999;
|
24
|
-
border-left-color: #999;
|
25
|
-
border-bottom-color: #BBB;
|
26
|
-
border-top: #B00100 solid 4px;
|
27
|
-
border-top-left-radius: 9px;
|
28
|
-
border-top-right-radius: 9px;
|
29
|
-
background-color: white;
|
30
|
-
padding: 7px 12% 0;
|
31
|
-
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
32
|
-
}
|
33
|
-
|
34
|
-
h1 {
|
35
|
-
font-size: 100%;
|
36
|
-
color: #730E15;
|
37
|
-
line-height: 1.5em;
|
38
|
-
}
|
39
|
-
|
40
|
-
div.dialog > p {
|
41
|
-
margin: 0 0 1em;
|
42
|
-
padding: 1em;
|
43
|
-
background-color: #F7F7F7;
|
44
|
-
border: 1px solid #CCC;
|
45
|
-
border-right-color: #999;
|
46
|
-
border-left-color: #999;
|
47
|
-
border-bottom-color: #999;
|
48
|
-
border-bottom-left-radius: 4px;
|
49
|
-
border-bottom-right-radius: 4px;
|
50
|
-
border-top-color: #DADADA;
|
51
|
-
color: #666;
|
52
|
-
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
53
|
-
}
|
54
|
-
</style>
|
55
|
-
</head>
|
56
|
-
|
57
|
-
<body>
|
58
|
-
<!-- This file lives in public/404.html -->
|
59
|
-
<div class="dialog">
|
60
|
-
<div>
|
61
|
-
<h1>The page you were looking for doesn't exist.</h1>
|
62
|
-
<p>You may have mistyped the address or the page may have moved.</p>
|
63
|
-
</div>
|
64
|
-
<p>If you are the application owner check the logs for more information.</p>
|
65
|
-
</div>
|
66
|
-
</body>
|
67
|
-
</html>
|
data/spec/dummy/public/422.html
DELETED
@@ -1,67 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html>
|
3
|
-
<head>
|
4
|
-
<title>The change you wanted was rejected (422)</title>
|
5
|
-
<meta name="viewport" content="width=device-width,initial-scale=1">
|
6
|
-
<style>
|
7
|
-
body {
|
8
|
-
background-color: #EFEFEF;
|
9
|
-
color: #2E2F30;
|
10
|
-
text-align: center;
|
11
|
-
font-family: arial, sans-serif;
|
12
|
-
margin: 0;
|
13
|
-
}
|
14
|
-
|
15
|
-
div.dialog {
|
16
|
-
width: 95%;
|
17
|
-
max-width: 33em;
|
18
|
-
margin: 4em auto 0;
|
19
|
-
}
|
20
|
-
|
21
|
-
div.dialog > div {
|
22
|
-
border: 1px solid #CCC;
|
23
|
-
border-right-color: #999;
|
24
|
-
border-left-color: #999;
|
25
|
-
border-bottom-color: #BBB;
|
26
|
-
border-top: #B00100 solid 4px;
|
27
|
-
border-top-left-radius: 9px;
|
28
|
-
border-top-right-radius: 9px;
|
29
|
-
background-color: white;
|
30
|
-
padding: 7px 12% 0;
|
31
|
-
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
32
|
-
}
|
33
|
-
|
34
|
-
h1 {
|
35
|
-
font-size: 100%;
|
36
|
-
color: #730E15;
|
37
|
-
line-height: 1.5em;
|
38
|
-
}
|
39
|
-
|
40
|
-
div.dialog > p {
|
41
|
-
margin: 0 0 1em;
|
42
|
-
padding: 1em;
|
43
|
-
background-color: #F7F7F7;
|
44
|
-
border: 1px solid #CCC;
|
45
|
-
border-right-color: #999;
|
46
|
-
border-left-color: #999;
|
47
|
-
border-bottom-color: #999;
|
48
|
-
border-bottom-left-radius: 4px;
|
49
|
-
border-bottom-right-radius: 4px;
|
50
|
-
border-top-color: #DADADA;
|
51
|
-
color: #666;
|
52
|
-
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
53
|
-
}
|
54
|
-
</style>
|
55
|
-
</head>
|
56
|
-
|
57
|
-
<body>
|
58
|
-
<!-- This file lives in public/422.html -->
|
59
|
-
<div class="dialog">
|
60
|
-
<div>
|
61
|
-
<h1>The change you wanted was rejected.</h1>
|
62
|
-
<p>Maybe you tried to change something you didn't have access to.</p>
|
63
|
-
</div>
|
64
|
-
<p>If you are the application owner check the logs for more information.</p>
|
65
|
-
</div>
|
66
|
-
</body>
|
67
|
-
</html>
|
data/spec/dummy/public/500.html
DELETED
@@ -1,66 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html>
|
3
|
-
<head>
|
4
|
-
<title>We're sorry, but something went wrong (500)</title>
|
5
|
-
<meta name="viewport" content="width=device-width,initial-scale=1">
|
6
|
-
<style>
|
7
|
-
body {
|
8
|
-
background-color: #EFEFEF;
|
9
|
-
color: #2E2F30;
|
10
|
-
text-align: center;
|
11
|
-
font-family: arial, sans-serif;
|
12
|
-
margin: 0;
|
13
|
-
}
|
14
|
-
|
15
|
-
div.dialog {
|
16
|
-
width: 95%;
|
17
|
-
max-width: 33em;
|
18
|
-
margin: 4em auto 0;
|
19
|
-
}
|
20
|
-
|
21
|
-
div.dialog > div {
|
22
|
-
border: 1px solid #CCC;
|
23
|
-
border-right-color: #999;
|
24
|
-
border-left-color: #999;
|
25
|
-
border-bottom-color: #BBB;
|
26
|
-
border-top: #B00100 solid 4px;
|
27
|
-
border-top-left-radius: 9px;
|
28
|
-
border-top-right-radius: 9px;
|
29
|
-
background-color: white;
|
30
|
-
padding: 7px 12% 0;
|
31
|
-
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
32
|
-
}
|
33
|
-
|
34
|
-
h1 {
|
35
|
-
font-size: 100%;
|
36
|
-
color: #730E15;
|
37
|
-
line-height: 1.5em;
|
38
|
-
}
|
39
|
-
|
40
|
-
div.dialog > p {
|
41
|
-
margin: 0 0 1em;
|
42
|
-
padding: 1em;
|
43
|
-
background-color: #F7F7F7;
|
44
|
-
border: 1px solid #CCC;
|
45
|
-
border-right-color: #999;
|
46
|
-
border-left-color: #999;
|
47
|
-
border-bottom-color: #999;
|
48
|
-
border-bottom-left-radius: 4px;
|
49
|
-
border-bottom-right-radius: 4px;
|
50
|
-
border-top-color: #DADADA;
|
51
|
-
color: #666;
|
52
|
-
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
53
|
-
}
|
54
|
-
</style>
|
55
|
-
</head>
|
56
|
-
|
57
|
-
<body>
|
58
|
-
<!-- This file lives in public/500.html -->
|
59
|
-
<div class="dialog">
|
60
|
-
<div>
|
61
|
-
<h1>We're sorry, but something went wrong.</h1>
|
62
|
-
</div>
|
63
|
-
<p>If you are the application owner check the logs for more information.</p>
|
64
|
-
</div>
|
65
|
-
</body>
|
66
|
-
</html>
|
File without changes
|
@@ -1,23 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"dummy_by_day_user_6":
|
3
|
-
[
|
4
|
-
{
|
5
|
-
"time": 1430092800,
|
6
|
-
"sequence_number": 1,
|
7
|
-
"time_spent": 100
|
8
|
-
}
|
9
|
-
],
|
10
|
-
"dummy_by_day_user_2":
|
11
|
-
[
|
12
|
-
{
|
13
|
-
"time": 1430092800,
|
14
|
-
"sequence_number": 1,
|
15
|
-
"time_spent": 50
|
16
|
-
},
|
17
|
-
{
|
18
|
-
"time": 1430094800,
|
19
|
-
"sequence_number": 2,
|
20
|
-
"time_spent": 150
|
21
|
-
}
|
22
|
-
]
|
23
|
-
}
|
data/spec/metrics/fanout_spec.rb
DELETED
@@ -1,61 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Influxer::Metrics do
|
4
|
-
before do
|
5
|
-
allow_any_instance_of(Influxer::Client).to receive(:query) do |_, sql|
|
6
|
-
sql
|
7
|
-
end
|
8
|
-
end
|
9
|
-
|
10
|
-
let(:dummy) do
|
11
|
-
Class.new(Influxer::Metrics) do
|
12
|
-
set_series 'dummy'
|
13
|
-
default_scope -> { time(:hour) }
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
let(:doomy) do
|
18
|
-
Class.new(dummy) do
|
19
|
-
scope :by_user, -> (id) { where(user: id) if id.present? }
|
20
|
-
scope :hourly, -> { where(by: :hour).time(nil) }
|
21
|
-
scope :daily, -> { where(by: :day).time(nil) }
|
22
|
-
|
23
|
-
fanout :by, :user, :account, delimeter: "."
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
let(:dappy) do
|
28
|
-
Class.new(doomy) do
|
29
|
-
fanout :user, delimeter: "_"
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
describe "fanouts" do
|
34
|
-
it "should work with one fanout" do
|
35
|
-
expect(doomy.by_user(1).to_sql).to eq "select * from \"dummy.user.1\" group by time(1h)"
|
36
|
-
end
|
37
|
-
|
38
|
-
it "should work with several fanouts" do
|
39
|
-
expect(dappy.by_user(1).hourly.to_sql).to eq "select * from \"dummy_by_hour_user_1\""
|
40
|
-
end
|
41
|
-
|
42
|
-
it "should work with regexp fanouts" do
|
43
|
-
expect(dappy.where(dummy_id: 100).by_user(/[1-3]/).daily.to_sql)
|
44
|
-
.to eq "select * from /^dummy_by_day_user_[1-3]$/ where (dummy_id=100)"
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
describe "#prepare_fanout_points" do
|
49
|
-
before do
|
50
|
-
allow_any_instance_of(Influxer::Client).to receive(:query) do |_, _sql|
|
51
|
-
JSON.parse(File.read('./spec/fixtures/fanout_series.json'))
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
|
-
it "sets fanout fields values" do
|
56
|
-
res = dappy.by_user(/\d+/).daily.to_a
|
57
|
-
expect(res.detect { |v| v["user"] == '6' }).to include('time_spent' => 100, 'by' => 'day')
|
58
|
-
expect(res.select { |v| v["user"] == '2' }.size).to eq 2
|
59
|
-
end
|
60
|
-
end
|
61
|
-
end
|
data/spec/model/testo_spec.rb
DELETED
@@ -1,27 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Testo do
|
4
|
-
let(:testo) { Testo.new receipt_id: 10 }
|
5
|
-
specify { expect(testo).to respond_to :metrics }
|
6
|
-
specify { expect(testo).to respond_to :testo_metrics }
|
7
|
-
specify { expect(testo).to respond_to :testo2_metrics }
|
8
|
-
specify { expect(testo).to respond_to :custom_metrics }
|
9
|
-
|
10
|
-
describe "metrics attributes" do
|
11
|
-
it "should add foreign key and inherits" do
|
12
|
-
expect(testo.metrics.build.testo_id).to eq testo.id
|
13
|
-
expect(testo.testo_metrics.build.testo_id).to eq testo.id
|
14
|
-
expect(testo.testo_metrics.build.receipt_id).to eq 10
|
15
|
-
end
|
16
|
-
|
17
|
-
it "should add custom foreign key" do
|
18
|
-
expect(testo.testo2_metrics.build.testo).to eq testo.id
|
19
|
-
end
|
20
|
-
|
21
|
-
it "should add nil foreign key" do
|
22
|
-
expect(testo.custom_metrics.build.testo_id).to be_nil
|
23
|
-
expect(testo.custom_metrics.build.testo).to be_nil
|
24
|
-
expect(testo.custom_metrics.build.receipt_id).to be_nil
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|