-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into issues-171287
- Loading branch information
Showing
10 changed files
with
208 additions
and
44 deletions.
There are no files selected for viewing
This file contains 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 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 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 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
54 changes: 54 additions & 0 deletions
54
...y_solution/observability/public/pages/alert_details/alert_details_contextual_insights.tsx
This file contains 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,54 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import { EuiFlexGroup, EuiFlexItem } from '@elastic/eui'; | ||
|
||
import React, { useMemo } from 'react'; | ||
import { i18n } from '@kbn/i18n'; | ||
import dedent from 'dedent'; | ||
import { useKibana } from '../../utils/kibana_react'; | ||
import { AlertData } from '../../hooks/use_fetch_alert_detail'; | ||
|
||
export function AlertDetailContextualInsights({ alert }: { alert: AlertData | null }) { | ||
const { | ||
services: { observabilityAIAssistant }, | ||
} = useKibana(); | ||
|
||
const ObservabilityAIAssistantContextualInsight = | ||
observabilityAIAssistant?.ObservabilityAIAssistantContextualInsight; | ||
|
||
const messages = useMemo(() => { | ||
if (!observabilityAIAssistant) { | ||
return null; | ||
} | ||
|
||
return observabilityAIAssistant.getContextualInsightMessages({ | ||
message: `I'm looking at an alert and trying to understand why it was triggered`, | ||
instructions: dedent( | ||
`I'm an SRE. I am looking at an alert that was triggered. I want to understand why it was triggered, what it means, and what I should do next.` | ||
), | ||
}); | ||
}, [observabilityAIAssistant]); | ||
|
||
if (!ObservabilityAIAssistantContextualInsight || !messages) { | ||
return null; | ||
} | ||
|
||
return ( | ||
<EuiFlexGroup direction="column" gutterSize="m"> | ||
<EuiFlexItem grow={false}> | ||
<ObservabilityAIAssistantContextualInsight | ||
title={i18n.translate( | ||
'xpack.observability.alertDetailContextualInsights.InsightButtonLabel', | ||
{ defaultMessage: 'Help me understand this alert' } | ||
)} | ||
messages={messages} | ||
/> | ||
</EuiFlexItem> | ||
</EuiFlexGroup> | ||
); | ||
} |
This file contains 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 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 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 |
---|---|---|
@@ -1,3 +1,15 @@ | ||
# Search Notebooks plugin | ||
|
||
This plugin contains endpoints and components for rendering search python notebooks in the persistent dev console. | ||
|
||
### Cached Notebooks | ||
|
||
There is a limited set of search notebooks that we cache in `/server/data` directory to be served from this plugin. These should be available in all environments. | ||
|
||
To update the cached notebooks, run the following command: | ||
|
||
```shell | ||
./scripts/download-notebooks.sh | ||
``` | ||
|
||
This script reads the `scripts/notebooks.txt` file and downloads each notebook from the url in the file and then saves it in the `server/data` directory with a snake_case filename and `.json` extension. The `.json` extension is just to make loading the files with node.js easier using an `async require()` instead of writing custom loading code with `fs` and implementing in-memory caching with the same loading code. |
This file contains 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.