Skip to content
This repository was archived by the owner on Jan 19, 2022. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ This project should still be considered beta software. There are known performan

Dusk is designed to be simple and purpose-driven. Any string passed to the `/metrics/` endpoint (including wildcards) will be used as the search context. All metrics found by the Graphite server will be returned and rendered live.

For example, loading `/metrics/collectd.*.load.load.shortterm` will render the `shortterm` metric for all servers in your Graphite instance. Adding the `index` param to your URL defines which (zero-indexed) node should be used as the metric alias.
For example, loading `/metrics/collectd.*.load.load.shortterm` will render the `shortterm` metric for all servers in your Graphite instance. Adding the `index` param to your URL defines which (zero-indexed) node should be used as the metric alias. (You can also specify multiple nodes with comma like `?index=1,3,5`.)

![usage](https://github.com/obfuscurity/dusk/raw/master/lib/dusk/public/img/screenshot-usage.png)

Expand Down
10 changes: 8 additions & 2 deletions lib/dusk/public/js/dusk.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,14 @@ var Dusk = function(target) {
var metrics = []
for (var i=0; i<results.length; i++) {
var metric = myGraphite.metric(results[i])
var index = (myNameIndex === '') ? 1 : myNameIndex
metric.alias(results[i].split('.')[index])
var index = (myNameIndex === '') ? '1' : myNameIndex
var alias = '';
var resultsArr = results[i].split('.');
index.split(',').forEach(function(ind) {
if(alias.length > 0) { alias += '.'; }
alias += resultsArr[parseInt(ind,10)];
});
metric.alias(alias);
metrics.push(metric)
}
d3.select('div.wrapper').selectAll('.horizon')
Expand Down