Giter Site home page Giter Site logo

dogstatsd-ruby's Introduction

dogstatsd-ruby

A client for DogStatsD, an extension of the StatsD metric server for Datadog. Full API documentation is available in DogStatsD-ruby rubydoc.

Build Status

See CHANGELOG.md for changes. To suggest a feature, report a bug, or general discussion, open an issue.

Installation

First install the library:

gem install dogstatsd-ruby

Configuration

To instantiate a DogStatsd client:

# Import the library
require 'datadog/statsd'

# Create a DogStatsD client instance.
statsd = Datadog::Statsd.new('localhost', 8125)

Or if you want to connect over Unix Domain Socket:

# Connection over Unix Domain Socket
statsd = Datadog::Statsd.new(socket_path: '/path/to/socket/file')

Find a list of all the available options for your DogStatsD Client in the DogStatsD-ruby rubydoc or in the Datadog public DogStatsD documentation.

Origin detection over UDP

Origin detection is a method to detect which pod DogStatsD packets are coming from in order to add the pod's tags to the tag list.

To enable origin detection over UDP, add the following lines to your application manifest

env:
  - name: DD_ENTITY_ID
    valueFrom:
      fieldRef:
        fieldPath: metadata.uid

The DogStatsD client attaches an internal tag, entity_id. The value of this tag is the content of the DD_ENTITY_ID environment variable, which is the pod’s UID.

Usage

In order to use DogStatsD metrics, events, and Service Checks the Agent must be running and available.

Metrics

After the client is created, you can start sending custom metrics to Datadog. See the dedicated Metric Submission: DogStatsD documentation to see how to submit all supported metric types to Datadog with working code examples:

Some options are suppported when submitting metrics, like applying a Sample Rate to your metrics or tagging your metrics with your custom tags. Find all the available functions to report metrics in the DogStatsD-ruby rubydoc.

Events

After the client is created, you can start sending events to your Datadog Event Stream. See the dedicated Event Submission: DogStatsD documentation to see how to submit an event to Datadog your Event Stream.

Service Checks

After the client is created, you can start sending Service Checks to Datadog. See the dedicated Service Check Submission: DogStatsD documentation to see how to submit a Service Check to Datadog.

Maximum packets size in high-throughput scenarios

In order to have the most efficient use of this library in high-throughput scenarios, default values for the maximum packets size have already been set for both UDS (8192 bytes) and UDP (1432 bytes) in order to have the best usage of the underlying network. However, if you perfectly know your network and you know that a different value for the maximum packets size should be used, you can set it with the parameter buffer_max_payload_size. Example:

# Create a DogStatsD client instance.
statsd = Datadog::Statsd.new('localhost', 8125, buffer_max_payload_size: 4096)

Credits

dogstatsd-ruby is forked from Rien Henrichs original Statsd client.

Copyright (c) 2011 Rein Henrichs. See LICENSE.txt for further details.

dogstatsd-ruby's People

Contributors

masci avatar jeremy avatar remeh avatar kbogtob avatar grosser avatar degemer avatar adrienjt avatar clutchski avatar gmmeyer avatar yannmh avatar elijahandrews avatar reinh avatar janester avatar albertvaka avatar kserrania avatar sullerandras avatar rtomayko avatar hush-hush avatar l0k0ms avatar misterbyrne avatar ahmed-mez avatar raykrueger avatar gleseur avatar jnunemaker avatar marcotc avatar nicolasleger avatar remh avatar tramfjord avatar leocavaille avatar amekss 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.