Moving everythign to the new data format

Original commit: elastic/x-pack-elasticsearch@b35c192536
This commit is contained in:
Chris Cowan 2015-08-06 15:30:05 -07:00
parent 86ebd14587
commit c21ca69acd
9 changed files with 24 additions and 25 deletions

View File

@ -1,4 +1,3 @@
public
agent
node_modules
bower_components

View File

@ -18,7 +18,7 @@ module.exports = function (fixture) {
function createEntries(row) {
var index = workingDate.format(indexPattern);
var entry = { '@timestamp': workingDate.toISOString() };
var entry = { 'timestamp': workingDate.toISOString() };
row.forEach(function (val, index) {
_.set(entry, fields[index], val);
});

View File

@ -10,7 +10,7 @@ module.exports = function testNoExecute(options, message, generateRawData) {
var fixture = {
indexPattern: options.indexPattern,
type: options.type,
dateField: '@timestamp',
dateField: 'timestamp',
rawData: rawData
};
return executeWatcher(options.watcher, fixture).then(function (resp) {

View File

@ -22,12 +22,12 @@ describe('Marvel Watchers', function () {
this.timeout(5000);
var workingDate = moment.utc();
var rawData = _.times(12, function () {
return { '@timestamp': workingDate.subtract(5, 's').format(), status: 'red' };
return { 'timestamp': workingDate.subtract(5, 's').format(), status: 'red' };
});
var fixture = {
indexPattern: '[.marvel-]YYYY.MM.DD',
type: 'cluster_stats',
dateField: '@timestamp',
dateField: 'timestamp',
rawData: rawData
};
return executeWatcher('cluster_status', fixture).then(function (resp) {
@ -54,10 +54,10 @@ describe('Marvel Watchers', function () {
testNoExecute('Red for 55 then Yellow for 60 seconds', function () {
var workingDate = moment.utc();
var rawData = _.times(11, function () {
return { '@timestamp': workingDate.subtract(5, 's').format(), status: 'red' };
return { 'timestamp': workingDate.subtract(5, 's').format(), status: 'red' };
});
rawData.concat(_.times(12, function () {
return { '@timestamp': workingDate.subtract(5, 's').format(), status: 'yellow' };
return { 'timestamp': workingDate.subtract(5, 's').format(), status: 'yellow' };
}));
return rawData;
});
@ -65,10 +65,10 @@ describe('Marvel Watchers', function () {
testNoExecute('Red for 30 then Yellow for 60 seconds', function () {
var workingDate = moment.utc();
var rawData = _.times(6, function () {
return { '@timestamp': workingDate.subtract(5, 's').format(), status: 'red' };
return { 'timestamp': workingDate.subtract(5, 's').format(), status: 'red' };
});
rawData.concat(_.times(12, function () {
return { '@timestamp': workingDate.subtract(5, 's').format(), status: 'yellow' };
return { 'timestamp': workingDate.subtract(5, 's').format(), status: 'yellow' };
}));
return rawData;
});
@ -76,16 +76,16 @@ describe('Marvel Watchers', function () {
testNoExecute('Red for 5 Yellow for 10 Red for 10 Green for 60', function () {
var workingDate = moment.utc();
var rawData = _.times(1, function () {
return { '@timestamp': workingDate.subtract(5, 's').format(), status: 'red' };
return { 'timestamp': workingDate.subtract(5, 's').format(), status: 'red' };
});
rawData.concat(_.times(2, function () {
return { '@timestamp': workingDate.subtract(5, 's').format(), status: 'yellow' };
return { 'timestamp': workingDate.subtract(5, 's').format(), status: 'yellow' };
}));
rawData.concat(_.times(2, function () {
return { '@timestamp': workingDate.subtract(5, 's').format(), status: 'red' };
return { 'timestamp': workingDate.subtract(5, 's').format(), status: 'red' };
}));
rawData.concat(_.times(12, function () {
return { '@timestamp': workingDate.subtract(5, 's').format(), status: 'green' };
return { 'timestamp': workingDate.subtract(5, 's').format(), status: 'green' };
}));
return rawData;
});

View File

@ -17,7 +17,7 @@
"must": [
{
"range": {
"@timestamp": {
"timestamp": {
"gte": "now-2m",
"lte": "now"
}
@ -45,10 +45,10 @@
}
}
},
"fields": ["@timestamp","status"],
"fields": ["timestamp","status"],
"sort": [
{
"@timestamp": {
"timestamp": {
"order": "desc"
}
}
@ -57,7 +57,7 @@
"aggs": {
"minutes": {
"date_histogram": {
"field": "@timestamp",
"field": "timestamp",
"interval": "5s"
},
"aggs": {

View File

@ -16,7 +16,7 @@
"filtered": {
"filter": {
"range": {
"@timestamp": {
"timestamp": {
"gte": "now-2m",
"lte": "now"
}
@ -27,7 +27,7 @@
"aggs": {
"minutes": {
"date_histogram": {
"field": "@timestamp",
"field": "timestamp",
"interval": "minute"
},
"aggs": {

View File

@ -21,7 +21,7 @@
"filtered": {
"filter": {
"range": {
"@timestamp": {
"timestamp": {
"gte": "now-1m",
"lte": "now"
}
@ -32,7 +32,7 @@
"aggs": {
"minutes": {
"date_histogram": {
"field": "@timestamp",
"field": "timestamp",
"interval": "5s"
},
"aggs": {

View File

@ -21,7 +21,7 @@
"filtered": {
"filter": {
"range": {
"@timestamp": {
"timestamp": {
"gte": "now-1m",
"lte": "now"
}
@ -32,7 +32,7 @@
"aggs": {
"minutes": {
"date_histogram": {
"field": "@timestamp",
"field": "timestamp",
"interval": "5s"
},
"aggs": {

View File

@ -16,7 +16,7 @@
"filtered": {
"filter": {
"range": {
"@timestamp": {
"timestamp": {
"gte": "now-2m",
"lte": "now"
}
@ -27,7 +27,7 @@
"aggs": {
"minutes": {
"date_histogram": {
"field": "@timestamp",
"field": "timestamp",
"interval": "minute"
},
"aggs": {