in mozetl/landfill/sampler.py [0:0]
def _detect_telemetry_version(content_string):
"""Detect document version from the payload itself.
Should match with the logic here:
https://github.com/mozilla-services/lua_sandbox_extensions/blob/master/moz_telemetry/io_modules/decoders/moz_ingest/telemetry.lua#L162
If the given content string is not parseable as JSON,
default to a version of "0".
"""
if content_string is None:
return UNPARSEABLE_TELEMETRY_VERSION
try:
content = json.loads(content_string)
except ValueError:
return UNPARSEABLE_TELEMETRY_VERSION
if "ver" in content:
return str(content["ver"])
if "version" in content:
return str(content["version"])
if "deviceinfo" in content:
return "3"
if "v" in content:
return str(content["v"])
return "1"