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] Assistant telemetry conversation id fix #173794

Merged
merged 2 commits into from
Dec 21, 2023

Conversation

stephmilovic
Copy link
Contributor

@stephmilovic stephmilovic commented Dec 20, 2023

Summary

We track telemetry when the AI Assistant button is clicked into, including the conversationId. However, when we introduced the new global header menu, the conversationId got dropped. This PR fixes that by introducing a new method, getConversationId that will default to the localStorageLastConversationId and then the Welcome id if no local storage id is present. This method is shared anywhere the conversationId is referenced.

To test

  1. Ensure telemetry.optIn: true is defined in your dev yml
  2. Open the assistant by clicking the AI Assistant button
  3. Observe in the console the event Report event "Assistant Invoked" . Expand the event and find the id in properties.conversationId. Ensure that it is the same conversation that was opened
    Screenshot 2023-12-20 at 4 41 44 PM
  4. Change the selected conversation
  5. Close the Assistant
  6. Open the assistant by clicking the AI Assistant button
  7. Observe in the console the event Report event "Assistant Invoked" . Expand the event and ensure the expected properties.conversationId was sent

@stephmilovic stephmilovic added bug Fixes for quality problems that affect the customer experience release_note:skip Skip the PR/issue when compiling release notes Team: SecuritySolution Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc. Team:Threat Hunting:Explore Feature:GenAI v8.12.0 v8.13.0 labels Dec 20, 2023
@stephmilovic stephmilovic requested a review from a team as a code owner December 20, 2023 22:46
@elasticmachine
Copy link
Contributor

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

@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
securitySolution 11.3MB 11.3MB +126.0B

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

assistantTelemetry?.reportAssistantInvoked({
invokedBy: 'shortcut',
conversationId: localStorageLastConversationId ?? WELCOME_CONVERSATION_TITLE,
conversationId: getConversationId(),
Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for ensuring all code paths return a consistent id with the new getConversationId() function!

The expected conversation id is included when the assistant is launched from the:
💹 Alerts flyout / page
💹 Data quality results / page
💹 Cases page
💹 Timeline
...and other contexts.

💹 The expected conversation ID is included for both default (e.g. Alert summary) and Custom conversations

Copy link
Contributor

@andrew-goldstein andrew-goldstein left a comment

Choose a reason for hiding this comment

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

Thanks @stephmilovic for this telemetry update!
✅ Desk tested locally
LGTM 🚀

@stephmilovic stephmilovic merged commit 574ff80 into elastic:main Dec 21, 2023
35 checks passed
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Dec 21, 2023
@kibanamachine
Copy link
Contributor

💚 All backports created successfully

Status Branch Result
8.12

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 Dec 21, 2023
…173794) (#173843)

# Backport

This will backport the following commits from `main` to `8.12`:
- [[Security solution] Assistant telemetry conversation id fix
(#173794)](#173794)

<!--- Backport version: 8.9.7 -->

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

<!--BACKPORT [{"author":{"name":"Steph
Milovic","email":"stephanie.milovic@elastic.co"},"sourceCommit":{"committedDate":"2023-12-21T14:40:49Z","message":"[Security
solution] Assistant telemetry conversation id fix
(#173794)","sha":"574ff80c444fcaa2717f8578ba4af09c5a433c06","branchLabelMapping":{"^v8.13.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["bug","release_note:skip","Team:
SecuritySolution","Team:Threat
Hunting:Explore","Feature:GenAI","v8.12.0","v8.13.0"],"number":173794,"url":"https://github.com/elastic/kibana/pull/173794","mergeCommit":{"message":"[Security
solution] Assistant telemetry conversation id fix
(#173794)","sha":"574ff80c444fcaa2717f8578ba4af09c5a433c06"}},"sourceBranch":"main","suggestedTargetBranches":["8.12"],"targetPullRequestStates":[{"branch":"8.12","label":"v8.12.0","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.13.0","labelRegex":"^v8.13.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/173794","number":173794,"mergeCommit":{"message":"[Security
solution] Assistant telemetry conversation id fix
(#173794)","sha":"574ff80c444fcaa2717f8578ba4af09c5a433c06"}}]}]
BACKPORT-->

Co-authored-by: Steph Milovic <stephanie.milovic@elastic.co>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Fixes for quality problems that affect the customer experience Feature:GenAI release_note:skip Skip the PR/issue when compiling release notes Team: SecuritySolution Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc. Team:Threat Hunting:Explore v8.12.0 v8.13.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants