square / cubism

Cubism.js: A JavaScript library for time series visualization.
https://square.github.com/cubism/
Other
4.94k stars 526 forks source link

Improve librato source #70

Closed cyberdelia closed 10 years ago

cyberdelia commented 10 years ago

The current librato source retrieve all data from a metric, and then filter by source, but if you have many sources this will be very slow and inefficient.

This use librato composite metric feature to be able to do retrieve a metrics/sources in one call, so this will make librato API look like this:

var context = cubism.context(), // a default context
    librato = context.librato("foo@gmail.com", "8585ae5c30d55ddef4");

var metrics = librato.metric("sum(series(\"hgsc_cpu_used\",  \"ardmore\"))");
josephruscio commented 10 years ago

:+1: from @librato

RandomEtc commented 10 years ago

LGTM. I'll try to merge/rebuild and push a new version tonight, if I have all the right things to hand :)

cyberdelia commented 10 years ago

@RandomEtc Let me remove logging maybe?

cyberdelia commented 10 years ago

@RandomEtc Here you go.

josephruscio commented 10 years ago

@cyberdelia is there any appropriate place we could document using the composites, even something as simple as the example you put in the PR description?

cyberdelia commented 10 years ago

@josephruscio The related wiki page, otherwise ask @RandomEtc.

RandomEtc commented 10 years ago

Yes, please edit the wiki (let me know if you can't). Otherwise, if you have more time, some thoughtful additions/edits to the gh-pages branch would also be appropriate (powers http://square.github.io/cubism/).

RandomEtc commented 10 years ago

Merged and published 1.6.0. Thanks!

Please test and lend a hand if anyone is bent out of shape by the API change :grin:

josephruscio commented 10 years ago

@RandomEtc I just updated the wiki and included a link to the composite metric documentation on our site. Feel free to /cc me on any issues filed against this, but this is a massive improvement so I think it should be straightforward to move people forward.

@cyberdelia thanks again!