Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug 1898073] Change creationDate in telemetry.crash to date-time format #816

Merged
merged 2 commits into from
Jun 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions requirements-dev.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@
pytest
pytest-xdist
jsonschema
validator
rfc3339-validator # needed to validate date-time format with jsonschema
pyjnius
72 changes: 53 additions & 19 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,29 +1,63 @@
#
# This file is autogenerated by pip-compile
# To update, run:
# This file is autogenerated by pip-compile with Python 3.8
# by the following command:
#
# pip-compile requirements-dev.in
#
apipkg==1.5 # via execnet
attrs==20.2.0 # via jsonschema, pytest
cython==0.29.21 # via pyjnius
execnet==1.7.1 # via pytest-xdist
importlib-metadata==2.0.0 # via jsonschema, pluggy, pytest
iniconfig==1.0.1 # via pytest
apipkg==1.5
# via execnet
attrs==20.2.0
# via
# jsonschema
# pytest
cython==0.29.21
# via pyjnius
execnet==1.7.1
# via pytest-xdist
iniconfig==1.0.1
# via pytest
jsonschema==3.2.0
more-itertools==8.5.0 # via pytest
packaging==20.4 # via pytest
pluggy==0.13.1 # via pytest
py==1.9.0 # via pytest, pytest-forked
# via -r requirements-dev.in
more-itertools==8.5.0
# via pytest
packaging==20.4
# via pytest
pluggy==0.13.1
# via pytest
py==1.9.0
# via
# pytest
# pytest-forked
pyjnius==1.3.0.0
pyparsing==2.4.7 # via packaging
pyrsistent==0.17.3 # via jsonschema
pytest-forked==1.3.0 # via pytest-xdist
pytest-xdist==2.1.0
# via -r requirements-dev.in
pyparsing==2.4.7
# via packaging
pyrsistent==0.17.3
# via jsonschema
pytest==6.0.2
six==1.15.0 # via jsonschema, packaging, pyjnius
toml==0.10.1 # via pytest
zipp==3.2.0 # via importlib-metadata
# via
# -r requirements-dev.in
# pytest-forked
# pytest-xdist
pytest-forked==1.3.0
# via pytest-xdist
pytest-xdist==2.1.0
# via -r requirements-dev.in
python-dateutil==2.9.0.post0
# via validator
rfc3339-validator==0.1.4
# via -r requirements-dev.in
six==1.15.0
# via
# jsonschema
# packaging
# pyjnius
# python-dateutil
# rfc3339-validator
toml==0.10.1
# via pytest
validator==0.7.1
# via -r requirements-dev.in

# The following packages are considered to be unsafe in a requirements file:
# setuptools
2 changes: 1 addition & 1 deletion schemas/telemetry/crash/crash.4.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
"type": "string"
},
"creationDate": {
"pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}\\.[0-9]{3}Z$",
"format": "date-time",
"type": "string"
},
"environment": {
Expand Down
4 changes: 4 additions & 0 deletions templates/include/telemetry/crashCreationDate.1.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
"creationDate": {
"type": "string",
"format": "date-time"
}
2 changes: 1 addition & 1 deletion templates/telemetry/crash/crash.4.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"properties": {
@TELEMETRY_APPLICATION_1_JSON@,
@TELEMETRY_CLIENTID_1_JSON@,
@TELEMETRY_CREATIONDATE_1_JSON@,
@TELEMETRY_CRASHCREATIONDATE_1_JSON@,
@TELEMETRY_ENVIRONMENT_1_JSON@,
@TELEMETRY_ID_1_JSON@,
"payload": {
Expand Down
5 changes: 3 additions & 2 deletions tests/test_validation_python.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import pytest
from jsonschema import validate
from jsonschema._format import draft4_format_checker
from jsonschema.exceptions import ValidationError


def test_validation_pass_python(schemas, qualifier, passing_example):
assert qualifier in schemas, f"{qualifier} missing from schemas"
validate(passing_example, schemas[qualifier])
validate(passing_example, schemas[qualifier], format_checker=draft4_format_checker)
# TODO: raise all validation errors for debugging, using IValidator
# interface. This requires knowing the JSON Schema spec ahead of time, for
# example by ensuring $schema is set.
Expand All @@ -14,4 +15,4 @@ def test_validation_pass_python(schemas, qualifier, passing_example):
def test_validation_fail_python(schemas, qualifier, failing_example):
assert qualifier in schemas, f"{qualifier} missing from schemas"
with pytest.raises(ValidationError):
validate(failing_example, schemas[qualifier])
validate(failing_example, schemas[qualifier], format_checker=draft4_format_checker)
194 changes: 194 additions & 0 deletions validation/telemetry/crash.4.creationdatedatetime.fail.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,194 @@
{
"clientId": "a136763f-3b9a-492d-8964-bfe783b68dc6",
"id": "89ba9d98-b041-46f3-8b1a-36dfeb5e1b15",
"environment": {
"settings": {
"blocklistEnabled": true,
"attribution": {
"content": "%2528not%2Bset%2529",
"source": "www.google.com",
"medium": "referral",
"campaign": "%2528not%2Bset%2529"
},
"isDefaultBrowser": true,
"addonCompatibilityCheckEnabled": true,
"locale": "en-US",
"e10sMultiProcesses": 4,
"defaultSearchEngineData": {
"origin": "default",
"loadPath": "jar:[app]/omni.ja!browser/google.xml",
"submissionURL": "https://www.google.com/search?q=&ie=utf-8&oe=utf-8&client=firefox-b",
"name": "Google"
},
"update": {
"enabled": true,
"autoDownload": true,
"channel": "nightly"
},
"e10sEnabled": true,
"sandbox": {
"effectiveContentProcessLevel": 5
},
"userPrefs": {
"browser.startup.homepage": "<user-set>",
"browser.search.region": "KE",
"browser.cache.disk.capacity": 358400,
"browser.search.widget.inNavBar": false
},
"defaultSearchEngine": "google",
"telemetryEnabled": true
},
"system": {
"gfx": {
"features": {
"compositor": "d3d11",
"advancedLayers": {
"status": "available"
},
"gpuProcess": {
"status": "unavailable"
},
"d3d11": {
"status": "available",
"textureSharing": true,
"version": 40960,
"blocklisted": false,
"warp": false
},
"d2d": {
"status": "blacklisted",
"version": "1.1"
}
},
"DWriteEnabled": true,
"D2DEnabled": false,
"ContentBackend": "Skia",
"adapters": [
{
"vendorID": "0x8086",
"driverVersion": "8.15.10.2302",
"driverDate": "2-11-2011",
"description": "Intel(R) Q45/Q43 Express Chipset",
"GPUActive": true,
"RAM": null,
"driver": "igdumdx32 igd10umd32",
"deviceID": "0x2e12",
"subsysID": "3034103c"
}
],
"monitors": [
{
"refreshRate": 60,
"screenHeight": 1024,
"screenWidth": 1280,
"pseudoDisplay": false
}
],
"TargetFrameRate": 60
},
"os": {
"name": "Windows_NT",
"locale": "en-US",
"installYear": 2016,
"version": "6.1",
"servicePackMajor": 0,
"windowsBuildNumber": 7600,
"servicePackMinor": 0
},
"memoryMB": 1993,
"hdd": {
"profile": {
"model": "ST3160316CS",
"revision": "SC13"
},
"binary": {
"model": "ST3160316CS",
"revision": "SC13"
},
"system": {
"model": "ST3160316CS",
"revision": "SC13"
}
},
"virtualMaxMB": 2048,
"appleModelId": null,
"isWow64": false,
"cpu": {
"count": 2,
"l3cacheKB": null,
"vendor": "GenuineIntel",
"family": 6,
"extensions": [
"hasMMX",
"hasSSE",
"hasSSE2",
"hasSSE3",
"hasSSSE3",
"hasSSE4_1"
],
"stepping": 10,
"cores": 2,
"model": 23,
"speedMHz": 2926,
"l2cacheKB": 3072
}
},
"build": {
"applicationName": "Firefox",
"vendor": "Mozilla",
"buildId": "20180409100035",
"applicationId": "{ec8030f7-c20a-464f-9b0e-13a3a9e97384}",
"version": "61.0a1",
"architecture": "x86",
"platformVersion": "61.0a1",
"xpcomAbi": "x86-msvc",
"updaterAvailable": true
},
"partner": {
"distributionId": null,
"distributorChannel": null,
"partnerId": null,
"distributor": null,
"distributionVersion": null,
"partnerNames": []
}
},
"application": {
"vendor": "Mozilla",
"name": "Firefox",
"buildId": "20180409100035",
"displayVersion": "61.0a1",
"version": "61.0a1",
"architecture": "x86",
"platformVersion": "61.0a1",
"xpcomAbi": "x86-msvc",
"channel": "nightly"
},
"version": 4,
"creationDate": "2018-04-10",
"type": "crash",
"payload": {
"sessionId": null,
"version": 1,
"minidumpSha256Hash": "5f95d0abb0104fa7d13378a47b799b489b6c321febbe1cd9a7b921207708526b",
"crashTime": "2018-04-10T07:00:00.000Z",
"crashDate": "2018-04-10",
"metadata": {
"Version": "61.0a1",
"StartupCrash": "0",
"ipc_channel_error": "ShutDownKill",
"LastInteractionDuration": "1234",
"ProductName": "Firefox",
"StartupCrash": "0",
"BuildID": "20180409100035",
"UptimeTS": "56.8150704",
"CrashTime": "1523345096",
"ReleaseChannel": "nightly",
"ProductID": "{ec8030f7-c20a-464f-9b0e-13a3a9e97384}",
"ShutdownReason": "AppClose"
},
"processType": "content",
"crashId": "f6ecb3b9-bcb7-4c65-ae77-255d79836cc6",
"hasCrashEnvironment": true
}
}
Loading