-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
support histograms #162
support histograms #162
Conversation
note that unlike traditional histograms which must have equally sized class intervals, here you can choose arbitrarily wide bins that even span to infinity, without any negative downside, should you want to. so this "bin categorisation" is actually more powerful and flexible as compared to being restricted to class intervals, but you can easily use it as a standard histogram too. |
in accordance with existing codebase, implement this in graphite backend
thoughts @mrtazz ? |
If I understand it correctly, this will add a metric for timers for every bin with the corresponding frequency into graphite. However, since bin sizes are configured statically in the config, they will only fit for a subset of the data. I'm not sure if this is really helpful? |
well, the only other alternative I can see is some rules system where we configure the bins by matching against metric paths (similar to the method in graphites' storage-schemas.conf). I would be fine adding this (and actually considered it), but it was my understanding we didn't want statsd that configurable. |
Yeah I think if we want to have histograms in StatsD, we need a way to define buckets based on the metrics path. I don't think they make sense otherwise. |
also modify an example to demonstrate
so, I just implemented that. I'm happily running this code and find it quite useful. pro tip it's super easy to get a relative frequency expressed as
|
@@ -152,7 +173,8 @@ var backend_status = function graphite_status(writeCb) { | |||
} | |||
}; | |||
|
|||
exports.init = function graphite_init(startup_time, config, events) { | |||
exports.init = function graphite_init(startup_time, conf, events) { | |||
config = conf |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you keep the pattern of pulling the config data in here like histogram = config.histogram
or is there a need to change this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I considered that, but IMHO a variable name like 'histogram' isn't a good name for "configuration data pertaining to histograms".
I also realized, as we add configurable behavior, it doesn't make much sense to split out bits of the config object into new objects, it also make things more complicated.
So I suggest that each backend just has a ref. to the full config object. that way new configurable logic can use the config data without needing to add more of these subsection = config.subsection
things
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
makes sense.
i updated this to be on par with master again. also I added a bunch of tests. |
freq += 1; | ||
} | ||
bin_name = ('bin_' + bins[bin_i]).replace('.','_'); | ||
current_timer_data[bin_name] = freq; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe it makes sense to namespace this under histogram? So that it get's added to something like current_timer_data["histogram"][bin_name]
, would make the namespace a bit more hierarchical.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good idea
@@ -54,7 +54,8 @@ function flushMetrics() { | |||
sets: sets, | |||
counter_rates: counter_rates, | |||
timer_data: timer_data, | |||
pctThreshold: pctThreshold | |||
pctThreshold: pctThreshold, | |||
histogram: config.histogram |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this doesn't work. It has to be conf
here. I was also wondering, since the example config puts it under the timer
key this should probably be conf.timer.histogram
. pctThreshold
is also in the wrong spot there and I need to fix it.
Thanks for all the integration work! Unfortunately the histogram sub-hierarchy (though it's good and we should keep it) breaks graphite sending, since there is now an Object and the backend sends e.g. |
|
@mrtazz does that last commit in histogram-config-refactor look allright? it demonstrates how i think the config should be passed around. then i'll add it to the histogram branch |
also slight optimisation in the metric setting loop for timers
Update to pull/209
…-integration Conflicts: backends/graphite.js exampleConfig.js
Awesome work! Thanks for taking the time to do this! |
@mrtazz it seems the "key name sanitation" never went in the graphite backend. so the decimal in the bin causes graphite to create a new dir.
|
support histograms
in accordance with existing codebase, implement this in graphite
backend