statsd

package module
v1.0.14-b7df1f3 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2021 License: MIT Imports: 3 Imported by: 0

README

go-statsd

Build Status GoDoc Go Report card

Purpose

Simple Statsd implementation

Usage

package main

import (
    statsd "github.com/cameronnewman/go-statsd"
)

func main() {

    metrics, err := statsd.New(&statsd.Options{
        Host:      "127.0.0.1",
        Port:      9191,
        Namespace: "myapp",
    })
    if err != nil {
        panic(err)
    }

    err = metrics.Counter("Starting", 1)
    if err != nil {
        panic(err)
    }
}

Issues

  • None

License

MIT Licensed

Documentation

Overview

Package statsd is simple statsd warpper.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Metrics

type Metrics interface {
	Counter(key string, value int64)
	Gauge(key string, value int64)
	Timing(key string, start time.Time)
	TimingDuration(key string, duration time.Duration)
}

Metrics interface

type Options

type Options struct {
	Host      string `json:"host"`
	Port      int    `json:"port"`
	Namespace string `json:"namespace"`
}

Options for statsd

type Statsd

type Statsd struct {
	// contains filtered or unexported fields
}

Statsd used to monitor and measure performance

func New

func New(opt *Options) (*Statsd, error)

New creates a statsd client instance

func (*Statsd) Counter

func (s *Statsd) Counter(key string, value int64) error

Counter increase counter for key

func (*Statsd) Gauge

func (s *Statsd) Gauge(key string, value int64) error

Gauge gauge for key

func (*Statsd) Timing

func (s *Statsd) Timing(key string, start time.Time) error

Timing measure for key

func (*Statsd) TimingDuration

func (s *Statsd) TimingDuration(key string, duration time.Duration) error

TimingDuration measures duration for key

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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