Skip to content

Commit

Permalink
update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
alrocar committed Feb 14, 2025
1 parent f405166 commit caa68c9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion tinybird/endpoints/log_timeseries.pipe
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,11 @@ SQL >
{% end %}
{% if date_diff_in_hours(start_date, end_date) > 24 * 7 %}
countMerge(error_count) as error_count,
countMerge(total_requests) as total_requests,
{% if defined(level) and level != 'ERROR' %}
countMerge(total_requests) as total_requests,
{% else %}
0 as total_requests,
{% end %}
round(error_count * 100.0 / if(total_requests == 0, 1, total_requests), 2) as error_rate,
round(avgMerge(response_time_avg), 2) as avg_response_time,
round(maxMerge(response_time_max), 2) as max_response_time
Expand Down
2 changes: 1 addition & 1 deletion tinybird/tests/log_timeseries.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -615,7 +615,7 @@
description: Test timeseries with error level filter
parameters: start_date=2025-02-02%2000:00:00&end_date=2025-02-09%2023:59:59&level=ERROR
expected_result: |
{"date":"2025-02-03 00:00:00.000","error_count":26,"total_requests":26,"error_rate":100,"avg_response_time":576.23,"max_response_time":945}
{"date":"2025-02-03 00:00:00.000","error_count":26,"total_requests":0,"error_rate":2600,"avg_response_time":576.23,"max_response_time":945}
{"date":"2025-02-04 00:00:00.000","error_count":0,"total_requests":0,"error_rate":0,"avg_response_time":0,"max_response_time":0}
{"date":"2025-02-05 00:00:00.000","error_count":0,"total_requests":0,"error_rate":0,"avg_response_time":0,"max_response_time":0}
{"date":"2025-02-06 00:00:00.000","error_count":0,"total_requests":0,"error_rate":0,"avg_response_time":0,"max_response_time":0}
Expand Down

0 comments on commit caa68c9

Please sign in to comment.