Skip to content
Open
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
20 changes: 20 additions & 0 deletions schemas/performance-artifact.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,23 @@
"required": ["name"],
"type": "object"
},
"os_schema": {
"type": "object",
"properties": {
"name": {
"title": "Operating system name",
"type": "string",
"minLength": 1,
"maxLength": 100
},
"version": {
"title": "Operating system version",
"type": "string",
"minLength": 1,
"maxLength": 100
}
}
},
"framework_schema": {
"properties": {
"name": {
Expand Down Expand Up @@ -232,6 +249,9 @@
"application": {
"$ref": "#/definitions/application_schema"
},
"os": {
"$ref": "#/definitions/os_schema"
},
"framework": {
"$ref": "#/definitions/framework_schema"
},
Expand Down
27 changes: 25 additions & 2 deletions treeherder/etl/perf.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,18 @@ def _get_application_version(validated_perf_datum: dict):
return ""


def _get_os_fields(perf_datum):
"""
Try to read OS fields from the payload. Returns (name, version) or (None, None).
Supported formats:
- perf_datum["os"] = {"name": "...", "version": "..."}
"""
os_obj = perf_datum.get("os")
if isinstance(os_obj, dict):
return os_obj.get("name"), os_obj.get("version")
return None, None


def _get_signature_hash(signature_properties):
signature_prop_values = list(signature_properties.keys())
str_values = []
Expand Down Expand Up @@ -178,6 +190,7 @@ def _load_perf_datum(job: Job, perf_datum: dict):
return
application = _get_application_name(perf_datum)
application_version = _get_application_version(perf_datum)
os_name, os_version = _get_os_fields(perf_datum)
for suite in perf_datum["suites"]:
suite_extra_properties = copy.copy(extra_properties)
ordered_tags = _order_and_concat(suite.get("tags", []))
Expand Down Expand Up @@ -235,7 +248,12 @@ def _load_perf_datum(job: Job, perf_datum: dict):
push=job.push,
signature=signature,
push_timestamp=deduced_timestamp,
defaults={"value": suite["value"], "application_version": application_version},
defaults={
"value": suite["value"],
"application_version": application_version,
"os_name": os_name,
"os_version": os_version,
},
)
if suite_datum.should_mark_as_multi_commit(is_multi_commit, datum_created):
# keep a register with all multi commit perf data
Expand Down Expand Up @@ -304,7 +322,12 @@ def _load_perf_datum(job: Job, perf_datum: dict):
push=job.push,
signature=signature,
push_timestamp=deduced_timestamp,
defaults={"value": value[0], "application_version": application_version},
defaults={
"value": value[0],
"application_version": application_version,
"os_name": os_name,
"os_version": os_version,
},
)

if _test_should_gather_replicates_based_on(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Generated by Django 5.1.4 on 2025-09-24 12:02

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("perf", "0060_alter_performancealert_unique_together_and_more"),
]

operations = [
migrations.AddField(
model_name="performancedatum",
name="os_name",
field=models.CharField(blank=True, max_length=100, null=True),
),
migrations.AddField(
model_name="performancedatum",
name="os_version",
field=models.CharField(blank=True, max_length=100, null=True),
),
]
3 changes: 3 additions & 0 deletions treeherder/perf/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,9 @@ class PerformanceDatum(models.Model):
job = models.ForeignKey(Job, null=True, default=None, on_delete=models.SET_NULL)
push = models.ForeignKey(Push, on_delete=models.CASCADE)

os_name = models.CharField(max_length=100, null=True, blank=True)
os_version = models.CharField(max_length=100, null=True, blank=True)

class Meta:
db_table = "performance_datum"
indexes = [
Expand Down