Skip to content
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

cmd/bosun: Don't create filter in Opentsdb v2.1 #1569

Merged
merged 3 commits into from
Jan 26, 2016
Merged
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
3 changes: 2 additions & 1 deletion build/validate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ if [ "$GOGENERATEDIFF" != '' ]; then
echo "$GOGENERATEDIFF"
BUILDMSG="${BUILDMSG}go generate needs to run. "
GOGENERATEDIFFRESULT=1
git diff
fi

echo -e "\nRunning go test bosun.org/..."
Expand All @@ -77,4 +78,4 @@ if [ "$TRAVIS" != '' ]; then
fi

let "RESULT = $GOBUILDRESULT | $GOFMTRESULT | $GOVETRESULT | $GOTESTRESULT | $GOGENERATERESULT | $GOGENERATEDIFFRESULT"
exit $RESULT
exit $RESULT
996 changes: 499 additions & 497 deletions cmd/bosun/web/static.go

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion cmd/bosun/web/static/js/0-bosun.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ bosunControllers.controller('BosunCtrl', ['$scope', '$route', '$http', '$q', '$r
};
$scope.req_from_m = (m: string) => {
var r = new Request();
var q = new Query();
var q = new Query(false);
q.metric = m;
r.queries.push(q);
return r;
Expand Down
46 changes: 24 additions & 22 deletions cmd/bosun/web/static/js/bosun.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ bosunControllers.controller('BosunCtrl', ['$scope', '$route', '$http', '$q', '$r
};
$scope.req_from_m = function (m) {
var r = new Request();
var q = new Query();
var q = new Query(false);
q.metric = m;
r.queries.push(q);
return r;
Expand Down Expand Up @@ -1776,7 +1776,7 @@ var FilterMap = (function () {
return FilterMap;
})();
var Query = (function () {
function Query(q) {
function Query(filterSupport, q) {
this.aggregator = q && q.aggregator || 'sum';
this.metric = q && q.metric || '';
this.rate = q && q.rate || false;
Expand All @@ -1803,16 +1803,18 @@ var Query = (function () {
this.nGbFilters = q && q.nGbFilters || new FilterMap;
var that = this;
// Copy tags with values to group by filters so old links work
_.each(this.tags, function (v, k) {
if (v === "") {
return;
}
var f = new (Filter);
f.filter = v;
f.groupBy = true;
f.tagk = k;
that.gbFilters[k] = f;
});
if (filterSupport) {
_.each(this.tags, function (v, k) {
if (v === "") {
return;
}
var f = new (Filter);
f.filter = v;
f.groupBy = true;
f.tagk = k;
that.gbFilters[k] = f;
});
}
this.setFilters();
this.setDs();
this.setDerivative();
Expand Down Expand Up @@ -1919,7 +1921,7 @@ bosunControllers.controller('GraphCtrl', ['$scope', '$http', '$location', '$rout
$scope.sorted_tagks = [];
$scope.query_p = [];
angular.forEach(request.queries, function (q, i) {
$scope.query_p[i] = new Query(q);
$scope.query_p[i] = new Query($scope.filterSupport, q);
});
$scope.start = request.start;
$scope.end = request.end;
Expand Down Expand Up @@ -1966,7 +1968,7 @@ bosunControllers.controller('GraphCtrl', ['$scope', '$http', '$location', '$rout
};
$scope.AddTab = function () {
$scope.index = $scope.query_p.length;
$scope.query_p.push(new Query);
$scope.query_p.push(new Query($scope.filterSupport));
};
$scope.setIndex = function (i) {
$scope.index = i;
Expand Down Expand Up @@ -2071,7 +2073,7 @@ bosunControllers.controller('GraphCtrl', ['$scope', '$http', '$location', '$rout
if (!p.metric) {
return;
}
var q = new Query(p);
var q = new Query($scope.filterSupport, p);
var tags = q.tags;
q.tags = new TagSet;
if (!$scope.filterSupport) {
Expand Down Expand Up @@ -2285,7 +2287,7 @@ bosunControllers.controller('HostCtrl', ['$scope', '$http', '$location', '$route
var currentURL = $location.url();
$scope.mlink = function (m) {
var r = new Request();
var q = new Query();
var q = new Query(false);
q.metric = m;
q.tags = { 'host': $scope.host };
r.queries.push(q);
Expand Down Expand Up @@ -2315,7 +2317,7 @@ bosunControllers.controller('HostCtrl', ['$scope', '$http', '$location', '$route
var cpu_r = new Request();
cpu_r.start = $scope.time;
cpu_r.queries = [
new Query({
new Query(false, {
metric: 'os.cpu',
derivative: 'counter',
tags: { host: $scope.host }
Expand All @@ -2331,11 +2333,11 @@ bosunControllers.controller('HostCtrl', ['$scope', '$http', '$location', '$route
});
var mem_r = new Request();
mem_r.start = $scope.time;
mem_r.queries.push(new Query({
mem_r.queries.push(new Query(false, {
metric: "os.mem.total",
tags: { host: $scope.host }
}));
mem_r.queries.push(new Query({
mem_r.queries.push(new Query(false, {
metric: "os.mem.used",
tags: { host: $scope.host }
}));
Expand All @@ -2351,7 +2353,7 @@ bosunControllers.controller('HostCtrl', ['$scope', '$http', '$location', '$route
var net_bytes_r = new Request();
net_bytes_r.start = $scope.time;
net_bytes_r.queries = [
new Query({
new Query(false, {
metric: "os.net.bytes",
rate: true,
rateOptions: { counter: true, resetValue: 1 },
Expand Down Expand Up @@ -2383,11 +2385,11 @@ bosunControllers.controller('HostCtrl', ['$scope', '$http', '$location', '$route
var fs_r = new Request();
fs_r.start = $scope.time;
fs_r.queries = [
new Query({
new Query(false, {
metric: "os.disk.fs.space_total",
tags: { host: $scope.host, disk: "*" }
}),
new Query({
new Query(false, {
metric: "os.disk.fs.space_used",
tags: { host: $scope.host, disk: "*" }
})
Expand Down
30 changes: 16 additions & 14 deletions cmd/bosun/web/static/js/graph.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class Query {
ds: string;
dstime: string;
derivative: string;
constructor(q?: any) {
constructor(filterSupport: boolean, q?: any) {
this.aggregator = q && q.aggregator || 'sum';
this.metric = q && q.metric || '';
this.rate = q && q.rate || false;
Expand All @@ -67,16 +67,18 @@ class Query {
this.nGbFilters = q && q.nGbFilters || new FilterMap;
var that = this;
// Copy tags with values to group by filters so old links work
_.each(this.tags, function(v, k) {
if (v === "") {
return
}
var f = new(Filter);
f.filter = v;
f.groupBy = true;
f.tagk = k;
that.gbFilters[k] = f;
});
if (filterSupport) {
_.each(this.tags, function(v, k) {
if (v === "") {
return
}
var f = new(Filter);
f.filter = v;
f.groupBy = true;
f.tagk = k;
that.gbFilters[k] = f;
});
}
this.setFilters();
this.setDs();
this.setDerivative();
Expand Down Expand Up @@ -231,7 +233,7 @@ bosunControllers.controller('GraphCtrl', ['$scope', '$http', '$location', '$rout
$scope.sorted_tagks = [];
$scope.query_p = [];
angular.forEach(request.queries, (q, i) => {
$scope.query_p[i] = new Query(q);
$scope.query_p[i] = new Query($scope.filterSupport, q);
});
$scope.start = request.start;
$scope.end = request.end;
Expand Down Expand Up @@ -278,7 +280,7 @@ bosunControllers.controller('GraphCtrl', ['$scope', '$http', '$location', '$rout
}
$scope.AddTab = function() {
$scope.index = $scope.query_p.length;
$scope.query_p.push(new Query);
$scope.query_p.push(new Query($scope.filterSupport));
};
$scope.setIndex = function(i: number) {
$scope.index = i;
Expand Down Expand Up @@ -382,7 +384,7 @@ bosunControllers.controller('GraphCtrl', ['$scope', '$http', '$location', '$rout
if (!p.metric) {
return;
}
var q = new Query(p);
var q = new Query($scope.filterSupport, p);
var tags = q.tags;
q.tags = new TagSet;
if (! $scope.filterSupport) {
Expand Down
14 changes: 7 additions & 7 deletions cmd/bosun/web/static/js/host.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ bosunControllers.controller('HostCtrl', ['$scope', '$http', '$location', '$route
var currentURL = $location.url();
$scope.mlink = (m: string) => {
var r = new Request();
var q = new Query();
var q = new Query(false);
q.metric = m;
q.tags = { 'host': $scope.host };
r.queries.push(q);
Expand Down Expand Up @@ -56,7 +56,7 @@ bosunControllers.controller('HostCtrl', ['$scope', '$http', '$location', '$route
var cpu_r = new Request();
cpu_r.start = $scope.time;
cpu_r.queries = [
new Query({
new Query(false, {
metric: 'os.cpu',
derivative: 'counter',
tags: { host: $scope.host },
Expand All @@ -72,11 +72,11 @@ bosunControllers.controller('HostCtrl', ['$scope', '$http', '$location', '$route
});
var mem_r = new Request();
mem_r.start = $scope.time;
mem_r.queries.push(new Query({
mem_r.queries.push(new Query(false, {
metric: "os.mem.total",
tags: { host: $scope.host },
}));
mem_r.queries.push(new Query({
mem_r.queries.push(new Query(false, {
metric: "os.mem.used",
tags: { host: $scope.host },
}));
Expand All @@ -92,7 +92,7 @@ bosunControllers.controller('HostCtrl', ['$scope', '$http', '$location', '$route
var net_bytes_r = new Request();
net_bytes_r.start = $scope.time;
net_bytes_r.queries = [
new Query({
new Query(false, {
metric: "os.net.bytes",
rate: true,
rateOptions: { counter: true, resetValue: 1 },
Expand Down Expand Up @@ -123,11 +123,11 @@ bosunControllers.controller('HostCtrl', ['$scope', '$http', '$location', '$route
var fs_r = new Request();
fs_r.start = $scope.time
fs_r.queries = [
new Query({
new Query(false, {
metric: "os.disk.fs.space_total",
tags: { host: $scope.host, disk: "*"},
}),
new Query({
new Query(false, {
metric: "os.disk.fs.space_used",
tags: { host: $scope.host, disk: "*"},
})
Expand Down