peterbourgon / g2s Goto Github PK
View Code? Open in Web Editor NEWGet to Statsd: forward simple statistics to a statsd server
Home Page: http://godoc.org/github.com/peterbourgon/g2s
License: BSD 2-Clause "Simplified" License
Get to Statsd: forward simple statistics to a statsd server
Home Page: http://godoc.org/github.com/peterbourgon/g2s
License: BSD 2-Clause "Simplified" License
Howdy - Love g2s. Was using g2s.New to pass in my own buffered io.Writer implementation so I could send multiple commands in one underlying write call. statsd was complaining and I realized eventually it was because the \n was not being sent.
Tracked it down to this line of code which is a function of dealing with larger than 64K messages:
https://github.com/peterbourgon/g2s/blob/master/g2s.go#L69
Simply getting rid of the -1 got things working. The reference implementation of statsd supports mulitple commands per packet deliminated by newline so this should get that working.
I can send a pull request if you like.
Please, consider prefix feature from https://github.com/cactus/go-statsd-client
it adds a prefix to all bucket names.
I'm doing some basic testing with g2s, and am using a non-existent StatsD instance in my application for the moment, but I'm getting errors from g2s that the connection was refused, for example:
2013/09/30 13:19:05 g2s: publish: write udp 127.0.0.1:8125: connection refused
I was under the impression that because UDP is stateless, g2s shouldn't be aware of whether it can "connect" to that port, and should blindly fire off requests to it? I don't want to have an error log filled up with StatsD calls in environments where I don't plan to have a StatsD server listening at the other end.
The code making the requests is here: https://github.com/WheresWardy/go-airbrake-proxy/blob/70e93348800ca8b481265ae5017cae637581e7d2/server.go - interestingly it only seems to be the second Timing()
call that throws the connection error.
Statsd timing can be used for not only measuring time, but also other statistical values where you need automatically calculated count, mean, sum, upper etc.
I have added such function in my fork, where you can pass int instead of time.Duration and it is not divided from nanoseconds to milliseconds:
If you think it can be useful for anybody else, then I can update Readme.md and do Pull Request.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.