Giter VIP home page Giter VIP logo

go-statsd's People

Contributors

filippog avatar fossabot avatar horkhe avatar r0bertz avatar sean-ahn avatar smira avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

go-statsd's Issues

[STATSD] Error connecting to server: dial udp

Hello,

with your statsd client I can't send metrics to any statsd server. In my case it's telegraf on localhost:2002. I'm using go 1.13.

I tested it from cmd line via

$ echo "foobar.test,region=eu:$(shuf -i 10-999 -n 1)|ms" | nc -w 1 -u localhost 2002

This works.

`> select * from "foobar.test"
name: foobar.test
time count host lower mean metric_type region stddev sum upper


2019-09-23T13:04:10Z 1 jenkinssol 733 733 timing eu 0 733 733`

What am I doing wrong?

My code

`package main

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

func main() {
client := statsd.NewClient("localhost:2002",
statsd.MaxPacketSize(1400),
statsd.MetricPrefix("foobar."))

start := time.Now()
client.Incr("requests.http", 1)
client.PrecisionTiming("requests.route.api.latency", time.Since(start))

client.Close()

}`

Sample Rate

Are you planning to support setting the sample rate on the client?

Add tags

Hello,

yesterday i saw your keynote at GopherCon Russia 2018. Excellent work!

Please, add possibility to add tags, maybe as client Option:

InfluxDB tag format: ,tag1=payroll,region=us-west

Datadog tag format: |#tag1:value1,tag2:value2

It's boring to write every time c.incr('some.data,rack=v6,region=eu,switch=12') ;)

Thanks!

Recommended initialization values - dropping packets?

I've been trying out the library in a component that receives periodic remote writes from prometheus, converts metrics and forwards to a statsd(udp) destination. With the default initialization, I've been observing logs from the library indicating packet loss.
I then tried bumping up the buffer pool capacity, send queue capacity and the send loop, after which these error logs disappeared, but I'm still observing a small amount of dropped metrics in the destination.
Is this something anyone else has observed?

Okmeter tag format

Hello!
Could you add an okmeter tag support?
I guess I can't simply use basic TagFormat because separator is a string _is_

make `Tag` and `TagType` public

// Tag types
const (
	typeString = iota
	typeInt64
)

// Tag is metric-specific tag
type Tag struct {
	name     string
	strvalue string
	intvalue int64
	typ      byte
}

We need to sanitize tag names and values.

Integrate with telegraf and grafana to visualize EPS

Hello.
I'm using your go-statsd to count events in my logs shipper app.
Everytimes it receives an event, it increases stat.inputEvents by one. Then, every second, I push that counter to telegraf server. Then, I use grafana to visualize this stat:
SELECT "value" FROM "stat_inputEvents" WHERE $timeFilter GROUP BY time($interval)

My settings is:
statsd.NewClient(statsdHost + ":" + strconv.Itoa(statsdPort), statsd.MaxPacketSize(400), statsd.MetricPrefix(""), statsd.FlushInterval(time.Second))

Since I flush it every second. Shouldn't this graph show Events Per Second of my shipper?
But it has almost 300k EPS average while the source that provides events to my shipper only has 60k EPS...
Can you tell me what I did wrong here please? Thank you so much!

Panic in reportLoop when built with GOARCH=386

When build with GOARCH=386 I get this whenever reportLoop ticks:

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x8049fcc]
goroutine 8 [running]:
runtime/internal/atomic.Xchg64(0xa8794e4, 0x0, 0x0, 0x1, 0x1)
	/usr/local/go/src/runtime/internal/atomic/asm_386.s:151 +0xc
github.com/smira/go-statsd.(*transport).reportLoop(0xa8794a0, 0xf8475800, 0xd, 0x85bf3f0, 0xa8568d0)
	/usr/src/app/vendor/github.com/smira/go-statsd/loops.go:161 +0x111
created by github.com/smira/go-statsd.NewClient
	/usr/src/app/vendor/github.com/smira/go-statsd/client.go:112 +0x3f7

Fortunately I can just switch to amd64 and it works

What is the major difference between ReconnectInterval and RetryTimeout ? Both seems to be same type of property for a statsd client

// ReconnectInterval controls UDP socket reconnects
//
// Reconnecting is important to follow DNS changes, e.g. in
// dynamic container environments like K8s where statsd server
// instance might be relocated leading to new IP address.
//
// By default reconnects are disabled
func ReconnectInterval(interval time.Duration) Option {
	return func(c *ClientOptions) {
		c.ReconnectInterval = interval
	}
}

// RetryTimeout controls how often client should attempt reconnecting
// to statsd server on failure
//
// Default value is 5 seconds
func RetryTimeout(timeout time.Duration) Option {
	return func(c *ClientOptions) {
		c.RetryTimeout = timeout
	}
}

Making the Logger Configurable

Hey all,

Is there any interest in making the logger here configurable? I want to use go-statsd but am logging out to structured JSON and would like to use the library with different loggers. I'd be happy to contribute this if it's something the maintainer would accept.

Add ability to modify the global tags

I would like to be able to make new clients from an existing one, which extended global tags.

client := statsd.NewClient(statsd.DefaultTags(statsd.StringTag("foo", "bar")))

extra := []statsd.Tags{statsd.StringTag("url", "/foo")}
child := client.WithTags(extra...)

child.Incr("counter", 10) // Tags: foo=bar,url=/foo

let me know what you are your thoughts.

Float support?

Hi!
thanks for this statsd golang client! I'm using it and noticed there's no support for float gauges/counters, is this something you'd be interested in having?

Is the project still alive?

A project I'm working on is reviewing different StatsD client implementations.

Is this client maintained, or should I opt for another?

Closing a client with invalid host hangs forever

Hi!

I ran into a weird issue running this piece of code:

package main

import (
	"log"

	"github.com/smira/go-statsd"
)

func main() {
	client := statsd.NewClient("BOOM:BOOM")
	if err := client.Close(); err != nil {
		log.Fatalf("could not close, but got error: %v", err)
	}
	log.Print("all good!")
}

It hangs forever (apparently) saying:

[STATSD] 2019/05/15 18:33:38 [STATSD] Error connecting to server: dial udp: address udp/BOOM: unknown port

I would have expected Close() to return an error, maybe telling me the address is incorrect or that it cannot be resolved.

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.