mozilla_schema_generator.bhr_ping

 1# -*- coding: utf-8 -*-
 2
 3# This Source Code Form is subject to the terms of the Mozilla Public
 4# License, v. 2.0. If a copy of the MPL was not distributed with this
 5# file, You can obtain one at http://mozilla.org/MPL/2.0/.
 6
 7from .common_ping import CommonPing
 8from .utils import prepend_properties
 9
10
11class BhrPing(CommonPing):
12    schema_url = (
13        "https://raw.githubusercontent.com/mozilla-services/mozilla-pipeline-schemas"
14        "/{branch}/schemas/telemetry/bhr/bhr.4.schema.json"
15    )
16
17    def __init__(self, **kwargs):
18        super().__init__(self.schema_url, **kwargs)
19
20    def _update_env(self, schema):
21        # hangs is an array of objects
22        stack = prepend_properties(("payload", "hangs")) + (
23            "items",
24            "properties",
25            "stack",
26        )
27        schema.set_schema_elem(
28            stack,
29            {
30                "type": "string",
31                "description": (
32                    "JSON representation of the stack field."
33                    " Injected by mozilla-schema-generator."
34                ),
35            },
36            # this may otherwise overwrite the "items" fields
37            propagate=False,
38        )
39
40        return super()._update_env(schema)
12class BhrPing(CommonPing):
13    schema_url = (
14        "https://raw.githubusercontent.com/mozilla-services/mozilla-pipeline-schemas"
15        "/{branch}/schemas/telemetry/bhr/bhr.4.schema.json"
16    )
17
18    def __init__(self, **kwargs):
19        super().__init__(self.schema_url, **kwargs)
20
21    def _update_env(self, schema):
22        # hangs is an array of objects
23        stack = prepend_properties(("payload", "hangs")) + (
24            "items",
25            "properties",
26            "stack",
27        )
28        schema.set_schema_elem(
29            stack,
30            {
31                "type": "string",
32                "description": (
33                    "JSON representation of the stack field."
34                    " Injected by mozilla-schema-generator."
35                ),
36            },
37            # this may otherwise overwrite the "items" fields
38            propagate=False,
39        )
40
41        return super()._update_env(schema)
BhrPing(**kwargs)
18    def __init__(self, **kwargs):
19        super().__init__(self.schema_url, **kwargs)
schema_url = 'https://raw.githubusercontent.com/mozilla-services/mozilla-pipeline-schemas/{branch}/schemas/telemetry/bhr/bhr.4.schema.json'