Bug 1456415 - Set correct record_on_release flag in generated JSON files. r=chutten

MozReview-Commit-ID: CkreMOAFCP7

--HG--
extra : histedit_source : 3a02ead1a67e4e80a55ee115f720665b342c02c7
This commit is contained in:
Jan-Erik Rediger 2018-05-03 04:30:00 +03:00
Родитель f3ce6d98c2
Коммит 686a5dd037
4 изменённых файлов: 21 добавлений и 7 удалений

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

@ -138,7 +138,7 @@ def generate_JSON_definitions(output, *filenames):
'methods': event.methods,
'objects': event.objects,
'extra_keys': event.extra_keys,
'record_on_release': True if event.dataset == 'opt-out' else False,
'record_on_release': True if event.dataset_short == 'opt-out' else False,
# We don't expire dynamic-builtin scalars: they're only meant for
# use in local developer builds anyway. They will expire when rebuilding.
'expired': False,

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

@ -110,7 +110,7 @@ def generate_JSON_definitions(output, *filenames):
scalar_definitions[category][scalar.name] = OrderedDict({
'kind': scalar.nsITelemetry_kind,
'keyed': scalar.keyed,
'record_on_release': True if scalar.dataset == 'opt-out' else False,
'record_on_release': True if scalar.dataset_short == 'opt-out' else False,
# We don't expire dynamic-builtin scalars: they're only meant for
# use in local developer builds anyway. They will expire when rebuilding.
'expired': False,

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

@ -271,12 +271,20 @@ class EventData:
def dataset(self):
"""Get the nsITelemetry constant equivalent for release_channel_collection.
"""
rcc = self._definition.get('release_channel_collection', 'opt-in')
rcc = self.dataset_short
if rcc == 'opt-out':
return 'nsITelemetry::DATASET_RELEASE_CHANNEL_OPTOUT'
else:
return 'nsITelemetry::DATASET_RELEASE_CHANNEL_OPTIN'
@property
def dataset_short(self):
"""Get the short name of the chosen release channel collection policy for the event.
"""
# The collection policy is optional, but we still define a default
# behaviour for it.
return self._definition.get('release_channel_collection', 'opt-in')
@property
def extra_keys(self):
return self._definition.get('extra_keys', {}).keys()

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

@ -276,18 +276,24 @@ class ScalarType:
@property
def dataset(self):
"""Get the nsITelemetry constant equivalent to the chose release channel collection
"""Get the nsITelemetry constant equivalent to the chosen release channel collection
policy for the scalar.
"""
# The collection policy is optional, but we still define a default
# behaviour for it.
rcc = self._definition.get('release_channel_collection', 'opt-in')
rcc = self.dataset_short
table = {
'opt-in': 'OPTIN',
'opt-out': 'OPTOUT',
}
return 'nsITelemetry::DATASET_RELEASE_CHANNEL_' + table[rcc]
@property
def dataset_short(self):
"""Get the short name of the chosen release channel collection policy for the scalar.
"""
# The collection policy is optional, but we still define a default
# behaviour for it.
return self._definition.get('release_channel_collection', 'opt-in')
@property
def cpp_guard(self):
"""Get the cpp guard for this scalar"""