mozilla-services / contile

This is the back-end server for the Mozilla Tile Service (MTS)
https://mozilla-services.github.io/contile/
Mozilla Public License 2.0
19 stars 2 forks source link

2.3 Determine Region lookup mechanism #7

Closed pjenvey closed 3 years ago

pjenvey commented 3 years ago

Tiles requested from AdM should be specific to a region.

AdM's Phase 1 Tiles API includes an ip=<Fake IP Address> query parameter for specifying a region, with a limited collection of hardcoded fake ip addresses that specify large regions (US, UK, etc).

We need to map a client's region to one of these fake ip address region buckets. The Tiles service could determine this itself via a MaxMind db lookup of the client's IP address.

However clients seem to have some notion of their region which is propagated through telemetry. With telemetry eventually ingesting clicks/impressions with that associated region, it may make more sense for the client to specify this same region to the Tiles Service (in case of potential mismatches: e.g. MaxMind's location lookup could differ from the client's) and would simplify the Tiles service as it wouldn't need MaxMind. Instead it only needs a mapping of known client regions the client specifies to AdM's fake ip addresses.

There's also potentially a Phase 2 AdM Tiles API in the future with more explicit parameters country=us&region=ny&city=new+york&dma=501 -- I'm not sure we want to specify as narrow as a city -- but we may need to narrow it down to region=ny for example. How narrow is the client's knowledge of its specific region? It may only know country=us but not region=ny.

pjenvey commented 3 years ago

AFAICT the client's only aware of its top level country and nothing narrower, queried via MLS's /v1/country API endpoint.

Pocket's proxy-server appears to use MaxMind for similar reasons: requiring both the country and a narrower ISO_3166-2 region (e.g. US state or equivalent).

pjenvey commented 3 years ago

Having the client specify its top level region will be the simplest for the initial phase, we can always change this later when we need to switch to the Phase 2 AdM Tiles API.

jrconlin commented 3 years ago

There are two UA lookup mechanisms currently in the code. One uses MaxMind, and the other use a Google provided Location header. The MaxMind db is known, the Google provided header is less well known.

I'm in favor of closing this issue in favor of a follow-up once we have a better understanding of the Google header.

jrconlin commented 3 years ago

Closed as OBE.

We're currently using a combination of MaxMind DB, and Google LBE Headers to determine location information.