Skip to content
This repository was archived by the owner on Dec 14, 2022. It is now read-only.

Commit ef95bb3

Browse files
author
Chris Wiechmann
authored
Merge pull request #3 from cwiechmann/master
Fixed an issue with the ago-filter when using hours
2 parents a3792fc + 3974890 commit ef95bb3

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

.github/workflows/traffic-monitor-api.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# For that an Elasticsearch instance is started, test-data inserted and the
33
# API-Builder Traffic-Monitor API is executed with all possible parameters.
44

5-
name: Test Traffic-Monitor API
5+
name: Traffic-Monitor API
66

77
on:
88
push:

elk-traffic-monitor-api/flows/monitoringApiApi-getRouterServiceOpsSearchByServiceID.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@
248248
{
249249
"name": "code",
250250
"type": "string",
251-
"value": "\"var queryFilters = data.queryFilters;\\n if(data.params.ago) {\\n var ago = data.params.ago;\\n var diff = convertAgo(ago);\\n var filter = {\\n range: {\\n \\\"timestampOriginal\\\": {\\n gt: diff\\n }\\n }\\n };\\n queryFilters.push(filter);\\n return queryFilters;\\n }\\n \\n function convertAgo(ago) {\\n var diff = ago.substring(0, ago.length-1);\\n var now = new Date();\\n if(ago.endsWith('m')) {\\n return now.setMinutes(now.getMinutes() - diff);\\n } else if(ago.endsWith('h')) {\\n return now.setMinutes(now.getHours() - diff);\\n }\\n console.log(`ERRRRO ${ago}`);\\n }\"",
251+
"value": "\"var queryFilters = data.queryFilters;\\n if(data.params.ago) {\\n var ago = data.params.ago;\\n var diff = convertAgo(ago);\\n var filter = {\\n range: {\\n \\\"timestampOriginal\\\": {\\n gt: diff\\n }\\n }\\n };\\n queryFilters.push(filter);\\n return queryFilters;\\n }\\n \\n function convertAgo(ago) {\\n var diff = ago.substring(0, ago.length-1);\\n var now = new Date();\\n if(ago.endsWith('m')) {\\n return now.setMinutes(now.getMinutes() - diff);\\n } else if(ago.endsWith('h')) {\\n return now.setHours(now.getHours() - diff);\\n }\\n console.log(`ERRRRO ${ago}`);\\n }\"",
252252
"metaName": "code",
253253
"metaDescription": "A JavaScript function body. Supports `await` and returning promises"
254254
}

elk-traffic-monitor-api/test/endpoints.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ describe('Endpoints', function () {
413413
};
414414
return requestAsync({
415415
method: 'GET',
416-
uri: `http://localhost:${server.apibuilder.port}/api/elk/v1/api/router/service/instance-1/ops/search?ago=120h`,
416+
uri: `http://localhost:${server.apibuilder.port}/api/elk/v1/api/router/service/instance-1/ops/search?ago=2h`,
417417
auth: auth,
418418
json: true
419419
}).then(({ response, body }) => {

0 commit comments

Comments
 (0)