Skip to content

Commit e596681

Browse files
HDDS-15570. [Recon-Chatbot] Call Recon methods directly instead of using HTTP-calls. (#10524).
Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent 208d4bd commit e596681

37 files changed

Lines changed: 4067 additions & 8084 deletions

hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/ReconConstants.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,13 @@ public final class ReconConstants {
6363
public static final String RECON_QUERY_BUCKET = "bucket";
6464
public static final String RECON_QUERY_FILE_SIZE = "fileSize";
6565
public static final String RECON_QUERY_CONTAINER_SIZE = "containerSize";
66+
public static final String RECON_QUERY_CONTAINER_STATE = "state";
67+
public static final String RECON_QUERY_REPLICATION_TYPE = "replicationType";
68+
public static final String RECON_QUERY_CREATION_DATE = "creationDate";
69+
public static final String RECON_QUERY_KEY_SIZE = "keySize";
70+
public static final String RECON_NAMESPACE_USAGE_FILES = "files";
71+
public static final String RECON_NAMESPACE_USAGE_REPLICA = "replica";
72+
public static final String RECON_NAMESPACE_USAGE_SORT_SUB_PATHS = "sortSubPaths";
6673
public static final String RECON_ENTITY_PATH = "path";
6774
public static final String RECON_ENTITY_TYPE = "entityType";
6875
public static final String RECON_ACCESS_METADATA_START_DATE = "startDate";

hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/chatbot/ChatbotConfigKeys.java

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,6 @@ public final class ChatbotConfigKeys {
6363
public static final String OZONE_RECON_CHATBOT_GEMINI_BASE_URL_DEFAULT = "https://generativelanguage.googleapis.com/v1beta/openai/";
6464

6565
// ── Execution policy ────────────────────────────────────────
66-
// Total records aggregated for an answer are bounded by exec.max.pages * exec.page.size.
67-
public static final String OZONE_RECON_CHATBOT_EXEC_MAX_PAGES = OZONE_RECON_CHATBOT_PREFIX + "exec.max.pages";
68-
public static final int OZONE_RECON_CHATBOT_EXEC_MAX_PAGES_DEFAULT = 5;
69-
public static final String OZONE_RECON_CHATBOT_EXEC_PAGE_SIZE = OZONE_RECON_CHATBOT_PREFIX + "exec.page.size";
70-
public static final int OZONE_RECON_CHATBOT_EXEC_PAGE_SIZE_DEFAULT = 200;
7166

7267
public static final String OZONE_RECON_CHATBOT_EXEC_REQUIRE_SAFE_SCOPE = OZONE_RECON_CHATBOT_PREFIX
7368
+ "exec.require.safe.scope";
@@ -77,24 +72,6 @@ public final class ChatbotConfigKeys {
7772
public static final String OZONE_RECON_CHATBOT_MAX_TOOL_CALLS = OZONE_RECON_CHATBOT_PREFIX + "max.tool.calls";
7873
public static final int OZONE_RECON_CHATBOT_MAX_TOOL_CALLS_DEFAULT = 5;
7974

80-
// ── ToolExecutor HTTP timeouts (loopback calls to Recon REST APIs) ───────
81-
/**
82-
* Connect timeout in milliseconds for loopback HTTP calls from ToolExecutor
83-
* to Recon's own REST APIs. Increase this on slow or heavily loaded clusters.
84-
*/
85-
public static final String OZONE_RECON_CHATBOT_EXEC_CONNECT_TIMEOUT_MS =
86-
OZONE_RECON_CHATBOT_PREFIX + "exec.connect.timeout.ms";
87-
public static final int OZONE_RECON_CHATBOT_EXEC_CONNECT_TIMEOUT_MS_DEFAULT = 30_000;
88-
89-
/**
90-
* Read timeout in milliseconds for loopback HTTP calls from ToolExecutor
91-
* to Recon's own REST APIs. Increase this when Recon APIs are slow due to
92-
* large dataset sizes (e.g. millions of unhealthy containers).
93-
*/
94-
public static final String OZONE_RECON_CHATBOT_EXEC_READ_TIMEOUT_MS =
95-
OZONE_RECON_CHATBOT_PREFIX + "exec.read.timeout.ms";
96-
public static final int OZONE_RECON_CHATBOT_EXEC_READ_TIMEOUT_MS_DEFAULT = 30_000;
97-
9875
// ── Async execution thread pool ──────────────────────────────
9976
/**
10077
* Number of threads in the dedicated thread pool used to execute chatbot

hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/chatbot/ChatbotModule.java

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,13 @@
2020
import com.google.inject.AbstractModule;
2121
import com.google.inject.Scopes;
2222
import org.apache.hadoop.ozone.recon.chatbot.agent.ChatbotAgent;
23-
import org.apache.hadoop.ozone.recon.chatbot.agent.ToolExecutor;
23+
import org.apache.hadoop.ozone.recon.chatbot.agent.LlmToolSpecFactory;
2424
import org.apache.hadoop.ozone.recon.chatbot.api.ChatbotEndpoint;
2525
import org.apache.hadoop.ozone.recon.chatbot.llm.LLMClient;
2626
import org.apache.hadoop.ozone.recon.chatbot.llm.LangChain4jDispatcher;
27+
import org.apache.hadoop.ozone.recon.chatbot.recon.ReconApiAllowlist;
28+
import org.apache.hadoop.ozone.recon.chatbot.recon.ReconEndpointRouter;
29+
import org.apache.hadoop.ozone.recon.chatbot.recon.ReconQueryExecutor;
2730
import org.apache.hadoop.ozone.recon.chatbot.security.CredentialHelper;
2831

2932
/**
@@ -39,8 +42,11 @@ protected void configure() {
3942
// Bind LLM provider — LangChain4j-backed dispatcher handles all three providers
4043
bind(LLMClient.class).to(LangChain4jDispatcher.class).in(Scopes.SINGLETON);
4144

42-
// Bind agent components
43-
bind(ToolExecutor.class).in(Scopes.SINGLETON);
45+
// Recon data access (direct endpoint bean calls)
46+
bind(ReconEndpointRouter.class).in(Scopes.SINGLETON);
47+
bind(ReconApiAllowlist.class).in(Scopes.SINGLETON);
48+
bind(ReconQueryExecutor.class).in(Scopes.SINGLETON);
49+
bind(LlmToolSpecFactory.class).in(Scopes.SINGLETON);
4450
bind(ChatbotAgent.class).in(Scopes.SINGLETON);
4551

4652
// Bind API endpoint

0 commit comments

Comments
 (0)