From 520c84267c3dfca7e7d00b359866578488425482 Mon Sep 17 00:00:00 2001 From: Shahar Glazner Date: Mon, 4 Nov 2024 11:02:45 +0200 Subject: [PATCH] feat(api): add version on startup logs (#2390) --- keep/api/api.py | 18 ++++++++++++++---- pyproject.toml | 2 +- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/keep/api/api.py b/keep/api/api.py index 19aa8a744..6bd4ac81d 100644 --- a/keep/api/api.py +++ b/keep/api/api.py @@ -1,6 +1,6 @@ -import os import asyncio import logging +import os from importlib import metadata import requests @@ -27,6 +27,7 @@ ) from keep.api.core.dependencies import SINGLE_TENANT_UUID from keep.api.logging import CONFIG as logging_config +from keep.api.middlewares import LoggingMiddleware from keep.api.routes import ( actions, ai, @@ -65,8 +66,6 @@ from keep.workflowmanager.workflowmanager import WorkflowManager from keep.workflowmanager.workflowstore import WorkflowStore -from keep.api.middlewares import LoggingMiddleware - load_dotenv(find_dotenv()) keep.api.logging.setup_logging() logger = logging.getLogger(__name__) @@ -99,8 +98,19 @@ def get_app( auth_type: IdentityManagerTypes = IdentityManagerTypes.NOAUTH.value, ) -> FastAPI: if not os.environ.get("KEEP_API_URL", None): + logger.info( + "KEEP_API_URL is not set, setting it to default", + extra={"keep_api_url": f"http://{HOST}:{PORT}"}, + ) os.environ["KEEP_API_URL"] = f"http://{HOST}:{PORT}" - logger.info(f"Starting Keep with {os.environ['KEEP_API_URL']} as URL") + + logger.info( + f"Starting Keep with {os.environ['KEEP_API_URL']} as URL and version {KEEP_VERSION}", + extra={ + "keep_version": KEEP_VERSION, + "keep_api_url": os.environ.get("KEEP_API_URL"), + }, + ) app = FastAPI( title="Keep API", diff --git a/pyproject.toml b/pyproject.toml index 77bf8ec09..805ff80eb 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "keep" -version = "0.28.0" +version = "0.28.1" description = "Alerting. for developers, by developers." authors = ["Keep Alerting LTD"] readme = "README.md"