diff --git a/x-pack/plugins/elastic_assistant/server/lib/telemetry/event_based_telemetry.ts b/x-pack/plugins/elastic_assistant/server/lib/telemetry/event_based_telemetry.ts index 92330b4960e76..03e9e1d225ae1 100644 --- a/x-pack/plugins/elastic_assistant/server/lib/telemetry/event_based_telemetry.ts +++ b/x-pack/plugins/elastic_assistant/server/lib/telemetry/event_based_telemetry.ts @@ -77,13 +77,16 @@ export const INVOKE_ASSISTANT_SUCCESS_EVENT: EventTypeOpts<{ actionTypeId: string; isEnabledKnowledgeBase: boolean; durationMs: number; - ['toolsInvoked.AlertCountsTool']?: number; - ['toolsInvoked.NaturalLanguageESQLTool']?: number; - ['toolsInvoked.KnowledgeBaseRetrievalTool']?: number; - ['toolsInvoked.KnowledgeBaseWriteTool']?: number; - ['toolsInvoked.OpenAndAcknowledgedAlertsTool']?: number; - ['toolsInvoked.SecurityLabsKnowledgeBaseTool']?: number; - ['toolsInvoked.CustomTool']?: number; + toolsInvoked: { + AlertCountsTool?: number; + NaturalLanguageESQLTool?: number; + KnowledgeBaseRetrievalTool?: number; + KnowledgeBaseWriteTool?: number; + OpenAndAcknowledgedAlertsTool?: number; + SecurityLabsKnowledgeBaseTool?: number; + ProductDocumentationTool?: number; + CustomTool?: number; + }; model?: string; isOssModel?: boolean; }> = { @@ -127,53 +130,64 @@ export const INVOKE_ASSISTANT_SUCCESS_EVENT: EventTypeOpts<{ description: 'The duration of the request.', }, }, - 'toolsInvoked.AlertCountsTool': { - type: 'long', - _meta: { - description: 'Number of times tool was invoked.', - optional: true, - }, - }, - 'toolsInvoked.NaturalLanguageESQLTool': { - type: 'long', - _meta: { - description: 'Number of times tool was invoked.', - optional: true, - }, - }, - 'toolsInvoked.KnowledgeBaseRetrievalTool': { - type: 'long', - _meta: { - description: 'Number of times tool was invoked.', - optional: true, - }, - }, - 'toolsInvoked.KnowledgeBaseWriteTool': { - type: 'long', - _meta: { - description: 'Number of times tool was invoked.', - optional: true, - }, - }, - 'toolsInvoked.OpenAndAcknowledgedAlertsTool': { - type: 'long', - _meta: { - description: 'Number of times tool was invoked.', - optional: true, - }, - }, - 'toolsInvoked.SecurityLabsKnowledgeBaseTool': { - type: 'long', - _meta: { - description: 'Number of times tool was invoked.', - optional: true, - }, - }, - 'toolsInvoked.CustomTool': { - type: 'long', - _meta: { - description: 'Number of times tool was invoked.', - optional: true, + toolsInvoked: { + properties: { + AlertCountsTool: { + type: 'long', + _meta: { + description: 'Number of times tool was invoked.', + optional: true, + }, + }, + NaturalLanguageESQLTool: { + type: 'long', + _meta: { + description: 'Number of times tool was invoked.', + optional: true, + }, + }, + ProductDocumentationTool: { + type: 'long', + _meta: { + description: 'Number of times tool was invoked.', + optional: true, + }, + }, + KnowledgeBaseRetrievalTool: { + type: 'long', + _meta: { + description: 'Number of times tool was invoked.', + optional: true, + }, + }, + KnowledgeBaseWriteTool: { + type: 'long', + _meta: { + description: 'Number of times tool was invoked.', + optional: true, + }, + }, + OpenAndAcknowledgedAlertsTool: { + type: 'long', + _meta: { + description: 'Number of times tool was invoked.', + optional: true, + }, + }, + SecurityLabsKnowledgeBaseTool: { + type: 'long', + _meta: { + description: 'Number of times tool was invoked.', + optional: true, + }, + }, + CustomTool: { + type: 'long', + _meta: { + description: 'Number of times tool was invoked.', + optional: true, + }, + }, }, }, }, diff --git a/x-pack/plugins/security_solution/server/assistant/tools/index.ts b/x-pack/plugins/security_solution/server/assistant/tools/index.ts index dc32e01335b30..dd2aa8e54ebdf 100644 --- a/x-pack/plugins/security_solution/server/assistant/tools/index.ts +++ b/x-pack/plugins/security_solution/server/assistant/tools/index.ts @@ -14,6 +14,8 @@ import { KNOWLEDGE_BASE_RETRIEVAL_TOOL } from './knowledge_base/knowledge_base_r import { KNOWLEDGE_BASE_WRITE_TOOL } from './knowledge_base/knowledge_base_write_tool'; import { SECURITY_LABS_KNOWLEDGE_BASE_TOOL } from './security_labs/security_labs_tool'; +// any new tool should also be added to telemetry schema in +// x-pack/solutions/security/plugins/elastic_assistant/server/lib/telemetry/event_based_telemetry.ts export const assistantTools = [ ALERT_COUNTS_TOOL, DEFEND_INSIGHTS_TOOL,