jenkins-bot has submitted this change and it was merged. (
https://gerrit.wikimedia.org/r/337728 )
Change subject: Hygiene: use HTTP POST for EventLogging
......................................................................
Hygiene: use HTTP POST for EventLogging
Since recording a funnel event changes server state, a POST seems more
appropriate than a GET. I can't find any documentation on what's
actually expected. Also update dev endpoint to HTTPS since the server
requires it for POSTs and forbid messages that are too lengthy in
non-prod.
Change-Id: I3291c32193d51e2ff9f197e471129fda12444813
---
M app/src/main/java/org/wikipedia/analytics/EventLoggingEvent.java
1 file changed, 13 insertions(+), 2 deletions(-)
Approvals:
jenkins-bot: Verified
Nuria: Looks good to me, but someone else must approve
Mholloway: Looks good to me, approved
diff --git a/app/src/main/java/org/wikipedia/analytics/EventLoggingEvent.java
b/app/src/main/java/org/wikipedia/analytics/EventLoggingEvent.java
index cac32da..7b7550a 100644
--- a/app/src/main/java/org/wikipedia/analytics/EventLoggingEvent.java
+++ b/app/src/main/java/org/wikipedia/analytics/EventLoggingEvent.java
@@ -5,11 +5,13 @@
import org.json.JSONException;
import org.json.JSONObject;
import org.wikipedia.concurrency.SaneAsyncTask;
+import org.wikipedia.crash.RemoteLogException;
import org.wikipedia.dataclient.okhttp.OkHttpConnectionFactory;
import org.wikipedia.util.ReleaseUtil;
import org.wikipedia.util.log.L;
import okhttp3.Request;
+import okhttp3.RequestBody;
import okhttp3.Response;
/**
@@ -20,10 +22,13 @@
* Updating schemas / revisions is also easier this way.
*/
public class EventLoggingEvent {
+ private static final RequestBody EMPTY_REQ = RequestBody.create(null, new
byte[0]);
private static final String EVENTLOG_URL_PROD =
"https://meta.wikimedia.org/beacon/event";
- private static final String EVENTLOG_URL_DEV =
"http://deployment.wikimedia.beta.wmflabs.org/beacon/event";
+ private static final String EVENTLOG_URL_DEV =
"https://deployment.wikimedia.beta.wmflabs.org/beacon/event";
private static final String EVENTLOG_URL = ReleaseUtil.isPreBetaRelease()
? EVENTLOG_URL_DEV : EVENTLOG_URL_PROD;
+ //
https://github.com/wikimedia/mediawiki-extensions-EventLogging/blob/8b3cb1b/modules/ext.eventLogging.core.js#L57
+ private static final int MAX_URL_LEN = 2000;
private final JSONObject data;
@@ -70,7 +75,13 @@
String dataURL = Uri.parse(EVENTLOG_URL)
.buildUpon().query(data.toString())
.build().toString();
- Request request = new Request.Builder().url(dataURL).build();
+
+ if (dataURL.length() > MAX_URL_LEN) {
+ L.logRemoteErrorIfProd(new RemoteLogException("EventLogging
max length exceeded")
+ .put("length", String.valueOf(dataURL.length())));
+ }
+
+ Request request = new
Request.Builder().url(dataURL).post(EMPTY_REQ).build();
Response response =
OkHttpConnectionFactory.getClient().newCall(request).execute();
try {
return response.code();
--
To view, visit https://gerrit.wikimedia.org/r/337728
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I3291c32193d51e2ff9f197e471129fda12444813
Gerrit-PatchSet: 3
Gerrit-Project: apps/android/wikipedia
Gerrit-Branch: master
Gerrit-Owner: Niedzielski <[email protected]>
Gerrit-Reviewer: Brion VIBBER <[email protected]>
Gerrit-Reviewer: Dbrant <[email protected]>
Gerrit-Reviewer: Mholloway <[email protected]>
Gerrit-Reviewer: Milimetric <[email protected]>
Gerrit-Reviewer: Niedzielski <[email protected]>
Gerrit-Reviewer: Nuria <[email protected]>
Gerrit-Reviewer: Sniedzielski <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits