Skip to content
Merged
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
7 changes: 5 additions & 2 deletions comps/cores/mega/http_service.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Copyright (C) 2024 Intel Corporation
# SPDX-License-Identifier: Apache-2.0

import re
from typing import Optional

from fastapi import FastAPI
Expand Down Expand Up @@ -35,8 +36,10 @@ def __init__(
self._app = self._create_app()

# remove part before '@', used by register_microservice() callers, and
# part after '/', added by MicroService(), to get real service name
suffix = self.title.split("/")[0].split("@")[-1].lower()
# part after '/', added by MicroService(), to get real service name, and
# convert invalid characters to '_'
suffix = re.sub(r"[^a-zA-Z0-9]", "_", self.title.split("/")[0].split("@")[-1].lower())

instrumentator = Instrumentator(
inprogress_name=f"http_requests_inprogress_{suffix}",
should_instrument_requests_inprogress=True,
Expand Down