Skip to content

Commit bd78f3b

Browse files
chore(extensibility): improving logging for extensibility module (#270)
Co-authored-by: Nicole Gomes <47161082+NicoleMGomes@users.noreply.github.com>
1 parent b8d7ab1 commit bd78f3b

2 files changed

Lines changed: 25 additions & 1 deletion

File tree

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "sap-cloud-sdk"
3-
version = "0.45.0"
3+
version = "0.45.1"
44
description = "SAP Cloud SDK for Python"
55
readme = "README.md"
66
license = "Apache-2.0"

src/sap_cloud_sdk/extensibility/client.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,7 @@ def get_extension_capability_implementation(
199199
tenant="1d2e1a41-a28b-431f-9e3f-42e9704bfa75",
200200
)
201201
"""
202+
logger.info("Fetching extension capabilities for tenant=%s", tenant)
202203
try:
203204
return self._transport.get_extension_capability_implementation(
204205
capability_id=capability_id,
@@ -415,6 +416,7 @@ async def _discover_n8n_tools(
415416
f"MCP tool '{_EXECUTE_WORKFLOW_TOOL_NAME}' on server '{_N8N_MCP_SERVER_NAME}' "
416417
"not found via Agent Gateway."
417418
)
419+
logger.info("Fetched n8n execute_tool: %s", _EXECUTE_WORKFLOW_TOOL_NAME)
418420

419421
get_exec_tool = next(
420422
(
@@ -430,6 +432,7 @@ async def _discover_n8n_tools(
430432
f"MCP tool '{_GET_EXECUTION_TOOL_NAME}' on server '{_N8N_MCP_SERVER_NAME}' "
431433
"not found via Agent Gateway."
432434
)
435+
logger.info("Fetched n8n get_exec_tool: %s", _GET_EXECUTION_TOOL_NAME)
433436

434437
return execute_tool, get_exec_tool
435438

@@ -455,6 +458,7 @@ async def _execute_workflow_via_agw(
455458
},
456459
},
457460
}
461+
logger.info("Executing workflow id=%s", hook.n8n_workflow_config.workflow_id)
458462
try:
459463
result_str = await agw_client.call_mcp_tool(
460464
execute_tool,
@@ -480,6 +484,11 @@ async def _execute_workflow_via_agw(
480484
)
481485

482486
execution_id = data.get("executionId")
487+
logger.info(
488+
"Workflow execution complete: execution_id=%s, status=%s",
489+
execution_id,
490+
status,
491+
)
483492
return str(execution_id), status
484493

485494
@staticmethod
@@ -511,6 +520,11 @@ async def _poll_hook_execution(
511520
) -> Optional[Message]:
512521
deadline = time.monotonic() + hook.timeout
513522
last_status = initial_status
523+
logger.info(
524+
"Polling for workflow %s execution result (timeout=%ss)",
525+
hook.n8n_workflow_config.workflow_id,
526+
hook.timeout,
527+
)
514528

515529
while time.monotonic() < deadline:
516530
await asyncio.sleep(_HOOK_POLL_INTERVAL)
@@ -541,6 +555,7 @@ async def _poll_hook_execution(
541555
)
542556

543557
if last_status == "success":
558+
logger.info("Execution %s completed successfully", execution_id)
544559
return self._extract_message(data)
545560

546561
if last_status in _EXECUTION_TERMINAL_STATUSES:
@@ -615,12 +630,21 @@ async def call_hook_agw(
615630
agw_client = create_agw_client(
616631
tenant_subdomain, _telemetry_source=Module.EXTENSIBILITY
617632
)
633+
logger.info(
634+
"AGW client created successfully for tenant_subdomain=%s", tenant_subdomain
635+
)
618636
execute_tool, get_exec_tool = await self._discover_n8n_tools(
619637
agw_client, user_token
620638
)
639+
logger.info("Discovered n8n tools")
621640
execution_id, status = await self._execute_workflow_via_agw(
622641
agw_client, execute_tool, hook, user_token, message, headers
623642
)
643+
logger.info(
644+
"Workflow triggered: execution_id=%s, initial_status=%s",
645+
execution_id,
646+
status,
647+
)
624648
return await self._poll_hook_execution(
625649
agw_client, get_exec_tool, hook, execution_id, user_token, status
626650
)

0 commit comments

Comments
 (0)