This commit is contained in:
Roberto Agostino Vitillo 2015-08-24 14:18:10 +01:00
Родитель 8171c92d8a
Коммит dde7a8fe4b
3 изменённых файлов: 7 добавлений и 8 удалений

Просмотреть файл

@ -5,8 +5,6 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import binascii
from moztelemetry.spark import get_pings
from moztelemetry.histogram import cached_exponential_buckets
from collections import defaultdict
@ -45,16 +43,16 @@ def _map_build_id_key_to_submission_date_key(aggregate):
def _sample_clients(ping):
client_id = ping.get("clientId", None)
sample_id = ping.get("meta", {}).get("sampleId", None)
if not client_id:
if type(sample_id) not in (int, float, long):
return False
# Check if telemetry is enabled
if not ping.get("environment", {}).get("settings", {}).get("telemetryEnabled", False):
return False
channel = ping["application"]["channel"]
channel = ping.get("application", {}).get("channel", None)
percentage = {"nightly": 100,
"aurora": 100,
"beta": 100,
@ -64,7 +62,7 @@ def _sample_clients(ping):
return False
# Use meta/sampleid once Heka spits it out correctly
return client_id and ((binascii.crc32(client_id) % 100) < percentage[channel])
return sample_id < percentage[channel]
def _extract_histograms(state, payload, is_child=False):

Просмотреть файл

@ -8,7 +8,7 @@
from setuptools import setup
setup(name='python_mozaggregator',
version='0.2.2.9',
version='0.2.3.0',
author='Roberto Agostino Vitillo',
author_email='rvitillo@mozilla.com',
description='Telemetry aggregation job',

Просмотреть файл

@ -88,7 +88,8 @@ def generate_pings():
def generate_payload(dimensions):
meta = {u"submissionDate": dimensions["submission_date"]}
meta = {u"submissionDate": dimensions["submission_date"],
u"sampleId": 42}
application = {u"channel": dimensions["channel"],
u"version": dimensions["version"],
u"buildId": dimensions["build_id"],