Code Monkey home page Code Monkey logo

Comments (5)

pkieltyka avatar pkieltyka commented on August 24, 2024

Yes, please offer more documentation.. I was just trying this with stathat / librato, and I had to read the code to figure out how to use the lib. Nice work tho.

from go-metrics.

Dieterbe avatar Dieterbe commented on August 24, 2024

Would it make sense for me to implement a sliding window reservoir for my "what's the data been in the last X minutes" use? Since I only update the histogram once a second it's not that much data.

yes please. note that coda hale's "Sliding Window Reservoirs" doc says A histogram with a sliding window reservoir produces quantiles which are representative of the past N measurements.
i.e. N measurements, not N seconds or minutes.

I report my metrics every second to graphite, and so i want my timers's min/max/percentiles/etc to be a reflection of the past second. (I would be happy with a solution wether it samples or not).
This is basically the same as @abh's request. I read the coda hale docs but couldn't really find how to do it. the documentation for the go-metrics exp decay window is a 12 page paper, and for the uniform sampling one is a 21 page paper.

from go-metrics.

Dieterbe avatar Dieterbe commented on August 24, 2024

@abh:
i read the exponential forward decay paper, and I understand about half of it.
the implementation seems a bit confusing, as far as i understand t0 = landmark L and alpha actually seems to be lambda in the formula. there's some other stuff with the implementation i don't get (like it doesn't seem to do the negation like in the official formula) but anyway in your example
metrics.NewExpDecaySample(600, 0.015) if understand correctly what's going on, 0.015 seems like a very low alpha value, try something like 0.5 or 0.8 instead of 0.015, maybe that's why it retains so much information. also this doesn't really solve the problem of "only process points from within the last X seconds/minutes", because it does exponential decay.

the algorithm R was a bit easier to understand, but also doesn't seem to do what we want. I don't think either algorithm does what we want, although in the forward decay paper there's mention of a window-based decay. That seems to be what we need, but there's no implementation yet for it, that I can see. so maybe we should give that a shot.

another thing I noticed, the R algorithm, once past the initial reservoirsize of samples uses a TRUNC function, and depending on the outcome of that, adds or doesn't add the new value to the reservoir. they don't explain what TRUNC is supposed to do but it looks like they select an array pos between 0 and current-timestamp, which may or may not be a valid index of the reservoir. only if it fits in the reservoir, do they add the value. The go-metrics code on the other hand, always adds the new value, which seems more like what we want, but interesting that there's this difference. they later optimize this by skipping over records (which go-metrics doesn't do).

so I'm thinking of either attempting to implement the windowing variant of the forward decay function,
or perhaps a very simplistic sample container that reset itself after it takes a snapshot (so that at every snapshot, you get the values since the last snapshot). obviously if you have multiple reporters running at the same time this would need more fine tuning.

from go-metrics.

mihasya avatar mihasya commented on August 24, 2024

Anyone fancy at least a simple PR improving the explanation for how that stuff works? Perhaps a brave soul that has read the paper? @Dieterbe

from go-metrics.

mihasya avatar mihasya commented on August 24, 2024

(combining with #97 )

from go-metrics.

Related Issues (20)

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.