Skip to content
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

[Security solution] Knowledge base entry telemetry #199225

Merged
merged 14 commits into from
Nov 12, 2024

Conversation

stephmilovic
Copy link
Contributor

@stephmilovic stephmilovic commented Nov 6, 2024

Summary

Adds 2 new events for tracking knowledge base entry creation:

Screenshot 2024-11-08 at 2 30 43 PM Screenshot 2024-11-08 at 2 30 25 PM

Updates the INVOKE_ASSISTANT_SUCCESS event to track request duration, tools invoked, and optionally isOssModel:

Screenshot 2024-11-08 at 2 31 31 PM

Allows the addition of 2 new charts to GenAI Dashboard

Screenshot 2024-11-08 at 2 34 01 PM Screenshot 2024-11-08 at 2 34 32 PM

Moved INVOKE_ASSISTANT_SUCCESS event

Moved the INVOKE_ASSISTANT_SUCCESS to be reported from the LangChain tracers in order to get information about the run.

@stephmilovic stephmilovic added WIP Work in progress release_note:skip Skip the PR/issue when compiling release notes v9.0.0 Team: SecuritySolution Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc. Team:Security Generative AI Security Generative AI backport:version Backport to applied version labels v8.17.0 v8.16.1 labels Nov 6, 2024
@stephmilovic stephmilovic marked this pull request as ready for review November 8, 2024 21:36
@stephmilovic stephmilovic requested review from a team as code owners November 8, 2024 21:36
@elasticmachine
Copy link
Contributor

Pinging @elastic/security-solution (Team: SecuritySolution)

Copy link
Contributor

@e40pud e40pud left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding telemetries, LGTM!! Left a few questions regarding bulk actions.

@@ -82,6 +84,16 @@ const buildBulkResponse = (
skipped,
};

if (created.length) {
created.forEach((entry) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be done after the successful bulk create entry operation? Just wondering if we partially created entries and some of them failed, in this case we still will report that all of them were created in telemetry?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

buildBulkResponse is called after the request has already been completed, so only created entries exist here

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ohh, I missed that this is inside buildBulkResponse :-)

response,
{
// @ts-ignore-next-line TS2322
updated: transformESToKnowledgeBase(docsUpdated),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we could also add telemetry for update and delete operations.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, would be nice to report errors during the bulk call.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we have a separate task for these operations?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems we're not interested in update or delete, I asked Pedro and was told that wasn't important to track

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

Public APIs missing comments

Total count of every public API that lacks a comment. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats comments for more detailed information.

id before after diff
elasticAssistant 37 38 +1
Unknown metric groups

API count

id before after diff
elasticAssistant 52 53 +1

History

@stephmilovic stephmilovic merged commit 1127bf4 into elastic:main Nov 12, 2024
43 checks passed
@kibanamachine
Copy link
Contributor

Starting backport for target branches: 8.16, 8.x

https://github.com/elastic/kibana/actions/runs/11788182779

kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Nov 12, 2024
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Nov 12, 2024
@kibanamachine
Copy link
Contributor

💚 All backports created successfully

Status Branch Result
8.16
8.x

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

kibanamachine added a commit that referenced this pull request Nov 12, 2024
…199723)

# Backport

This will backport the following commits from `main` to `8.16`:
- [[Security solution] Knowledge base entry telemetry
(#199225)](#199225)

<!--- Backport version: 9.4.3 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Steph
Milovic","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-11-12T00:10:07Z","message":"[Security
solution] Knowledge base entry telemetry
(#199225)","sha":"1127bf491d78b7ce2319a13257dbf0b1e84226e8","branchLabelMapping":{"^v9.0.0$":"main","^v8.17.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["WIP","release_note:skip","v9.0.0","Team:
SecuritySolution","Team:Security Generative
AI","backport:version","v8.17.0","v8.16.1"],"title":"[Security solution]
Knowledge base entry
telemetry","number":199225,"url":"https://github.com/elastic/kibana/pull/199225","mergeCommit":{"message":"[Security
solution] Knowledge base entry telemetry
(#199225)","sha":"1127bf491d78b7ce2319a13257dbf0b1e84226e8"}},"sourceBranch":"main","suggestedTargetBranches":["8.x","8.16"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/199225","number":199225,"mergeCommit":{"message":"[Security
solution] Knowledge base entry telemetry
(#199225)","sha":"1127bf491d78b7ce2319a13257dbf0b1e84226e8"}},{"branch":"8.x","label":"v8.17.0","branchLabelMappingKey":"^v8.17.0$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.16","label":"v8.16.1","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Steph Milovic <[email protected]>
kibanamachine added a commit that referenced this pull request Nov 12, 2024
…199724)

# Backport

This will backport the following commits from `main` to `8.x`:
- [[Security solution] Knowledge base entry telemetry
(#199225)](#199225)

<!--- Backport version: 9.4.3 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Steph
Milovic","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-11-12T00:10:07Z","message":"[Security
solution] Knowledge base entry telemetry
(#199225)","sha":"1127bf491d78b7ce2319a13257dbf0b1e84226e8","branchLabelMapping":{"^v9.0.0$":"main","^v8.17.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["WIP","release_note:skip","v9.0.0","Team:
SecuritySolution","Team:Security Generative
AI","backport:version","v8.17.0","v8.16.1"],"title":"[Security solution]
Knowledge base entry
telemetry","number":199225,"url":"https://github.com/elastic/kibana/pull/199225","mergeCommit":{"message":"[Security
solution] Knowledge base entry telemetry
(#199225)","sha":"1127bf491d78b7ce2319a13257dbf0b1e84226e8"}},"sourceBranch":"main","suggestedTargetBranches":["8.x","8.16"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/199225","number":199225,"mergeCommit":{"message":"[Security
solution] Knowledge base entry telemetry
(#199225)","sha":"1127bf491d78b7ce2319a13257dbf0b1e84226e8"}},{"branch":"8.x","label":"v8.17.0","branchLabelMappingKey":"^v8.17.0$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.16","label":"v8.16.1","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Steph Milovic <[email protected]>
@mistic mistic removed the v8.16.0 label Nov 12, 2024
tkajtoch pushed a commit to tkajtoch/kibana that referenced this pull request Nov 12, 2024
CAWilson94 pushed a commit to CAWilson94/kibana that referenced this pull request Nov 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:version Backport to applied version labels release_note:skip Skip the PR/issue when compiling release notes Team:Security Generative AI Security Generative AI Team: SecuritySolution Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc. v8.16.1 v8.17.0 v9.0.0 WIP Work in progress
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants