Coder Social home page Coder Social logo

adhearsion-stats's Introduction

πŸ’Ž

Find me at:

Liberal AF: #BLM #LGBTQ πŸ‡ΊπŸ‡¦

πŸ–• Fuck Trump, Fuck Putin πŸ–•

adhearsion-stats's People

Contributors

bklang avatar justinaiken avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

bklang emcgee

adhearsion-stats's Issues

Namespace probes

I'm not sure if this belongs in the library hard-coded, should be config, or should be left up to the Application exclusively. But I did something like this to namespace my probes to make it easier to separate development from production. This module was mixed in so that every call go #gauge, #increment or #timing had prefixes:

module CoreUtility
  def gauge(*args)
    AdhearsionStats.gauge prefixed_label(args.shift), *args
  end

  def increment(*args)
    # Increment gets a special label so it shows up in Graphite at a similar
    # nesting level to timers and gauges
    AdhearsionStats.increment "counters.#{prefixed_label(args.shift)}", *args
  end

  def timing(*args)
    label = prefixed_label args.shift
    if block_given?
      start = Time.now
      yield
      value = Time.now - start
    else
      value = args.shift
    end
    AdhearsionStats.timing label, value
  end

  def prefixed_label(label)
    "#{Adhearsion.config.platform.environment}.#{node_name}.#{label}"
  end

  def node_name
    @node_name ||= Socket.gethostname.split('.').first
  end
end

Should hook into Adhearsion's Statistics class

Would be cool if there was an option to hook into Adhearsion::Statistics with this plugin, so that graphite could graph all those stats with no programming needed on the users part...

  • Perhaps monkey-patch these 4 methods
  • Or maybe alias Celluloid::Actor[:statistics] to Celluloid::Actor[:statistics_original] and insert our own Celluloid::Actor[:statistics] that also sends stats.
  • Or maybe leave the built in stats alone, and just register our own event handlers in a similar fashion..

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.