Add [CTRL-TIMING] logs to controller create_node flow

Timing logs cover:
- create_node_from_template (entry, get_template, add_node, total)
- add_node_from_template (entry to done)
- _create_node (project_setup, node.create, total)
- Node.create (compute_post timing)
- compute._session.request (actual HTTP to compute)
This commit is contained in:
YueGuobin committed 2026-06-15 23:04:01 +08:00
1 parent e5797c3da0
commit ea4bb2c1fb
4 files changed
+28 -5

No files matched your search

+11 -1
View File
@@ -609,11 +609,21 @@ async def create_node_from_template(
Required privilege: Node.Allocate
"""
import time as _time
_t0 = _time.time()
log.info(f"[CTRL-TIMING] create_node_from_template ENTER template_id={template_id}")
template = await TemplatesService(templates_repo).get_template(template_id)
log.info(f"[CTRL-TIMING] get_template done elapsed={_time.time()-_t0:.3f}s")
controller = Controller.instance()
project = controller.get_project(str(project_id))
node = await project.add_node_from_template(
template, x=template_usage.x, y=template_usage.y, compute_id=template_usage.compute_id
)
return node.asdict()
log.info(f"[CTRL-TIMING] add_node_from_template done elapsed={_time.time()-_t0:.3f}s")
result = node.asdict()
log.info(f"[CTRL-TIMING] create_node_from_template DONE total={_time.time()-_t0:.3f}s")
return result