Skip to content

Commit

Permalink
Gatling measurement details would not be displayed.
Browse files Browse the repository at this point in the history
Fixes #10911.
  • Loading branch information
fniessink committed Feb 26, 2025
1 parent 8537157 commit 1fad11d
Show file tree
Hide file tree
Showing 9 changed files with 71 additions and 70 deletions.
6 changes: 3 additions & 3 deletions components/api_server/src/example-reports/example-report.json
Original file line number Diff line number Diff line change
Expand Up @@ -722,7 +722,7 @@
"284adba5-9aca-3a61-5847-eea6fb1d7070": {
"type": "gatling",
"parameters": {
"url": "http://testdata:8000/reports/gatling",
"url": "http://testdata:8000/reports/gatling/index.html",
"username": "",
"password": "",
"private_token": "",
Expand Down Expand Up @@ -787,7 +787,7 @@
"345acbb5-0ada-3262-5247-e2a6fb128970": {
"type": "gatling",
"parameters": {
"url": "http://testdata:8000/reports/gatling",
"url": "http://testdata:8000/reports/gatling/index.html",
"username": "",
"password": "",
"private_token": "",
Expand Down Expand Up @@ -877,7 +877,7 @@
"340acbb5-0ada-5262-53f7-eaa6f8128774": {
"type": "gatling",
"parameters": {
"url": "http://testdata:8000/reports/gatling",
"url": "http://testdata:8000/reports/gatling/index.html",
"username": "",
"password": "",
"private_token": "",
Expand Down
6 changes: 3 additions & 3 deletions components/collector/src/base_collectors/source_collector.py
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ def is_slow(
transaction_specific_target_response_times: list[str],
) -> bool:
"""Return whether the transaction is slow."""
name, response_time = self["name"], self[response_time_to_evaluate]
name, response_time = self["name"], float(self[response_time_to_evaluate])
for transaction_specific_target_response_time in transaction_specific_target_response_times:
re_or_name, target = transaction_specific_target_response_time.rsplit(":", maxsplit=1)
if match_string_or_regular_expression(name, [re_or_name]) and response_time <= float(target):
Expand Down Expand Up @@ -433,9 +433,9 @@ def _is_to_be_included_and_is_slow(self, entity: TransactionEntity) -> bool:
)

@staticmethod
def _round(value: float) -> float:
def _round(value: float) -> str:
"""Round the value at exactly one decimal."""
return round(float(value), 1)
return str(round(float(value), 1))


class MergeRequestCollector(SourceCollector):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ def _parse_json(self, json: JSON, filename: str) -> Entities:
entity = TransactionEntity(
key=transaction["name"],
name=transaction["name"],
sample_count=sample_count,
error_count=error_count,
sample_count=str(sample_count),
error_count=str(error_count),
error_percentage=self._round((float(error_count) / float(sample_count)) * 100),
mean_response_time=self._round(transaction["meanResponseTime"]["total"]),
min_response_time=self._round(transaction["minResponseTime"]["total"]),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ async def _parse_entities(self, responses: SourceResponses) -> Entities:
entity = TransactionEntity(
key=label,
name=label,
sample_count=sample_count,
error_count=error_count,
sample_count=str(sample_count),
error_count=str(error_count),
error_percentage=self._round((error_count / sample_count) * 100),
mean_response_time=self._round(statistics.mean(latencies)),
median_response_time=self._round(statistics.median(latencies)),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ def _parse_json(self, json: JSON, filename: str) -> Entities:
entity = TransactionEntity(
key=transaction["transaction"],
name=transaction["transaction"],
sample_count=transaction["sampleCount"],
error_count=transaction["errorCount"],
sample_count=str(transaction["sampleCount"]),
error_count=str(transaction["errorCount"]),
error_percentage=self._round(transaction["errorPct"]),
mean_response_time=self._round(transaction["meanResTime"]),
median_response_time=self._round(transaction["medianResTime"]),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,30 +15,30 @@ def setUp(self):
{
"key": self.API1,
"name": self.API1,
"sample_count": 123,
"error_count": 2,
"error_percentage": round((2.0 / 123) * 100, 1),
"mean_response_time": 110.0,
"min_response_time": 50.0,
"max_response_time": 250.0,
"percentile_50_response_time": 100.0,
"percentile_75_response_time": 115.0,
"percentile_95_response_time": 135.0,
"percentile_99_response_time": 195.0,
"sample_count": "123",
"error_count": "2",
"error_percentage": str(round((2.0 / 123) * 100, 1)),
"mean_response_time": "110.0",
"min_response_time": "50.0",
"max_response_time": "250.0",
"percentile_50_response_time": "100.0",
"percentile_75_response_time": "115.0",
"percentile_95_response_time": "135.0",
"percentile_99_response_time": "195.0",
},
{
"key": self.API2,
"name": self.API2,
"sample_count": 125,
"error_count": 4,
"error_percentage": round((4.0 / 125) * 100, 1),
"mean_response_time": 110.6,
"min_response_time": 40.0,
"max_response_time": 2500.0,
"percentile_50_response_time": 90.0,
"percentile_75_response_time": 120.0,
"percentile_95_response_time": 150.0,
"percentile_99_response_time": 190.0,
"sample_count": "125",
"error_count": "4",
"error_percentage": str(round((4.0 / 125) * 100, 1)),
"mean_response_time": "110.6",
"min_response_time": "40.0",
"max_response_time": "2500.0",
"percentile_50_response_time": "90.0",
"percentile_75_response_time": "120.0",
"percentile_95_response_time": "150.0",
"percentile_99_response_time": "190.0",
},
]
self.set_source_parameter("target_response_time", "10")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,36 +11,36 @@ class JMeterCSVSlowTransactionsTest(JMeterCSVTestCase):
def setUp(self):
"""Extend to set the expected entities."""
super().setUp()
search_endpoint_mean_response_time = search_endpoint_median_response_time = round((360 + 1214) / 2, 1)
home_endpoint_mean_response_time = home_endpoint_median_response_time = round((57 + 10) / 2, 1)
search_endpoint_mean_response_time = search_endpoint_median_response_time = str(round((360 + 1214) / 2, 1))
home_endpoint_mean_response_time = home_endpoint_median_response_time = str(round((57 + 10) / 2, 1))
self.expected_entities = [
{
"key": "-api-search",
"name": "/api/search",
"sample_count": 2,
"error_count": 0,
"error_percentage": 0.0,
"sample_count": "2",
"error_count": "0",
"error_percentage": "0.0",
"mean_response_time": search_endpoint_mean_response_time,
"median_response_time": search_endpoint_median_response_time,
"min_response_time": 360.0,
"max_response_time": 1214.0,
"percentile_90_response_time": 1811.8,
"percentile_95_response_time": 1939.9,
"percentile_99_response_time": 2042.4,
"min_response_time": "360.0",
"max_response_time": "1214.0",
"percentile_90_response_time": "1811.8",
"percentile_95_response_time": "1939.9",
"percentile_99_response_time": "2042.4",
},
{
"key": "-home",
"name": "/home",
"sample_count": 2,
"error_count": 1,
"error_percentage": 50.0,
"sample_count": "2",
"error_count": "1",
"error_percentage": "50.0",
"mean_response_time": home_endpoint_mean_response_time,
"median_response_time": home_endpoint_median_response_time,
"min_response_time": 10.0,
"max_response_time": 57.0,
"percentile_90_response_time": 89.9,
"percentile_95_response_time": 97.0,
"percentile_99_response_time": 102.6,
"min_response_time": "10.0",
"max_response_time": "57.0",
"percentile_90_response_time": "89.9",
"percentile_95_response_time": "97.0",
"percentile_99_response_time": "102.6",
},
]
self.set_source_parameter("target_response_time", "10")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,30 +15,30 @@ def setUp(self):
{
"key": "-api-foo",
"name": self.API1,
"sample_count": 123,
"error_count": 2,
"error_percentage": round(2 / 123, 1),
"mean_response_time": 110.0,
"median_response_time": 120.0,
"min_response_time": 50.0,
"max_response_time": 250.0,
"percentile_90_response_time": 115.0,
"percentile_95_response_time": 135.0,
"percentile_99_response_time": 195.0,
"sample_count": "123",
"error_count": "2",
"error_percentage": str(round(2 / 123, 1)),
"mean_response_time": "110.0",
"median_response_time": "120.0",
"min_response_time": "50.0",
"max_response_time": "250.0",
"percentile_90_response_time": "115.0",
"percentile_95_response_time": "135.0",
"percentile_99_response_time": "195.0",
},
{
"key": "-api-bar",
"name": self.API2,
"sample_count": 125,
"error_count": 4,
"error_percentage": round(4 / 125, 1),
"mean_response_time": 110.6,
"median_response_time": 130.0,
"min_response_time": 40.0,
"max_response_time": 2500.0,
"percentile_90_response_time": 120.0,
"percentile_95_response_time": 150.0,
"percentile_99_response_time": 190.0,
"sample_count": "125",
"error_count": "4",
"error_percentage": str(round(4 / 125, 1)),
"mean_response_time": "110.6",
"median_response_time": "130.0",
"min_response_time": "40.0",
"max_response_time": "2500.0",
"percentile_90_response_time": "120.0",
"percentile_95_response_time": "150.0",
"percentile_99_response_time": "190.0",
},
]
self.set_source_parameter("target_response_time", "10")
Expand Down
1 change: 1 addition & 0 deletions docs/src/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ If your currently installed *Quality-time* version is not the latest version, pl
- The software documentation was outdated (among other things, the API-server health check endpoint). Fixes [#10858](https://github.com/ICTU/quality-time/issues/10858).
- Keep the footer at the bottom of the page even if the report is very short. Fixes [#10877](https://github.com/ICTU/quality-time/issues/10877).
- Automatically expand long comments when exporting to PDF. Fixes [#10892](https://github.com/ICTU/quality-time/issues/10892).
- Gatling and JMeter measurement details of type integer and float (such as sample count and mean response time) would not be collected. Fixes [#10911](https://github.com/ICTU/quality-time/issues/10911).

### Removed

Expand Down

0 comments on commit 1fad11d

Please sign in to comment.