Socket
Book a DemoInstallSign in
Socket

hosted_graphite

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hosted_graphite

0.2.0
bundlerRubygems
Version published
Maintainers
1
Created
Source

Build Status Code Climate

HostedGraphite

A Ruby client for HostedGraphite

Installation

Add this line to your application's Gemfile:

gem 'hosted_graphite'

And then execute:

$ bundle

Or install it yourself as:

$ gem install hosted_graphite

Usage

Set ENV['HOSTEDGRAPHITE_APIKEY'] to your hosted graphite API key. Your API key can be found on your account home page.

You can also set the hosted graphite API key programatically with:

HostedGraphite.api_key = 'YOUR API KEY'

You may also specify a namespace for your metrics, which will be applied if you are using the StatsD backend:

HostedGraphite.namespace = 'our_app'

Sending a metric via UDP

HostedGraphite.protocol = :udp
HostedGraphite.send_metric('foo.udp', 1.2)

Sending a metric via TCP

HostedGraphite.protocol = :tcp
HostedGraphite.send_metric('foo.tcp', 1.2)

Sending a metric via HTTP

HostedGraphite.protocol = :http
HostedGraphite.send_metric('foo.http', 1.2)

HostedStatsD

Enable Statsd on your account

Ensure these line are present in your application's Gemfile:

gem 'hosted_graphite'
gem 'statsd-ruby'

Basic usage

HostedGraphite.protocol = :statsd
# Send some stats
HostedGraphite.increment 'page_views'
HostedGraphite.decrement 'likes_count'
HostedGraphite.timing 'foo', 320
HostedGraphite.gauge 'bar', 100

# Use {#time} to time the execution of a block
HostedGraphite.time('newsletter.monthly') { @newsletter.deliver_now }

Extensions

Sidekiq

require 'hosted_graphite/ext/sidekiq'

Sidekiq.configure_server do |config|
  config.server_middleware do |chain|
    # my_app is an optional namespace
    # chain.prepend HostedGraphite::Ext::Sidekiq::StatsdMetrics, 'my_app'
    # or
    # chain.prepend HostedGraphite::Ext::Sidekiq::Metrics
  end
end

Disable sends for local/test environments

HostedGraphite.enabled = false unless Rails.env.production?

Contributing

  • Fork it ( https://github.com/seuros/hosted_graphite/fork )
  • Create your feature branch (git checkout -b my-new-feature)
  • Commit your changes (git commit -am 'Add some feature')
  • Push to the branch (git push origin my-new-feature)
  • Create a new Pull Request

FAQs

Package last updated on 17 Dec 2016

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

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.