All Projects → cactus → Go Statsd Client

cactus / Go Statsd Client

Licence: mit
statsd client for Go

Programming Languages

go
31211 projects - #10 most used programming language
golang
3204 projects

Projects that are alternatives of or similar to Go Statsd Client

Cernan
telemetry aggregation and shipping, last up the ladder
Stars: ✭ 306 (+87.73%)
Mutual labels:  metrics, statsd
Banshee
Anomalies detection system for periodic metrics.
Stars: ✭ 1,045 (+541.1%)
Mutual labels:  metrics, statsd
Statsd Php
a PHP client for statsd
Stars: ✭ 327 (+100.61%)
Mutual labels:  metrics, statsd
Node Statsd Client
Node.js client for statsd
Stars: ✭ 170 (+4.29%)
Mutual labels:  metrics, statsd
Dipstick
Configurable metrics toolkit for Rust applications
Stars: ✭ 92 (-43.56%)
Mutual labels:  metrics, statsd
Statsd
Daemon for easy but powerful stats aggregation
Stars: ✭ 16,179 (+9825.77%)
Mutual labels:  metrics, statsd
Logmonitor
Monitoring log files on windows systems.
Stars: ✭ 23 (-85.89%)
Mutual labels:  metrics, statsd
Statix
Fast and reliable Elixir client for StatsD-compatible servers
Stars: ✭ 228 (+39.88%)
Mutual labels:  metrics, statsd
Python Prometheus Demo
Demo of using Prometheus for monitoring Python web applications
Stars: ✭ 83 (-49.08%)
Mutual labels:  metrics, statsd
Graylog Plugin Metrics Reporter
Graylog Metrics Reporter Plugins
Stars: ✭ 71 (-56.44%)
Mutual labels:  metrics, statsd
Statsd exporter
StatsD to Prometheus metrics exporter
Stars: ✭ 608 (+273.01%)
Mutual labels:  metrics, statsd
Foundatio
Pluggable foundation blocks for building distributed apps.
Stars: ✭ 1,365 (+737.42%)
Mutual labels:  metrics, statsd
Dcos Metrics
The metrics pipeline for DC/OS 1.9-1.11
Stars: ✭ 57 (-65.03%)
Mutual labels:  metrics, statsd
Amon
Amon is a modern server monitoring platform.
Stars: ✭ 1,331 (+716.56%)
Mutual labels:  metrics, statsd
Statsd Vis
Standalone StatsD server with built-in visualization
Stars: ✭ 124 (-23.93%)
Mutual labels:  metrics, statsd
Swiftmetrics
Swift Application Metrics instruments the Swift runtime for performance monitoring, providing the monitoring data programatically via an API or visually with an Eclipse Client.
Stars: ✭ 145 (-11.04%)
Mutual labels:  metrics
Appmetrics
App Metrics is an open-source and cross-platform .NET library used to record and report metrics within an application.
Stars: ✭ 1,986 (+1118.4%)
Mutual labels:  metrics
Nemetric
前端性能指标的监控,采集以及上报。用于测量第一个dom生成的时间(FP/FCP/LCP)、用户最早可操作时间(fid|tti)和组件的生命周期性能,,网络状况以及资源大小等等。向监控后台报告实际用户测量值。
Stars: ✭ 145 (-11.04%)
Mutual labels:  metrics
Telemetry metrics
Collect and aggregate Telemetry events over time
Stars: ✭ 144 (-11.66%)
Mutual labels:  metrics
Avalanche
Avalanche: a End-to-End Library for Continual Learning.
Stars: ✭ 151 (-7.36%)
Mutual labels:  metrics

go-statsd-client

Build Status GoDoc Go Report Card License

About

A StatsD client (UDP) for Go.

Docs

Viewable online at godoc.org.

Example

Some examples:

import (
    "log"

    "github.com/cactus/go-statsd-client/v5/statsd"
)

func main() {
    // First create a client config. Here is a simple config that sends one
    // stat per packet (for compatibility).
    config := &statsd.ClientConfig{
        Address: "127.0.0.1:8125",
        Prefix: "test-client",
    }

    /*
    // This one is for a client that re-resolves the hostname ever 30 seconds.
    // Useful if the address of a hostname changes frequently. Note that this
    // type of client has some additional locking overhead for safety.
    // As such, leave ResInetval as the zero value (previous exmaple) if you
    // don't specifically need this functionality.
    config := &statsd.ClientConfig{
        Address: "127.0.0.1:8125",
        Prefix: "test-client",
        ResInterval: 30 * time.Second,
    }

    // This one is for a buffered client, which sends multiple stats in one
    // packet, is recommended when your server supports it (better performance).
    config := &statsd.ClientConfig{
        Address: "127.0.0.1:8125",
        Prefix: "test-client",
        UseBuffered: true,
        // interval to force flush buffer. full buffers will flush on their own,
        // but for data not frequently sent, a max threshold is useful
        FlushInterval: 300*time.Millisecond,
    }

    // This one is for a buffered resolving client, which sends multiple stats
    // in one packet (like previous example), as well as re-resolving the
    // hostname every 30 seconds.
    config := &statsd.ClientConfig{
        Address: "127.0.0.1:8125",
        Prefix: "test-client",
        ResInterval: 30 * time.Second,
        UseBuffered: true,
        FlushInterval: 300*time.Millisecond,
    }

    // This one is an example of configuring "Tag" support
    // Supported formats are:
    //   InfixComma
    //   InfixSemicolon
    //   SuffixOctothorpe
    // The default, if not otherwise specified, is SuffixOctothorpe.
    config := &statsd.ClientConfig{
        Address: "127.0.0.1:8125",
        Prefix: "test-client",
        ResInterval: 30 * time.Second,
        TagFormat: statsd.InfixSemicolon,
    }
    */

    // Now create the client
    client, err := statsd.NewClientWithConfig(config)

    // and handle any initialization errors
    if err != nil {
        log.Fatal(err)
    }

    // make sure to close to clean up when done, to avoid leaks.
    defer client.Close()

    // Send a stat
    client.Inc("stat1", 42, 1.0)

    // Send a stat with "Tags"
    client.Inc("stat2", 41, 1.0, Tag{"mytag", "tagval"})
}

Legacy Example

A legacy client creation method is still supported. This is retained so as not to break or interrupt existing integrations.

import (
    "log"

    "github.com/cactus/go-statsd-client/v5/statsd"
)

func main() {
    // first create a client
    // The basic client sends one stat per packet (for compatibility).
    client, err := statsd.NewClient("127.0.0.1:8125", "test-client")

    // A buffered client, which sends multiple stats in one packet, is
    // recommended when your server supports it (better performance).
    // client, err := statsd.NewBufferedClient("127.0.0.1:8125", "test-client", 300*time.Millisecond, 0)

    // handle any errors
    if err != nil {
        log.Fatal(err)
    }
    // make sure to close to clean up when done, to avoid leaks.
    defer client.Close()

    // Send a stat
    client.Inc("stat1", 42, 1.0)
}

See docs for more info. There is also some additional example code in the test-client directory.

Contributors

See here.

Alternative Implementations

See the statsd wiki for some additional client implementations (scroll down to the Go section).

License

Released under the MIT license. See LICENSE.md file for details.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].