-
Notifications
You must be signed in to change notification settings - Fork 6.6k
Add a none provider to the ai-agent-conversation module #14064
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
wu-sheng
merged 1 commit into
apache:master
from
kezhenxu94:ai-agent-conversation-none-provider
Sep 10, 2026
+220
−1
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
75 changes: 75 additions & 0 deletions
75
...g/apache/skywalking/oap/server/ai/agent/conversation/NoneAIAgentConversationProvider.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,75 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one or more | ||
| * contributor license agreements. See the NOTICE file distributed with | ||
| * this work for additional information regarding copyright ownership. | ||
| * The ASF licenses this file to You under the Apache License, Version 2.0 | ||
| * (the "License"); you may not use this file except in compliance with | ||
| * the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| * | ||
| */ | ||
|
|
||
| package org.apache.skywalking.oap.server.ai.agent.conversation; | ||
|
|
||
| import org.apache.skywalking.oap.server.ai.agent.conversation.query.IConversationQueryService; | ||
| import org.apache.skywalking.oap.server.ai.agent.conversation.query.NoneConversationQueryService; | ||
| import org.apache.skywalking.oap.server.core.analysis.DisableRegister; | ||
| import org.apache.skywalking.oap.server.core.analysis.manual.aiagent.AIAgentSessionDataRecord; | ||
| import org.apache.skywalking.oap.server.core.analysis.manual.aiagent.AIAgentSessionFlowRecord; | ||
| import org.apache.skywalking.oap.server.library.module.ModuleConfig; | ||
| import org.apache.skywalking.oap.server.library.module.ModuleDefine; | ||
| import org.apache.skywalking.oap.server.library.module.ModuleProvider; | ||
| import org.apache.skywalking.oap.server.library.module.ServiceNotProvidedException; | ||
|
|
||
| /** | ||
| * The module doing nothing: no model is created in the storage, no file is stored, no query is answered and the | ||
| * conversation view route is not registered. The module cannot be removed with the <code>-</code> selector, | ||
| * because the GraphQL query module requires it, so this provider is how the feature is turned off. | ||
| */ | ||
| public class NoneAIAgentConversationProvider extends ModuleProvider { | ||
| @Override | ||
| public String name() { | ||
| return "none"; | ||
| } | ||
|
|
||
| @Override | ||
| public Class<? extends ModuleDefine> module() { | ||
| return AIAgentConversationModule.class; | ||
| } | ||
|
|
||
| @Override | ||
| public ConfigCreator<? extends ModuleConfig> newConfigCreator() { | ||
| return null; | ||
| } | ||
|
|
||
| @Override | ||
| public void prepare() throws ServiceNotProvidedException { | ||
| // The core module scans @Stream in its start(), after every provider's prepare(), so the two models are | ||
| // disabled here: their tables are never created, nor the BanyanDB group they are the only members of. | ||
| // A record with no worker is dropped by RecordStreamProcessor, so the LAL rule stores nothing either; | ||
| // drop `ai-agent` from SW_LOG_LAL_FILES to skip verifying the files it still parses. | ||
| DisableRegister.INSTANCE.add(AIAgentSessionDataRecord.INDEX_NAME); | ||
| DisableRegister.INSTANCE.add(AIAgentSessionFlowRecord.INDEX_NAME); | ||
| registerServiceImplementation(IConversationQueryService.class, new NoneConversationQueryService()); | ||
| } | ||
|
|
||
| @Override | ||
| public void start() throws ServiceNotProvidedException { | ||
| } | ||
|
|
||
| @Override | ||
| public void notifyAfterCompleted() throws ServiceNotProvidedException { | ||
| } | ||
|
|
||
| @Override | ||
| public String[] requiredModules() { | ||
| return new String[0]; | ||
| } | ||
| } |
67 changes: 67 additions & 0 deletions
67
...pache/skywalking/oap/server/ai/agent/conversation/query/NoneConversationQueryService.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one or more | ||
| * contributor license agreements. See the NOTICE file distributed with | ||
| * this work for additional information regarding copyright ownership. | ||
| * The ASF licenses this file to You under the Apache License, Version 2.0 | ||
| * (the "License"); you may not use this file except in compliance with | ||
| * the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| * | ||
| */ | ||
|
|
||
| package org.apache.skywalking.oap.server.ai.agent.conversation.query; | ||
|
|
||
| import java.util.List; | ||
| import java.util.Map; | ||
| import javax.annotation.Nullable; | ||
| import org.apache.skywalking.oap.server.ai.agent.conversation.query.type.ConversationList; | ||
| import org.apache.skywalking.oap.server.ai.agent.conversation.query.type.ConversationRawFiles; | ||
| import org.apache.skywalking.oap.server.core.query.input.Duration; | ||
|
|
||
| /** | ||
| * Answers every query of a disabled module with nothing, so that the GraphQL query module, which requires the | ||
| * {@link org.apache.skywalking.oap.server.ai.agent.conversation.AIAgentConversationModule}, still boots and its | ||
| * two conversation queries answer instead of failing. | ||
| */ | ||
| public class NoneConversationQueryService implements IConversationQueryService { | ||
| private static final String DISABLED = | ||
| "The ai-agent-conversation module is disabled, its selector is none."; | ||
|
|
||
| @Override | ||
| public ConversationList listConversations(final String serviceId, | ||
| @Nullable final String serviceInstanceId, | ||
| @Nullable final String conversation, | ||
| @Nullable final String title, | ||
| final Duration duration, | ||
| @Nullable final Integer limit) { | ||
| final ConversationList list = new ConversationList(); | ||
| list.setErrorReason(DISABLED); | ||
| return list; | ||
| } | ||
|
|
||
| @Nullable | ||
| @Override | ||
| public Map<String, Object> buildConversationView(final String serviceId, | ||
| @Nullable final String serviceInstanceId, | ||
| final String conversation) { | ||
| return null; | ||
| } | ||
|
|
||
| @Override | ||
| public ConversationRawFiles getConversationRawFiles(final String serviceId, | ||
| @Nullable final String serviceInstanceId, | ||
| final String conversation, | ||
| @Nullable final List<String> files, | ||
| final boolean includeBody) { | ||
| final ConversationRawFiles rawFiles = new ConversationRawFiles(); | ||
| rawFiles.setErrorReason(DISABLED); | ||
| return rawFiles; | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
...ache/skywalking/oap/server/ai/agent/conversation/NoneAIAgentConversationProviderTest.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one or more | ||
| * contributor license agreements. See the NOTICE file distributed with | ||
| * this work for additional information regarding copyright ownership. | ||
| * The ASF licenses this file to You under the Apache License, Version 2.0 | ||
| * (the "License"); you may not use this file except in compliance with | ||
| * the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| * | ||
| */ | ||
|
|
||
| package org.apache.skywalking.oap.server.ai.agent.conversation; | ||
|
|
||
| import java.util.Collections; | ||
| import org.apache.skywalking.oap.server.ai.agent.conversation.query.IConversationQueryService; | ||
| import org.apache.skywalking.oap.server.core.analysis.DisableRegister; | ||
| import org.apache.skywalking.oap.server.core.analysis.manual.aiagent.AIAgentSessionDataRecord; | ||
| import org.apache.skywalking.oap.server.core.analysis.manual.aiagent.AIAgentSessionFlowRecord; | ||
| import org.apache.skywalking.oap.server.core.query.input.Duration; | ||
| import org.junit.jupiter.api.Test; | ||
|
|
||
| import static org.junit.jupiter.api.Assertions.assertEquals; | ||
| import static org.junit.jupiter.api.Assertions.assertNull; | ||
| import static org.junit.jupiter.api.Assertions.assertNotNull; | ||
| import static org.junit.jupiter.api.Assertions.assertTrue; | ||
|
|
||
| public class NoneAIAgentConversationProviderTest { | ||
| @Test | ||
| public void testTheDisabledModuleStoresAndAnswersNothing() throws Exception { | ||
| final NoneAIAgentConversationProvider provider = new NoneAIAgentConversationProvider(); | ||
| assertEquals("none", provider.name()); | ||
| assertEquals(AIAgentConversationModule.class, provider.module()); | ||
| assertNull(provider.newConfigCreator()); | ||
| assertEquals(0, provider.requiredModules().length); | ||
|
|
||
| provider.prepare(); | ||
|
|
||
| // Without the models the storage creates neither table, and RecordStreamProcessor has no worker to | ||
| // dispatch a file to. | ||
| assertTrue(DisableRegister.INSTANCE.include(AIAgentSessionDataRecord.INDEX_NAME)); | ||
| assertTrue(DisableRegister.INSTANCE.include(AIAgentSessionFlowRecord.INDEX_NAME)); | ||
|
|
||
| final IConversationQueryService service = provider.getService(IConversationQueryService.class); | ||
| assertNotNull(service); | ||
| assertTrue(service.listConversations("1", null, null, null, new Duration(), null) | ||
| .getConversations() | ||
| .isEmpty()); | ||
| assertNotNull(service.listConversations("1", null, null, null, new Duration(), null).getErrorReason()); | ||
| assertNull(service.buildConversationView("1", null, "c")); | ||
| assertTrue(service.getConversationRawFiles("1", null, "c", Collections.emptyList(), true) | ||
| .getFiles() | ||
| .isEmpty()); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I’ll leave it to you to decide if we should disable it by default @wu-sheng