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

Add application field to the PerfCompare endpoint response #7782

Merged
merged 2 commits into from
Sep 14, 2023
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 tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ def create(
test,
test_perf_signature,
repository,
application='',
):
return perf_models.PerformanceSignature.objects.create(
repository=repository,
Expand All @@ -160,6 +161,7 @@ def create(
extra_options=extra_options,
last_updated=datetime.datetime.now(),
measurement_unit=measurement_unit,
application=application,
)

return create
Expand Down
16 changes: 16 additions & 0 deletions tests/webapp/api/test_perfcompare_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ def test_perfcompare_results_against_no_base(
test = 'dhtml.html'
extra_options = 'e10s fission stylo webrender'
measurement_unit = 'ms'
base_application = 'firefox'
new_application = 'geckoview'

base_sig = create_signature(
signature_hash=(20 * 't1'),
Expand All @@ -49,6 +51,7 @@ def test_perfcompare_results_against_no_base(
test=test,
test_perf_signature=test_perf_signature,
repository=try_repository,
application=base_application,
)

base_perf_data_values = [32.4]
Expand Down Expand Up @@ -77,6 +80,7 @@ def test_perfcompare_results_against_no_base(
test=test,
test_perf_signature=test_perf_signature,
repository=test_repository,
application=new_application,
)

job = perf_jobs[1]
Expand Down Expand Up @@ -108,6 +112,8 @@ def test_perfcompare_results_against_no_base(
'header_name': response['header_name'],
'base_repository_name': base_sig.repository.name,
'new_repository_name': new_sig.repository.name,
'base_app': 'firefox',
'new_app': 'geckoview',
'is_complete': response['is_complete'],
'base_measurement_unit': base_sig.measurement_unit,
'new_measurement_unit': new_sig.measurement_unit,
Expand Down Expand Up @@ -188,6 +194,8 @@ def test_perfcompare_results_with_only_one_run_and_diff_repo(
test = 'dhtml.html'
extra_options = 'e10s fission stylo webrender'
measurement_unit = 'ms'
base_application = 'firefox'
new_application = 'geckoview'

base_sig = create_signature(
signature_hash=(20 * 't1'),
Expand All @@ -198,6 +206,7 @@ def test_perfcompare_results_with_only_one_run_and_diff_repo(
test=test,
test_perf_signature=test_perf_signature,
repository=try_repository,
application=base_application,
)

base_perf_data_values = [32.4]
Expand Down Expand Up @@ -226,6 +235,7 @@ def test_perfcompare_results_with_only_one_run_and_diff_repo(
test=test,
test_perf_signature=test_perf_signature,
repository=test_repository,
application=new_application,
)

job = perf_jobs[1]
Expand Down Expand Up @@ -257,6 +267,8 @@ def test_perfcompare_results_with_only_one_run_and_diff_repo(
'header_name': response['header_name'],
'base_repository_name': base_sig.repository.name,
'new_repository_name': new_sig.repository.name,
'base_app': 'firefox',
'new_app': 'geckoview',
'is_complete': response['is_complete'],
'base_measurement_unit': base_sig.measurement_unit,
'new_measurement_unit': new_sig.measurement_unit,
Expand Down Expand Up @@ -413,6 +425,8 @@ def test_perfcompare_results_multiple_runs(
'header_name': first_row['header_name'],
'base_repository_name': sig1.repository.name,
'new_repository_name': sig2.repository.name,
'base_app': '',
'new_app': '',
'is_complete': first_row['is_complete'],
'base_measurement_unit': sig1.measurement_unit,
'new_measurement_unit': sig2.measurement_unit,
Expand Down Expand Up @@ -457,6 +471,8 @@ def test_perfcompare_results_multiple_runs(
'header_name': second_row['header_name'],
'base_repository_name': sig3.repository.name,
'new_repository_name': sig4.repository.name,
'base_app': '',
'new_app': '',
'is_complete': second_row['is_complete'],
'base_measurement_unit': sig3.measurement_unit,
'new_measurement_unit': sig4.measurement_unit,
Expand Down
3 changes: 3 additions & 0 deletions treeherder/webapp/api/performance_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -931,6 +931,8 @@ def list(self, request):
'new_rev': new_rev,
'header_name': header,
'platform': platform,
'base_app': base_sig.get('application', ''),
'new_app': new_sig.get('application', ''),
'suite': base_sig.get('suite', ''), # same suite for base_result and new_result
'test': base_sig.get('test', ''), # same test for base_result and new_result
'is_complete': is_complete,
Expand Down Expand Up @@ -1116,6 +1118,7 @@ def _get_signatures_values(signatures: List[PerformanceSignature]):
'measurement_unit',
'lower_is_better',
'signature_hash',
'application',
)

@staticmethod
Expand Down
10 changes: 10 additions & 0 deletions treeherder/webapp/api/performance_serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,14 @@ def validate(self, data):
class PerfCompareResultsSerializer(serializers.ModelSerializer):
base_rev = serializers.CharField()
new_rev = serializers.CharField()
base_app = serializers.CharField(
max_length=10,
default='',
)
new_app = serializers.CharField(
max_length=10,
default='',
)
is_empty = serializers.BooleanField()
is_complete = serializers.BooleanField()
platform = serializers.CharField()
Expand Down Expand Up @@ -489,6 +497,8 @@ class Meta:
fields = [
'base_rev',
'new_rev',
'base_app',
'new_app',
'framework_id',
'platform',
'suite',
Expand Down