Skip to content
Open
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
5 changes: 5 additions & 0 deletions python/ray/serve/tests/test_metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
from ray.serve.generated import serve_pb2, serve_pb2_grpc
from ray.util.state import list_actors

ALLOWED_ROUTES = ("/-/healthz", "/-/routes")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think EXCLUDED_ROUTES is more fitting. Also do we need to include /-/routes?



def extract_tags(line: str) -> Dict[str, str]:
"""Extracts any tags from the metrics line."""
Expand Down Expand Up @@ -168,6 +170,7 @@ def metric_available() -> bool:
metric_dict_str = f"dict({line[dict_body_start:dict_body_end]})"
metric_dicts.append(eval(metric_dict_str))

metric_dicts = [d for d in metric_dicts if d.get("route") not in ALLOWED_ROUTES]
print(metric_dicts)
return metric_dicts

Expand Down Expand Up @@ -713,6 +716,8 @@ def check_request_count_metrics(
error_count = 0
success_count = 0
for line in resp.split("\n"):
if any(f'route="{route}"' in line for route in ALLOWED_ROUTES):
continue
Comment on lines +719 to +720
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can simplify the expression if we're just checking for /-/healthz

if line.startswith("ray_serve_num_http_error_requests_total"):
error_count += int(float(line.split(" ")[-1]))
if line.startswith("ray_serve_num_http_requests_total"):
Expand Down