square / cubism

Cubism.js: A JavaScript library for time series visualization.

Home Page:https://square.github.com/cubism/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Don't lie when Graphite is missing 10-second data.

mbostock opened this issue · comments

Currently Graphite will return its lowest-resolution data when Cubism requests 10-second metrics; however, the lowest-available resolution may in fact be higher resolution (such as 1-minute data). Cubism, not knowing any better, displays this data inaccurately rather than upsampling the data.

I think this may be what's causing my data to graph strangely with Cubism. Is there some function I can apply on the Graphite side to fix the problem until Cubism has a fix?

You might be able to summarize(metric, "10s").

That worked, thanks!

Before all the data was compressed into the left-most 20% of the graph with blank space on the remaining 80%.

Now I'm getting a vertical bar one pixel wide, then several blank bars, then another bar, repeating in that pattern. But at least it fills the width of the graph.

I had this issue as well. Debugging found that if data in graphite needed to be rendered in seconds, Cubism was sending the request with milliseconds.

#21

This is most likely not the cause of the original issue. Just the one jeffcjohnson was talking about.

Thanks for letting me know and figuring out the problem!

Graphite returns the step interval in its raw data output. From http://graphite.wikidot.com/url-api-reference:

target1, startTime, endTime, step | value1, value2, ..., valueN
target2, startTime, endTime, step | value1, value2, ..., valueN

I had the same issue and after mbostock pointed me in the right direction I noticed that my step interval was 60 instead of 10. Maybe cubism can adjust based on that.

So what's the fix for this? I am using StatsD+Graphite with the default step value and all my values are squished to the left. If I use summarize(metric, "10s") I get vertical lines. Shouldn't Cubism realize how to show the values correctly?

diegovar - You might be able to use keepLastValue(summarize(metric, "10s")) to fill in those gaps. The problem with that is it will fill in legitimate gaps in data too.

The other problem with the keepLastValue(summarize(...)) approach seems to be that while it fills in the data on the first render of the page, new data does not have the gaps filled in.

Okay, simple and in hind-sight obvious fix to the above is to change the context.serverDelay to match the resolution of the dataset being summarized. For example if you have 1 minute resolution, set serverDelay to 60 * 1000