Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3597049
varnishreqstats porting to v4
No One
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Authored By
•
ema
Mar 10 2016, 12:00 PM
2016-03-10 12:00:37 (UTC+0)
Size
2 KB
Referenced Files
None
Subscribers
None
varnishreqstats porting to v4
View Options
diff --git a/modules/varnish/files/varnishreqstats b/modules/varnish/files/varnishreqstats
index 9ed812d..e717f22 100755
--- a/modules/varnish/files/varnishreqstats
+++ b/modules/varnish/files/varnishreqstats
@@ -33,7 +33,7 @@ import sys
import time
import unittest
-from varnishlog import varnishlog
+from varnishlog4 import varnishlog
valid_http_methods = (
'get',
@@ -154,11 +154,11 @@ def count_vsl_entries(
return
# Count the http request method
- if tag in ['TxRequest', 'RxRequest'] and is_valid_http_method(value):
+ if tag in ['BereqMethod', 'ReqMethod'] and is_valid_http_method(value):
counts[remote_party + '.method.' + value.lower()] += 1
# Count the http response status
- elif tag in ['RxStatus', 'TxStatus'] and is_valid_http_status(value):
+ elif tag in ['BerespStatus', 'RespStatus'] and is_valid_http_status(value):
key_prefix = remote_party + '.status.'
counts[key_prefix + value[0] + 'xx'] += 1
@@ -173,7 +173,11 @@ def count_vsl_entries(
counts[key_prefix + 'error'] += 1
# Thesee indicates we completed a request, count it.
- elif tag in ['ReqEnd', 'BackendClose', 'BackendReuse']:
+ elif tag in ['BackendClose', 'BackendReuse']:
+ counts[remote_party + '.total'] += 1
+
+ # There is no ReqEnd in v4, let's use Timestamp for Resp
+ elif tag == 'Timestamp' and 'Resp' in value:
counts[remote_party + '.total'] += 1
# If interval seconds have passed, publish counts
@@ -204,11 +208,11 @@ if __name__ == '__main__':
arguments = parser.parse_args()
vsl_args = [
- ('i', 'TxRequest'),
- ('i', 'RxStatus'),
- ('i', 'RxRequest'),
- ('i', 'TxStatus'),
- ('i', 'ReqEnd'),
+ ('i', 'BereqMethod'),
+ ('i', 'BerespStatus'),
+ ('i', 'ReqMethod'),
+ ('i', 'RespStatus'),
+ ('i', 'Timestamp'),
('i', 'BackendClose'),
('i', 'BackendReuse')
]
File Metadata
Details
Attached
Mime Type
text/plain; charset=utf-8
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3493354
Default Alt Text
varnishreqstats porting to v4 (2 KB)
Attached To
Mode
P2736 varnishreqstats porting to v4
Attached
Detach File
Event Timeline
Log In to Comment