From 0073b8a045f978cdbcb950ecdf87c08f19acf185 Mon Sep 17 00:00:00 2001 From: Tal Borenstein Date: Sun, 1 Dec 2024 15:56:25 +0200 Subject: [PATCH 1/6] feat: vector dev --- .../app/(keep)/providers/provider-tile.tsx | 10 ++- .../app/(keep)/providers/providers-tiles.tsx | 16 +++-- keep-ui/public/icons/vectordev-icon.png | Bin 0 -> 22654 bytes keep/api/tasks/process_event_task.py | 1 + keep/providers/base/base_provider.py | 4 +- keep/providers/vectordev_provider/__init__.py | 0 .../vectordev_provider/vectordev_provider.py | 64 ++++++++++++++++++ 7 files changed, 83 insertions(+), 12 deletions(-) create mode 100644 keep-ui/public/icons/vectordev-icon.png create mode 100644 keep/providers/vectordev_provider/__init__.py create mode 100644 keep/providers/vectordev_provider/vectordev_provider.py diff --git a/keep-ui/app/(keep)/providers/provider-tile.tsx b/keep-ui/app/(keep)/providers/provider-tile.tsx index 2e4ef9c95..209b1a2ba 100644 --- a/keep-ui/app/(keep)/providers/provider-tile.tsx +++ b/keep-ui/app/(keep)/providers/provider-tile.tsx @@ -165,8 +165,12 @@ export default function ProviderTile({ provider, onClick }: Props) { "min-h-36 tile-basis text-left min-w-0 py-4 px-4 relative group flex justify-around items-center bg-white rounded-lg shadow hover:grayscale-0 gap-3" + // Add fixed height only if provider card doesn't have much content (!provider.installed && !provider.linked ? " h-32" : "") + - (!provider.linked ? "cursor-pointer hover:shadow-lg" : "") + - (provider.coming_soon ? " opacity-50 cursor-not-allowed" : "") + (!provider.linked + ? " cursor-pointer hover:shadow-lg" + : " cursor-auto") + + (provider.coming_soon && !provider.linked + ? " opacity-50 cursor-not-allowed" + : "") } onClick={provider.coming_soon ? undefined : onClick} disabled={provider.coming_soon} @@ -219,7 +223,7 @@ export default function ProviderTile({ provider, onClick }: Props) {
{provider.display_name}{" "} - {provider.coming_soon && ( + {provider.coming_soon && !provider.linked && ( <span className="text-sm">(Coming Soon)</span> )} diff --git a/keep-ui/app/(keep)/providers/providers-tiles.tsx b/keep-ui/app/(keep)/providers/providers-tiles.tsx index 9e74bc65b..29030fb9f 100644 --- a/keep-ui/app/(keep)/providers/providers-tiles.tsx +++ b/keep-ui/app/(keep)/providers/providers-tiles.tsx @@ -1,5 +1,5 @@ "use client"; -import { Icon, Title } from "@tremor/react"; +import { Title } from "@tremor/react"; import { Providers, Provider } from "./providers"; import { useEffect, useState } from "react"; // TODO: replace with custom component, package is not updated for last 4 years @@ -9,6 +9,7 @@ import ProviderTile from "./provider-tile"; import "react-sliding-side-panel/lib/index.css"; import { useSearchParams } from "next/navigation"; import { QuestionMarkCircleIcon } from "@heroicons/react/24/outline"; +import { Tooltip } from "@/shared/ui"; const ProvidersTiles = ({ providers, @@ -95,12 +96,13 @@ const ProvidersTiles = ({ {getSectionTitle()} {linkedProvidersMode && (
- + Providers that send alerts to Keep and are not installed. + } + > + +
)}
diff --git a/keep-ui/public/icons/vectordev-icon.png b/keep-ui/public/icons/vectordev-icon.png new file mode 100644 index 0000000000000000000000000000000000000000..47e7d084e82f359ba6bf94b1a566387d3ef6ddee GIT binary patch literal 22654 zcmV*$KsmpOP)asF`>o0_6}z5jo^gxfBEx z!EXF3f+FRFn%m+L9)lHuL;`&}4S9nc3_-`@YZn&WsBR3JMAl zf+83N1%-$~5sZR@Ld2j5MnOR#Vo(I5pr8;jD1uQ?P>2{5!6+ywL=1{x6ciL921PIm z3JMW}A{Ye)g@{2BjDmtf#GnX9Azx@v)qUaUzG<&4AH&keJek(Y>GmiT4G^arpb*>e zbo7vmuGG5JOVVB=z|~o0gk?XPK7Ri*I%d;u{hRbXKEvsDD#Ruf!6-;kKiOTXM=Ls{ zezGHN;b)4{UumC<8wN2#^>HuPP9`YwxI|{!GhNZrnRk?q@@B#4&ERELgDI> z+;Zju-e0tpJ~?iR_i(h^s}Q?LaJm5sv4b9MJk>|`)n`>Glk^;ba*#ZMECl0!$$$nm zF4G=vkgR3=_UHb!hmRh}j8d}|Vi?MTQ9zH@o~!#lNCzDK5d%R`GRrElu~c&3`~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RnwYtcdHprN{A?J+)+6HJex!4%8OnC(^u}tr{3$+RM1D!{GdtK z827%y%3mBmzCKh<|JfAX^f66+B9bptPP??i%9uTq!{f8kG(l|`mO#`pHCA|I^>7~d z?m6dEUuL~kB-HaYx+NcIVE9ui@QfKHbfwJu1J3%w`>hbuu|2xQZtdWx8*hEHJ5nm* zANyRG<}oiKgdy1DS6F0X^qX|eT#im-{)4Fu1Eve?!Q<;SZnvM41u_>#ioXc>)i(rw zEsb@1^6&OgJ1<(NFQUzA;Mc1Nfo6#p=Rzm3EGumunBZuh|HaW37PbVm;Wk$+q$bIU z8bviz>_aYb0iDga7b^0+Yt(lL>|Ax7mt0BTHRa1~qAzD5QOkN3sP*dLYbk}Z^YUi= z%53Y@uDOYcNo5}k9Rb8xo!Az*nBn<+`_R2Xex8erFrww&WgC|Nf1$hom(`0`B_g`H ZSt+&7zxlHtO5h3;>1r8iqSPJX{{#MQ`H}zt literal 0 HcmV?d00001 diff --git a/keep/api/tasks/process_event_task.py b/keep/api/tasks/process_event_task.py index 28ed135fa..ec2cf276a 100644 --- a/keep/api/tasks/process_event_task.py +++ b/keep/api/tasks/process_event_task.py @@ -554,6 +554,7 @@ def process_event( provider_type is not None and isinstance(event, dict) or isinstance(event, FormData) + or isinstance(event, list) ): try: provider_class = ProvidersFactory.get_provider_class(provider_type) diff --git a/keep/providers/base/base_provider.py b/keep/providers/base/base_provider.py index 2a1934026..f8e430c74 100644 --- a/keep/providers/base/base_provider.py +++ b/keep/providers/base/base_provider.py @@ -316,7 +316,7 @@ def query(self, **kwargs: dict): @staticmethod def _format_alert( - event: dict, provider_instance: "BaseProvider" = None + event: dict | list[dict], provider_instance: "BaseProvider" = None ) -> AlertDto | list[AlertDto]: """ Format an incoming alert. @@ -335,7 +335,7 @@ def _format_alert( @classmethod def format_alert( cls, - event: dict, + event: dict | list[dict], tenant_id: str | None, provider_type: str | None, provider_id: str | None, diff --git a/keep/providers/vectordev_provider/__init__.py b/keep/providers/vectordev_provider/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/keep/providers/vectordev_provider/vectordev_provider.py b/keep/providers/vectordev_provider/vectordev_provider.py new file mode 100644 index 000000000..2b03ff72d --- /dev/null +++ b/keep/providers/vectordev_provider/vectordev_provider.py @@ -0,0 +1,64 @@ +import dataclasses +import json + +import pydantic + +from keep.api.models.alert import AlertDto +from keep.contextmanager.contextmanager import ContextManager +from keep.providers.base.base_provider import BaseProvider +from keep.providers.models.provider_config import ProviderConfig + + +@pydantic.dataclasses.dataclass +class VectordevProviderAuthConfig: + api_key: str = dataclasses.field( + metadata={"required": True, "description": "Zendesk API key", "sensitive": True} + ) + + +class VectordevProvider(BaseProvider): + PROVIDER_DISPLAY_NAME = "Vector" + PROVIDER_CATEGORY = ["Monitoring", "Developer Tools"] + PROVIDER_COMING_SOON = True + + def __init__( + self, context_manager: ContextManager, provider_id: str, config: ProviderConfig + ): + super().__init__(context_manager, provider_id, config) + + def validate_config(self): + self.authentication_config = VectordevProviderAuthConfig( + **self.config.authentication + ) + + def _format_alert( + event: list[dict], provider_instance: "BaseProvider" = None + ) -> AlertDto | list[AlertDto]: + events = [] + # event is a list of events + for e in event: + event_json = None + try: + event_json = json.loads(e.get("message")) + except json.JSONDecodeError: + pass + + events.append( + AlertDto( + name="", + host=e.get("host"), + message=e.get("message"), + description=e.get("message"), + lastReceived=e.get("timestamp"), + source_type=e.get("source_type"), + source=["vectordev"], + original_event=event_json, + ) + ) + return events + + def dispose(self): + """ + No need to dispose of anything, so just do nothing. + """ + pass From f6f5de6998cdbcd11aa8eecdb6465a5e9ca922ef Mon Sep 17 00:00:00 2001 From: Tal Borenstein Date: Sun, 1 Dec 2024 16:31:59 +0200 Subject: [PATCH 2/6] fix: not zendesk :) --- keep/providers/vectordev_provider/vectordev_provider.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/keep/providers/vectordev_provider/vectordev_provider.py b/keep/providers/vectordev_provider/vectordev_provider.py index 2b03ff72d..c3d6f8a9d 100644 --- a/keep/providers/vectordev_provider/vectordev_provider.py +++ b/keep/providers/vectordev_provider/vectordev_provider.py @@ -12,7 +12,7 @@ @pydantic.dataclasses.dataclass class VectordevProviderAuthConfig: api_key: str = dataclasses.field( - metadata={"required": True, "description": "Zendesk API key", "sensitive": True} + metadata={"required": True, "description": "API key", "sensitive": True} ) From 1f10aeb46f81e18348b539550a7e5ef8f4945ce2 Mon Sep 17 00:00:00 2001 From: Tal Borenstein Date: Mon, 2 Dec 2024 14:56:39 +0200 Subject: [PATCH 3/6] fix: fix --- keep/api/api.py | 13 ------------- keep/api/config.py | 15 +++++++++++++++ .../versions/2024-12-01-16-40_3ad5308e7200.py | 5 ++++- 3 files changed, 19 insertions(+), 14 deletions(-) diff --git a/keep/api/api.py b/keep/api/api.py index e0f9cf0fd..69a5141a6 100644 --- a/keep/api/api.py +++ b/keep/api/api.py @@ -52,7 +52,6 @@ ) from keep.api.routes.auth import groups as auth_groups from keep.api.routes.auth import permissions, roles, users -from keep.api.routes.dashboard import provision_dashboards from keep.event_subscriber.event_subscriber import EventSubscriber from keep.identitymanager.identitymanagerfactory import ( IdentityManagerFactory, @@ -61,9 +60,7 @@ # load all providers into cache from keep.providers.providers_factory import ProvidersFactory -from keep.providers.providers_service import ProvidersService from keep.workflowmanager.workflowmanager import WorkflowManager -from keep.workflowmanager.workflowstore import WorkflowStore load_dotenv(find_dotenv()) keep.api.logging.setup_logging() @@ -75,7 +72,6 @@ CONSUMER = os.environ.get("CONSUMER", "true") == "true" AUTH_TYPE = os.environ.get("AUTH_TYPE", IdentityManagerTypes.NOAUTH.value).lower() -PROVISION_RESOURCES = os.environ.get("PROVISION_RESOURCES", "true") == "true" try: KEEP_VERSION = metadata.version("keep") except Exception: @@ -185,15 +181,6 @@ async def root(): async def on_startup(): logger.info("Loading providers into cache") ProvidersFactory.get_all_providers() - if PROVISION_RESOURCES: - # provision providers from env. relevant only on single tenant. - logger.info("Provisioning providers and workflows") - ProvidersService.provision_providers_from_env(SINGLE_TENANT_UUID) - logger.info("Providers loaded successfully") - WorkflowStore.provision_workflows_from_directory(SINGLE_TENANT_UUID) - logger.info("Workflows provisioned successfully") - provision_dashboards(SINGLE_TENANT_UUID) - logger.info("Dashboards provisioned successfully") # Start the services logger.info("Starting the services") # Start the scheduler diff --git a/keep/api/config.py b/keep/api/config.py index a27c4b66d..dfea1b0b1 100644 --- a/keep/api/config.py +++ b/keep/api/config.py @@ -5,10 +5,14 @@ from keep.api.api import AUTH_TYPE from keep.api.core.db_on_start import migrate_db, try_create_single_tenant from keep.api.core.dependencies import SINGLE_TENANT_UUID +from keep.api.routes.dashboard import provision_dashboards from keep.identitymanager.identitymanagerfactory import IdentityManagerTypes from keep.providers.providers_factory import ProvidersFactory +from keep.providers.providers_service import ProvidersService +from keep.workflowmanager.workflowstore import WorkflowStore PORT = int(os.environ.get("PORT", 8080)) +PROVISION_RESOURCES = os.environ.get("PROVISION_RESOURCES", "true") == "true" keep.api.logging.setup_logging() logger = logging.getLogger(__name__) @@ -19,6 +23,17 @@ def on_starting(server=None): logger.info("Keep server starting") migrate_db() + + if PROVISION_RESOURCES: + # provision providers from env. relevant only on single tenant. + logger.info("Provisioning providers and workflows") + ProvidersService.provision_providers_from_env(SINGLE_TENANT_UUID) + logger.info("Providers loaded successfully") + WorkflowStore.provision_workflows_from_directory(SINGLE_TENANT_UUID) + logger.info("Workflows provisioned successfully") + provision_dashboards(SINGLE_TENANT_UUID) + logger.info("Dashboards provisioned successfully") + # Load this early and use preloading # https://www.joelsleppy.com/blog/gunicorn-application-preloading/ # @tb: 👏 @Matvey-Kuk diff --git a/keep/api/models/db/migrations/versions/2024-12-01-16-40_3ad5308e7200.py b/keep/api/models/db/migrations/versions/2024-12-01-16-40_3ad5308e7200.py index e6c2140e3..f47399b6e 100644 --- a/keep/api/models/db/migrations/versions/2024-12-01-16-40_3ad5308e7200.py +++ b/keep/api/models/db/migrations/versions/2024-12-01-16-40_3ad5308e7200.py @@ -58,7 +58,10 @@ def downgrade() -> None: existing_nullable=True, ) batch_op.alter_column( - "settings", existing_type=sa.JSON(), type_=sa.VARCHAR(length=255), nullable=False + "settings", + existing_type=sa.JSON(), + type_=sa.VARCHAR(length=255), + nullable=False, ) # ### end Alembic commands ### From 96e0cf3959666355ad163cf2680a83c4c23390b5 Mon Sep 17 00:00:00 2001 From: Tal Borenstein Date: Wed, 4 Dec 2024 13:50:15 +0200 Subject: [PATCH 4/6] fix: try fix tests --- tests/fixtures/client.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/fixtures/client.py b/tests/fixtures/client.py index e71a3a2c1..a2d76ca69 100644 --- a/tests/fixtures/client.py +++ b/tests/fixtures/client.py @@ -38,9 +38,14 @@ def test_app(monkeypatch, request): if "keep.api.api" in sys.modules: importlib.reload(sys.modules["keep.api.api"]) + if "keep.api.config" in sys.modules: + importlib.reload(sys.modules["keep.api.config"]) + # Import and return the app instance from keep.api.api import get_app + from keep.api.config import on_starting + on_starting() app = get_app() # Manually trigger the startup event From 37c7984c925d23a236e8661eb77957a8f4d4a17c Mon Sep 17 00:00:00 2001 From: Tal Borenstein Date: Wed, 4 Dec 2024 14:29:37 +0200 Subject: [PATCH 5/6] fix: tests --- keep/api/config.py | 17 +++++++++++------ tests/fixtures/client.py | 4 ++-- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/keep/api/config.py b/keep/api/config.py index dfea1b0b1..38f19b696 100644 --- a/keep/api/config.py +++ b/keep/api/config.py @@ -18,12 +18,7 @@ logger = logging.getLogger(__name__) -def on_starting(server=None): - """This function is called by the gunicorn server when it starts""" - logger.info("Keep server starting") - - migrate_db() - +def provision_resources(): if PROVISION_RESOURCES: # provision providers from env. relevant only on single tenant. logger.info("Provisioning providers and workflows") @@ -33,6 +28,16 @@ def on_starting(server=None): logger.info("Workflows provisioned successfully") provision_dashboards(SINGLE_TENANT_UUID) logger.info("Dashboards provisioned successfully") + else: + logger.info("Provisioning resources is disabled") + + +def on_starting(server=None): + """This function is called by the gunicorn server when it starts""" + logger.info("Keep server starting") + + migrate_db() + provision_resources() # Load this early and use preloading # https://www.joelsleppy.com/blog/gunicorn-application-preloading/ diff --git a/tests/fixtures/client.py b/tests/fixtures/client.py index a2d76ca69..b1787a292 100644 --- a/tests/fixtures/client.py +++ b/tests/fixtures/client.py @@ -43,9 +43,9 @@ def test_app(monkeypatch, request): # Import and return the app instance from keep.api.api import get_app - from keep.api.config import on_starting + from keep.api.config import provision_resources - on_starting() + provision_resources() app = get_app() # Manually trigger the startup event From 2fd84f487d25dc976587270fcda634f5560a7083 Mon Sep 17 00:00:00 2001 From: Tal Borenstein Date: Wed, 4 Dec 2024 18:05:10 +0200 Subject: [PATCH 6/6] fix: tests --- tests/test_provisioning.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tests/test_provisioning.py b/tests/test_provisioning.py index 6603f6bf8..679c9b75d 100644 --- a/tests/test_provisioning.py +++ b/tests/test_provisioning.py @@ -141,6 +141,11 @@ def test_reprovision_workflow(monkeypatch, db_session, client, test_app): for event_handler in app.router.on_startup: asyncio.run(event_handler()) + # manually trigger the provision resources + from keep.api.config import provision_resources + + provision_resources() + client = TestClient(get_app()) response = client.get("/workflows", headers={"x-api-key": "someapikey"}) @@ -210,6 +215,11 @@ def test_reprovision_provider(monkeypatch, db_session, client, test_app): for event_handler in app.router.on_startup: asyncio.run(event_handler()) + # manually trigger the provision resources + from keep.api.config import provision_resources + + provision_resources() + client = TestClient(app) # Step 3: Verify if the new provider is provisioned after reloading @@ -293,6 +303,11 @@ def test_reprovision_dashboard(monkeypatch, db_session, client, test_app): for event_handler in app.router.on_startup: asyncio.run(event_handler()) + # manually trigger the provision resources + from keep.api.config import provision_resources + + provision_resources() + client = TestClient(app) # Step 3: Verify if the new dashboard is provisioned after reloading