Giter Site home page Giter Site logo

peterbourgon / g2s Goto Github PK

View Code? Open in Web Editor NEW
149.0 149.0 26.0 23 KB

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

Shell 4.77% Go 95.23%

g2s's People

Contributors

bbigras avatar braintreeps avatar peterbourgon avatar xla 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

g2s's Issues

Code is stripping \n

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.

udp connection refused error

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.

Send ints as Timing

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:

oskarwojciski@e0e201f

If you think it can be useful for anybody else, then I can update Readme.md and do Pull Request.

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.