summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSwann Croiset <scroiset@mirantis.com>2017-02-02 12:58:02 +0100
committerSwann Croiset <scroiset@mirantis.com>2017-02-02 12:58:05 +0100
commitcceadc82c072dc6bb449573f48bda5723b55adce (patch)
treeabf4e6fb79292fa39ad560421c8ed7704f0c8f71
parentec842363e08af940b8eeb5dd00ece36bd69c9918 (diff)
Cast 'http_status' field into an integer
Co-Authored-By: Simon Pasquier <spasquier@mirantis.com> Change-Id: I4d2b0e8bf413794b1d3b46d26aa5f599064e43ec
Notes
Notes (review): Code-Review+1: Olivier Bourdon <obourdon@mirantis.com> Code-Review+2: Simon Pasquier <spasquier@mirantis.com> Workflow+1: Simon Pasquier <spasquier@mirantis.com> Verified+2: Jenkins Submitted-by: Jenkins Submitted-at: Fri, 03 Feb 2017 10:39:09 +0000 Reviewed-on: https://review.openstack.org/428106 Project: openstack/fuel-plugin-lma-collector Branch: refs/heads/master
-rw-r--r--deployment_scripts/puppet/modules/lma_collector/files/plugins/common/patterns.lua2
-rw-r--r--deployment_scripts/puppet/modules/lma_collector/tests/lua/test_patterns.lua8
2 files changed, 5 insertions, 5 deletions
diff --git a/deployment_scripts/puppet/modules/lma_collector/files/plugins/common/patterns.lua b/deployment_scripts/puppet/modules/lma_collector/files/plugins/common/patterns.lua
index e9acc18..bcb58c7 100644
--- a/deployment_scripts/puppet/modules/lma_collector/files/plugins/common/patterns.lua
+++ b/deployment_scripts/puppet/modules/lma_collector/files/plugins/common/patterns.lua
@@ -121,7 +121,7 @@ http_request = http_method * sp * url * sp * l.P'HTTP/' * http_version
121-- TODO(pasquier-s): build the LPEG grammar based on the log_format parameter 121-- TODO(pasquier-s): build the LPEG grammar based on the log_format parameter
122-- passed to eventlet.wsgi.server similar to what the build_rsyslog_grammar 122-- passed to eventlet.wsgi.server similar to what the build_rsyslog_grammar
123-- function does for RSyslog. 123-- function does for RSyslog.
124local openstack_http_status = l.P"status: "^-1 * l.Cg(l.digit^3, "http_status") 124local openstack_http_status = l.P"status: "^-1 * l.Cg(l.digit^3 / tonumber, "http_status")
125local openstack_response_size = l.P"len: "^-1 * l.Cg(l.digit^1 / tonumber, "http_response_size") 125local openstack_response_size = l.P"len: "^-1 * l.Cg(l.digit^1 / tonumber, "http_response_size")
126local openstack_response_time = l.P"time: "^-1 * l.Cg(l.digit^1 * dot^0 * l.digit^0 / tonumber, "http_response_time") 126local openstack_response_time = l.P"time: "^-1 * l.Cg(l.digit^1 * dot^0 * l.digit^0 / tonumber, "http_response_time")
127 127
diff --git a/deployment_scripts/puppet/modules/lma_collector/tests/lua/test_patterns.lua b/deployment_scripts/puppet/modules/lma_collector/tests/lua/test_patterns.lua
index d272007..8f79d10 100644
--- a/deployment_scripts/puppet/modules/lma_collector/tests/lua/test_patterns.lua
+++ b/deployment_scripts/puppet/modules/lma_collector/tests/lua/test_patterns.lua
@@ -87,12 +87,12 @@ TestPatterns = {}
87 assertEquals(patt.openstack_http:match( 87 assertEquals(patt.openstack_http:match(
88 '"OPTIONS / HTTP/1.0" status: 200 len: 497 time: 0.0006731'), 88 '"OPTIONS / HTTP/1.0" status: 200 len: 497 time: 0.0006731'),
89 {http_method = 'OPTIONS', http_url = '/', http_version = '1.0', 89 {http_method = 'OPTIONS', http_url = '/', http_version = '1.0',
90 http_status = '200', http_response_size = 497, 90 http_status = 200, http_response_size = 497,
91 http_response_time = 0.0006731}) 91 http_response_time = 0.0006731})
92 assertEquals(patt.openstack_http:match( 92 assertEquals(patt.openstack_http:match(
93 'foo "OPTIONS / HTTP/1.0" status: 200 len: 497 time: 0.0006731 bar'), 93 'foo "OPTIONS / HTTP/1.0" status: 200 len: 497 time: 0.0006731 bar'),
94 {http_method = 'OPTIONS', http_url = '/', http_version = '1.0', 94 {http_method = 'OPTIONS', http_url = '/', http_version = '1.0',
95 http_status = '200', http_response_size = 497, 95 http_status = 200, http_response_size = 497,
96 http_response_time = 0.0006731}) 96 http_response_time = 0.0006731})
97 end 97 end
98 98
@@ -100,12 +100,12 @@ TestPatterns = {}
100 assertEquals(patt.openstack_http:match( 100 assertEquals(patt.openstack_http:match(
101 '"OPTIONS / HTTP/1.0" status: 200 len: 497 time: 0.0006731'), 101 '"OPTIONS / HTTP/1.0" status: 200 len: 497 time: 0.0006731'),
102 {http_method = 'OPTIONS', http_url = '/', http_version = '1.0', 102 {http_method = 'OPTIONS', http_url = '/', http_version = '1.0',
103 http_status = '200', http_response_size = 497, 103 http_status = 200, http_response_size = 497,
104 http_response_time = 0.0006731}) 104 http_response_time = 0.0006731})
105 assertEquals(patt.openstack_http:match( 105 assertEquals(patt.openstack_http:match(
106 'foo "OPTIONS / HTTP/1.0" status: 200 len: 497 time: 0.0006731 bar'), 106 'foo "OPTIONS / HTTP/1.0" status: 200 len: 497 time: 0.0006731 bar'),
107 {http_method = 'OPTIONS', http_url = '/', http_version = '1.0', 107 {http_method = 'OPTIONS', http_url = '/', http_version = '1.0',
108 http_status = '200', http_response_size = 497, 108 http_status = 200, http_response_size = 497,
109 http_response_time = 0.0006731}) 109 http_response_time = 0.0006731})
110 end 110 end
111 111