Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update labels for prometheus #176

Merged
merged 1 commit into from
Nov 14, 2023
Merged
Show file tree
Hide file tree
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
6 changes: 6 additions & 0 deletions morpheus-worker/app/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
from app.handlers.text_model_handler import TextModelHandler
from app.integrations.db_client import DBClient
from app.models.schemas import GenerationRequest, TextGenerationRequest, CategoryEnum, ModelRequest, TextCategoryEnum
from app.settings.settings import get_settings

settings = get_settings()

app = FastAPI()

Expand Down Expand Up @@ -229,6 +232,9 @@ async def get_prometheus_sd(self):
try:
with open(self.prometheus_sd_file, "r") as file:
data = json.load(file)
for item in data:
if 'labels' in item:
item['labels']['ray_instance_name'] = settings.prometheus_instance_name
return data
except FileNotFoundError:
# Return an empty JSON if the file is not found
Expand Down
3 changes: 3 additions & 0 deletions morpheus-worker/app/settings/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ class Settings(BaseSettings):
enable_float32: bool = False
enable_attention_slicing: bool = True

# Prometheus
prometheus_instance_name: str = "morpheus"

def get_db_url(self) -> str:
return PostgresDsn.build(
scheme="postgresql",
Expand Down
Loading