statsd

package
v0.0.0-...-ce7d19f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 7, 2013 License: MIT Imports: 5 Imported by: 0

README

StatsD Example Clients

Here's a bunch of example code contributed by the community for interfacing with statsd in a variety of languages.

Etsy/StatsD.pm    - perl module
perl-example.pl   - perl using Etsy/StatsD module
StatsdClient.java - JAVA
csharp_example.cs - C#
php-example.php   - PHP
python_example.py - Python
ruby_example.rb   - Ruby
statsd.erl        - Erlang
statsd-client.sh  - Bash
StatsD.scala      - Scala

Third Party StatsD Libraries

Client libraries have been written for various languages, and are listed on the Wiki.

Thankyou to all the contributors!

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type StatsdClient

type StatsdClient struct {
	Host string
	Port int
	// contains filtered or unexported fields
}

func New

func New(host string, port int) *StatsdClient

*

  • Factory method to initialize udp connection
  • Usage: *
  • import "statsd"
  • client := statsd.New('localhost', 8125) *

func (*StatsdClient) Close

func (client *StatsdClient) Close()

*

  • Method to close udp connection *

func (*StatsdClient) Decrement

func (client *StatsdClient) Decrement(stat string)

*

  • Decrements one stat counter without sampling
  • Usage: *
  • import "statsd"
  • client := statsd.New('localhost', 8125)
  • client.Decrement('foo.bar') *

func (*StatsdClient) DecrementWithSampling

func (client *StatsdClient) DecrementWithSampling(stat string, sampleRate float32)

*

  • Decrements one stat counter with sampling
  • Usage: *
  • import "statsd"
  • client := statsd.New('localhost', 8125)
  • client.Decrement('foo.bar', 0.2) *

func (*StatsdClient) Increment

func (client *StatsdClient) Increment(stat string)

*

  • Increments one stat counter without sampling
  • Usage: *
  • import "statsd"
  • client := statsd.New('localhost', 8125)
  • client.Increment('foo.bar') *

func (*StatsdClient) IncrementWithSampling

func (client *StatsdClient) IncrementWithSampling(stat string, sampleRate float32)

*

  • Increments one stat counter with sampling
  • Usage: *
  • import "statsd"
  • client := statsd.New('localhost', 8125)
  • client.Increment('foo.bar', 0.2) *

func (*StatsdClient) Open

func (client *StatsdClient) Open()

*

  • Method to open udp connection, called by default client factory *

func (*StatsdClient) Send

func (client *StatsdClient) Send(data map[string]string, sampleRate float32)

*

  • Sends data to udp statsd daemon *

func (*StatsdClient) Timing

func (client *StatsdClient) Timing(stat string, time int64)

* Log timing information (in milliseconds) without sampling * Usage: * * import "statsd" * import "time" * client := statsd.New('localhost', 8125) * t1 := time.Now() * expensiveCall() * t2 := time.Now() * duration := int64(t2.Sub(t1)/time.Millisecond) * client.Timing("foo.time", duration) *

func (*StatsdClient) TimingWithSampleRate

func (client *StatsdClient) TimingWithSampleRate(stat string, time int64, sampleRate float32)

*

  • Log timing information (in milliseconds) with sampling
  • Usage: *
  • import "statsd"
  • import "time"
  • client := statsd.New('localhost', 8125)
  • t1 := time.Now()
  • expensiveCall()
  • t2 := time.Now()
  • duration := int64(t2.Sub(t1)/time.Millisecond)
  • client.TimingWithSampleRate("foo.time", duration, 0.2) *

func (*StatsdClient) UpdateStats

func (client *StatsdClient) UpdateStats(stats []string, delta int, sampleRate float32)

*

  • Arbitrarily updates a list of stats by a delta *

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL