Ori.livneh has submitted this change and it was merged.
Change subject: Use ^ and $ while spliting metric value and type
......................................................................
Use ^ and $ while spliting metric value and type
If stats are sent to the enpoint using jsonp then
a jquery callback URL parameter is included.
With the current regex this would make it all the way throguh
and get sent to graphite in many cases as somewhere in the value
there will be a digit followed by a non digit..
Instead the regex should make sure the value is actually a
value exactly as graphite would expect it!
Change-Id: I8f194570fbdb34205b54310e0da73685ea7472c5
---
M statsv.py
1 file changed, 1 insertion(+), 1 deletion(-)
Approvals:
Ori.livneh: Verified; Looks good to me, approved
Jonas Kress (WMDE): Looks good to me, but someone else must approve
Thiemo Mättig (WMDE): Looks good to me, but someone else must approve
diff --git a/statsv.py b/statsv.py
index 0d17db0..ab51059 100644
--- a/statsv.py
+++ b/statsv.py
@@ -60,7 +60,7 @@
try:
query_string = data['uri_query'].lstrip('?')
for metric_name, value in urlparse.parse_qsl(query_string):
- metric_value, metric_type = re.search('(\d+)(\D+)',
value).groups()
+ metric_value, metric_type = re.search('^(\d+)([a-z]+)$',
value).groups()
assert metric_type in supported_metric_types
statsd_message = '%s:%s|%s' % (metric_name, metric_value,
metric_type)
sock.sendto(statsd_message.encode('utf-8'), statsd_addr)
--
To view, visit https://gerrit.wikimedia.org/r/308959
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I8f194570fbdb34205b54310e0da73685ea7472c5
Gerrit-PatchSet: 3
Gerrit-Project: analytics/statsv
Gerrit-Branch: master
Gerrit-Owner: Addshore <[email protected]>
Gerrit-Reviewer: Addshore <[email protected]>
Gerrit-Reviewer: Jonas Kress (WMDE) <[email protected]>
Gerrit-Reviewer: Ori.livneh <[email protected]>
Gerrit-Reviewer: Ottomata <[email protected]>
Gerrit-Reviewer: Thiemo Mättig (WMDE) <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits