Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

gzip telemetry events #3979

Closed
willwhite opened this issue Feb 16, 2016 · 11 comments
Closed

gzip telemetry events #3979

willwhite opened this issue Feb 16, 2016 · 11 comments
Labels
Android Mapbox Maps SDK for Android telemetry Integration with Mapbox Telemetry libraries

Comments

@willwhite
Copy link

Make sure that we gzip telemetry events before sending them. gzip could reduce the time the mobile radio is working, especially on slower connections, and thus reduce battery impact.

/cc @boundsj

@1ec5 1ec5 added iOS Mapbox Maps SDK for iOS Android Mapbox Maps SDK for Android telemetry Integration with Mapbox Telemetry libraries labels Feb 16, 2016
@friedbunny
Copy link
Contributor

I'm surprised that we don't do this already.

@tobrun
Copy link
Member

tobrun commented Feb 17, 2016

If content encoding is set to gzip, this is automatically handled in the background by Okhttp on Android.
You can verify this is the related unit-test, here they are showing Okhttp transparent gzipping in action.
update above is for response coming from server. Here is shown to add this to the request.

@boundsj
Copy link
Contributor

boundsj commented Feb 17, 2016

There are 3rd party libs that make this transparent for iOS, too (https://github.com/AFNetworking/AFgzipRequestSerializer/blob/master/AFgzipRequestSerializer/AFgzipRequestSerializer.m?#L57) but we don't use a 3rd party dep in the iOS bindings

@mawajdak
Copy link

الشبكات
لا توجد شبكات

@friedbunny
Copy link
Contributor

Resources that we can draw upon for our own GZIP implementation:

@tobrun
Copy link
Member

tobrun commented Jun 23, 2016

What I mentioned in #3979 (comment) is not true.

To GZIP our communication we need to implement the following request interceptor on OkHttp: https://github.com/square/okhttp/blob/3f7a3344a4c85aa3bbb879dabac5ee625ab987f3/samples/guide/src/main/java/okhttp3/recipes/RequestBodyCompression.java#L73

This shouldn't be a big lift since we just need to copy/paste it into our telemetry web service code.

@ivovandongen
Copy link
Contributor

@tobrun We're using something similar in Human too. Can take a look at that too if you want.

@mick
Copy link

mick commented Jun 24, 2016

The api already accepts gzip'd JSON as long as the following headers are set on the POST request:

Content-type: application/json
Content-Encoding: gzip

frederoni added a commit that referenced this issue Jun 29, 2016
frederoni added a commit that referenced this issue Jun 29, 2016
frederoni added a commit that referenced this issue Jun 29, 2016
frederoni added a commit that referenced this issue Jun 30, 2016
frederoni added a commit that referenced this issue Jul 1, 2016
@bleege
Copy link
Contributor

bleege commented Jul 1, 2016

I've ticketed out the Android work in #5536.

frederoni added a commit that referenced this issue Jul 4, 2016
frederoni added a commit that referenced this issue Jul 4, 2016
frederoni added a commit that referenced this issue Jul 4, 2016
frederoni added a commit that referenced this issue Jul 4, 2016
frederoni added a commit that referenced this issue Jul 4, 2016
frederoni added a commit that referenced this issue Jul 5, 2016
* [ios] #3979 wip gzip telemetry events

* [ios] expose compression from core instead of adding a new dependency

* [ios] #3979 Exposed decompress from mbgl and added a test case

* [ios] #3979 cleanup

* [ios] #3979 cleaned up test case

* [ios] #3979 cleanup

* [ios] #3979 gzip -> deflate
@friedbunny
Copy link
Contributor

friedbunny commented Jul 5, 2016

This is done on the iOS side (#5490) and will be included in the final v3.3.0 release.

@friedbunny friedbunny removed the iOS Mapbox Maps SDK for iOS label Jul 5, 2016
@zugaldia
Copy link
Member

Work for Android was done in #5536 and for iOS in #5490. I think we're good to close here.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Android Mapbox Maps SDK for Android telemetry Integration with Mapbox Telemetry libraries
Projects
None yet
Development

No branches or pull requests

10 participants