Unverified Commit 945a5729 authored by Tzu-Ling Kan's avatar Tzu-Ling Kan Committed by GitHub
Browse files

fix: Remove duplicate import and make logger global. (#2817)


Signed-off-by: default avatartzulingk@nvidia.com <tzulingk@nvidia.com>
parent a6e1d5fe
...@@ -13,9 +13,13 @@ ...@@ -13,9 +13,13 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import logging
import re
from dataclasses import dataclass from dataclasses import dataclass
from typing import Any, Dict, List, Optional from typing import Any, Dict, List, Optional
logger = logging.getLogger(__name__)
@dataclass @dataclass
class Payload: class Payload:
...@@ -92,10 +96,11 @@ def completions_response_handler(response): ...@@ -92,10 +96,11 @@ def completions_response_handler(response):
def metrics_handler(response): def metrics_handler(response):
"""Handler to check if metrics endpoint is working and contains model label.""" """Handler to check if metrics endpoint is working and contains model label."""
import logging if response.status_code != 200:
import re raise AssertionError(
f"Metrics endpoint returned non-200 status code: {response.status_code}"
)
logger = logging.getLogger(__name__)
metrics_text = response.text metrics_text = response.text
# Check for any model label in dynamo_component_requests_total metric # Check for any model label in dynamo_component_requests_total metric
......
...@@ -34,7 +34,6 @@ class EngineProcess(ManagedProcess): ...@@ -34,7 +34,6 @@ class EngineProcess(ManagedProcess):
def get_metrics(self, port=8081): def get_metrics(self, port=8081):
"""Curl the metrics endpoint and return the response.""" """Curl the metrics endpoint and return the response."""
import requests
metrics_url = f"http://localhost:{port}/metrics" metrics_url = f"http://localhost:{port}/metrics"
logger.info(f"Curling metrics endpoint: {metrics_url}") logger.info(f"Curling metrics endpoint: {metrics_url}")
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment