Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

umbrtonic

Package Overview
Dependencies
Maintainers
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

umbrtonic

  • 0.2.0
  • Rubygems
  • Socket score

Version published
Maintainers
2
Created
Source

Umbrtonic

build

Gem for transferring Active Support Instrumentation events to the InfluxDB database via UDP without boilerplate code.

Installation

Add this line to your application's Gemfile:

gem 'umbrtonic'

And then execute:

$ bundle

Or install it yourself as:

$ gem install umbrtonic

Configuration

Under the hood Umbrtonic uses Qonfig gem.

By default, gem sends data to 127.0.0.1:8089. You are able to change this easily:

Umbrtonic.configure do |conf|
  conf.influxdb.host = "another.machine"
  conf.influxdb.port = 4444
end

Using a custom prefix

Optionally you are able to set a prefix:

Umbrtonic.configure do |conf|
  conf.prefix = "my_app"
end

For example, when you subscribe to actions, points to InfluxDB will be sent as my_app_actions.

Alternatively, it is possible to configure with file:

production:
  prefix: custom
  influxdb:
    host: 127.0.0.1
    port: 8094
# etc

and then load configuration:

Umbrtonic.config.load_from_yaml(
  Rails.root / "config" / "umbrtonic.yml",
  expose: Rails.env
)

Usage

Umbrtonic.bind("process_action.action_controller") do |inf, event, payload|
  inf.values(
    count:      1, 
    duration:   event.duration, 
    db_runtime: event.payload[:db_runtime],
  )
  
  inf.tags(
    controller: payload[:controller], 
    action:     payload[:action],
  )
end

Gem provides instance of InfluxDB data builder and information about the event and payload for quick access:

Umbrtonic.bind("process_action.action_controller") do |inf, event, payload|
  event.name     # => "process_action.action_controller"
  event.duration # => 10 (in milliseconds)
  event.payload  # => event-specific payload 

  payload        # => event-specific payload, alias for event.payload 
end

See more information about Active Support Notifications here

You are able to set custom name for event:

Umbrtonic.bind("process_action.action_controller", measurement: "actions") do |inf, event, payload|
  # your bindings
end

In this example events will be sent as actions.

There is complete list of Ruby on Rails hooks

Contributing

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

FAQs

Package last updated on 04 Mar 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc