From 03079b58047f7d04537b1d779fa1c9b250050ebd Mon Sep 17 00:00:00 2001
From: Noah Zhu <noah.x.zhu@gmail.com>
Date: Sun, 31 Mar 2024 23:49:20 +0800
Subject: [PATCH] feat: add the trace for vector store index insert_nodes
 (#12443)

---
 .../llama_index/core/indices/vector_store/base.py            | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/llama-index-core/llama_index/core/indices/vector_store/base.py b/llama-index-core/llama_index/core/indices/vector_store/base.py
index 8795ac4b83..d4a30ff7c2 100644
--- a/llama-index-core/llama_index/core/indices/vector_store/base.py
+++ b/llama-index-core/llama_index/core/indices/vector_store/base.py
@@ -326,8 +326,9 @@ class VectorStoreIndex(BaseIndex[IndexDict]):
                     self._object_map[node.index_id] = node.obj
                     node.obj = None
 
-        self._insert(nodes, **insert_kwargs)
-        self._storage_context.index_store.add_index_struct(self._index_struct)
+        with self._callback_manager.as_trace("insert_nodes"):
+            self._insert(nodes, **insert_kwargs)
+            self._storage_context.index_store.add_index_struct(self._index_struct)
 
     def _delete_node(self, node_id: str, **delete_kwargs: Any) -> None:
         pass
-- 
GitLab