All Projects β†’ palkan β†’ Influxer

palkan / Influxer

Licence: mit
InfluxDB ActiveRecord-style

Programming Languages

ruby
36898 projects - #4 most used programming language

Projects that are alternatives of or similar to Influxer

Plots2
a collaborative knowledge-exchange platform in Rails; we welcome first-time contributors! 🎈
Stars: ✭ 666 (+479.13%)
Mutual labels:  hacktoberfest, rails
Node Influx
πŸ“ˆ The InfluxDB Client for Node.js and Browsers
Stars: ✭ 820 (+613.04%)
Mutual labels:  hacktoberfest, influxdb
Openfoodnetwork
Connect suppliers, distributors and consumers to trade local produce. We're recruiting paid contributors, link below.
Stars: ✭ 682 (+493.04%)
Mutual labels:  hacktoberfest, rails
Matestack Ui Core
Matestack enables you to create sophisticated, reactive UIs in pure Ruby, without touching JavaScript and HTML. You end up writing 50% less code while increasing productivity, maintainability and developer happiness.
Stars: ✭ 469 (+307.83%)
Mutual labels:  hacktoberfest, rails
Odoo Shopinvader
Odoo Modules. Sorry Magento, Shopinvader is coming
Stars: ✭ 60 (-47.83%)
Mutual labels:  hacktoberfest, rails
Webpacker
Use Webpack to manage app-like JavaScript modules in Rails
Stars: ✭ 5,282 (+4493.04%)
Mutual labels:  hacktoberfest, rails
Action policy
Authorization framework for Ruby/Rails applications
Stars: ✭ 718 (+524.35%)
Mutual labels:  hacktoberfest, rails
Solidus
πŸ›’Solidus, Rails eCommerce System
Stars: ✭ 3,985 (+3365.22%)
Mutual labels:  hacktoberfest, rails
Consul
Consul - Open Government and E-Participation Web Software
Stars: ✭ 1,088 (+846.09%)
Mutual labels:  hacktoberfest, rails
Logidze
Database changes log for Rails
Stars: ✭ 1,060 (+821.74%)
Mutual labels:  hacktoberfest, rails
Anyway config
Configuration library for Ruby gems and applications
Stars: ✭ 409 (+255.65%)
Mutual labels:  hacktoberfest, rails
Readyresponder
Local Incident Management System - This is used for tracking resources for Local Emergency Management
Stars: ✭ 106 (-7.83%)
Mutual labels:  hacktoberfest, rails
Refinerycms
An extendable Ruby on Rails CMS that supports Rails 6.0+
Stars: ✭ 3,825 (+3226.09%)
Mutual labels:  hacktoberfest, rails
Osem
Open Source Event Manager. An event management tool tailored to Free and Open Source Software conferences.
Stars: ✭ 649 (+464.35%)
Mutual labels:  hacktoberfest, rails
Active delivery
Ruby framework for keeping all types of notifications (mailers, push notifications, whatever) in one place
Stars: ✭ 388 (+237.39%)
Mutual labels:  hacktoberfest, rails
Fae
CMS for Rails. For Reals.
Stars: ✭ 701 (+509.57%)
Mutual labels:  hacktoberfest, rails
Kuby Core
A convention over configuration approach for deploying Rails apps. https://getkuby.io
Stars: ✭ 273 (+137.39%)
Mutual labels:  hacktoberfest, rails
Isolator
Detect non-atomic interactions within DB transactions
Stars: ✭ 362 (+214.78%)
Mutual labels:  hacktoberfest, rails
Openwisp Monitoring
Network monitoring system written in Python and Django, designed to be extensible, programmable, scalable and easy to use by end users: once the system is configured, monitoring checks, alerts and metric collection happens automatically.
Stars: ✭ 37 (-67.83%)
Mutual labels:  hacktoberfest, influxdb
Ifme
Free, open source mental health communication web app to share experiences with loved ones
Stars: ✭ 1,147 (+897.39%)
Mutual labels:  hacktoberfest, rails

Build

Influxer

Influxer provides an ActiveRecord-style way to work with InfluxDB with many useful features, such as:

Installation

Adding to a gem:

# my-cool-gem.gemspec
Gem::Specification.new do |spec|
  # ...
  spec.add_dependency "influxer", ">= 1.2.0"
  # ...
end

Or adding to your project:

# Gemfile
gem "influxer", "~> 1.2"

Usage

Metrics classes

To query InfluxDB or write to it, you should define a metrics class first. Each metrics class represents a measurement/series (or multiple related measurements):

class VisitsMetrics < Influxer::Metrics
  # Define tags...
  tags :account_id, :page_id
  # ...and attributes
  attributes :user_id, :browser
end

Querying

Now you can use your metrics classes in a similar way to Active Record models to build queries. For example:

VisitsMetrics.select(:account_id, :user_id).where(page_id: /^home\/.*/)

Influxer provides special query methods for dealing with time series:

  • Group by time: Metrics.time(:hour) => # select * ... group by time(1h).
  • Select only points for the last hour/minute/whatever: Metrics.past(:day) => # select * ... where time > now() - 1d.
  • Select only points since the specified time: Metrics.since(Time.utc(2014,12,31)) => # select * ... where time > 1419984000s.
  • and more.

See our Wiki for more.

Scopes support

You can define scopes to re-use query conditions:

class Metrics < Influxer::Metrics
  tags :account_id
  attributes :value

  default_scope -> { time(:hour).limit(1000) }

  scope :unlimited, -> { limit(nil) }
  scope :by_account, ->(id) { where(account_id: id) if id.present? }
end

Metrics.by_account(1)
# => select * from "metrics" group by time(1h) where account_id=1 limit 1000

Metrics.unlimited.by_account(1).time(:week)
# => select * from "metrics" group by time(1w) where account_id=1

Active Record integration

You can association metrics with Active Record models:

class UserVisits < Influxer::Metrics
end

class User < ActiveRecord::Base
  has_metrics :visits
end

user = User.find(1)
user.visits.write(page_id: "home")
#=> < creates point {user_id: 1, page_id: 'home'} in 'user_visits' series >

user.visits.where(page_id: "home")
#=> select * from user_visits where page_id='home'

Find more on Wiki.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/palkan/influxer.

License

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

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].