Git Product home page Git Product logo

carbonclient's Introduction

Carbonclient

This is a lightweight client for the Graphite data interface called Carbon. I created this specifically to feed in batches of data using the "pickle" protocol, so that is the only method currently supported.

More details about Carbon and the pickle protocol can be found in the Graphite docs.

Feeding data

Create a client using the IP and port of your Graphite/Carbon server:

client := carbonclient.NewCarbonClient("192.168.10.100", carbonclient.PICKLE_PORT)

NB: only the pickle protocol is supported, and the default port is available as a package-level constant as demonstrated above.

Compose your stats as []carbonclient.TimedMetric. Each metric has a Path, and a Value. The Value must be an instance of carbonclient.TimedMetricValue:

var stats []carbonclient.TimedMetric

stats = append(stats,
  carbonclient.TimedMetric{
    Path: "stats.gauges.widgetcount",
    Value: carbonclient.TimedMetricValue{
      Timestamp: time.Now(),
      Value:     42}})

The intended purpose of the Carbon pickle protocol is to send data collected in the past, but for the purposes of illustration, time.Now() is used above.

Finally, send the stats!

err := client.SendMetrics(stats[:])
if err != nil {
  panic(err)
}

License

        DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE 
                    Version 2, December 2004 

 Copyright (C) 2004 Sam Hocevar <[email protected]> 

 Everyone is permitted to copy and distribute verbatim or modified 
 copies of this license document, and changing it is allowed as long 
 as the name is changed. 

            DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE 
   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 

  0. You just DO WHAT THE FUCK YOU WANT TO.

carbonclient's People

Contributors

aaronbieber avatar

Watchers

 avatar

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.