GithubHelp home page GithubHelp logo

datadog-go's Introduction

Build Status

Datadog Go

Godoc license

datadog-go is a library that provides a DogStatsD client in Golang.

Go 1.7+ is officially supported. Older versions might work but are not tested.

The following documentation is available:

Installation

Get the code with:

$ go get github.com/DataDog/datadog-go/statsd

Then create a new DogStatsD client:

package main

import (
    "log"
    "github.com/DataDog/datadog-go/statsd"
)

func main() {
    statsd, err: = statsd.New("127.0.0.1:8125")
    if err != nil {
        log.Fatal(err)
    }
}

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

Supported environment variables

  • If the addr parameter is empty, the client uses the DD_AGENT_HOST and (optionally) the DD_DOGSTATSD_PORT environment variables to build a target address.
  • If the DD_ENTITY_ID environment variable is found, its value is injected as a global dd.internal.entity_id tag. The Datadog Agent uses this tag to insert container tags into the metrics. To avoid overwriting this global tag, only append to the c.Tags slice.

To enable origin detection and set the DD_ENTITY_ID environment variable, add the following lines to your application manifest:

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

Unix Domain Sockets Client

Agent v6+ accepts packets through a Unix Socket datagram connection. Details about the advantages of using UDS over UDP are available in the DogStatsD Unix Socket documentation. You can use this protocol by giving a unix:///path/to/dsd.socket address argument to the New constructor.

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 Datadog Go client GoDoc documentation.

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 your Datadog 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.

Performance / Metric drops

Monitoring this client

This client automatically injects telemetry about itself in the DogStatsD stream. Those metrics will not be counted as custom and will not be billed. This feature can be disabled using the WithoutTelemetry option.

See Telemetry documentation to learn more about it.

Tweaking kernel options

In very high throughput environments it is possible to improve performance by changing the values of some kernel options.

Unix Domain Sockets

  • sysctl -w net.unix.max_dgram_qlen=X - Set datagram queue size to X (default value is usually 10).
  • sysctl -w net.core.wmem_max=X - Set the max size of the send buffer for all the host sockets.

Development

Run the tests with:

$ go test

License

datadog-go is released under the MIT license.

Credits

Original code by ooyala.

datadog-go's People

Contributors

ahmed-mez avatar arbll avatar cihangir avatar colega avatar cswatt avatar hush-hush avatar jbarciauskas avatar jeerim avatar jmoiron avatar jovanbrakus avatar l0k0ms avatar leocavaille avatar masci avatar remh avatar sidgopalan avatar sjung-stripe avatar skaji avatar sschepens avatar talwai avatar tariq1890 avatar theckman avatar thedevsaddam avatar thomas91310 avatar truthbk avatar tummychow avatar w-vi avatar wackywendell avatar xsleonard avatar xvello avatar yutachaos avatar

Watchers

 avatar  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.