Skip to content

Commit

Permalink
Merge branch 'main' into authz-migration/unauthorized-routes-by-fleet
Browse files Browse the repository at this point in the history
  • Loading branch information
ashokaditya authored Dec 18, 2024
2 parents 9cdee47 + 96af6fa commit 5c4411d
Show file tree
Hide file tree
Showing 152 changed files with 1,327 additions and 1,343 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ source .buildkite/scripts/common/util.sh
echo --- Security Solution OpenAPI Code Generation

echo -e "\n[Security Solution OpenAPI Code Generation] OpenAPI Common Package\n"
(cd packages/kbn-openapi-common && yarn openapi:generate)
(cd src/platform/packages/shared/kbn-openapi-common && yarn openapi:generate)

echo -e "\n[Security Solution OpenAPI Code Generation] Lists Common Package\n"
(cd x-pack/solutions/security/packages/kbn-securitysolution-lists-common && yarn openapi:generate)
Expand Down
4 changes: 2 additions & 2 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,6 @@ packages/kbn-monaco @elastic/appex-sharedux
packages/kbn-object-versioning @elastic/appex-sharedux
packages/kbn-object-versioning-utils @elastic/appex-sharedux
packages/kbn-openapi-bundler @elastic/security-detection-rule-management
packages/kbn-openapi-common @elastic/security-detection-rule-management
packages/kbn-openapi-generator @elastic/security-detection-rule-management
packages/kbn-optimizer @elastic/kibana-operations
packages/kbn-optimizer-webpack-helpers @elastic/kibana-operations
Expand Down Expand Up @@ -499,7 +498,6 @@ packages/kbn-whereis-pkg-cli @elastic/kibana-operations
packages/kbn-xstate-utils @elastic/obs-ux-logs-team
packages/kbn-yarn-lock-validator @elastic/kibana-operations
packages/kbn-zod @elastic/kibana-core
packages/kbn-zod-helpers @elastic/security-detection-rule-management
packages/presentation/presentation_containers @elastic/kibana-presentation
packages/presentation/presentation_publishing @elastic/kibana-presentation
packages/react/kibana_context/common @elastic/appex-sharedux
Expand Down Expand Up @@ -595,6 +593,7 @@ src/platform/packages/shared/kbn-management/settings/components/field_row @elast
src/platform/packages/shared/kbn-management/settings/field_definition @elastic/kibana-management
src/platform/packages/shared/kbn-management/settings/types @elastic/kibana-management
src/platform/packages/shared/kbn-management/settings/utilities @elastic/kibana-management
src/platform/packages/shared/kbn-openapi-common @elastic/security-detection-rule-management
src/platform/packages/shared/kbn-osquery-io-ts-types @elastic/security-asset-management
src/platform/packages/shared/kbn-securitysolution-ecs @elastic/security-threat-hunting-explore
src/platform/packages/shared/kbn-securitysolution-es-utils @elastic/security-detection-engine
Expand All @@ -609,6 +608,7 @@ src/platform/packages/shared/kbn-sse-utils-client @elastic/obs-knowledge-team
src/platform/packages/shared/kbn-sse-utils-server @elastic/obs-knowledge-team
src/platform/packages/shared/kbn-typed-react-router-config @elastic/obs-knowledge-team @elastic/obs-ux-infra_services-team
src/platform/packages/shared/kbn-unsaved-changes-prompt @elastic/kibana-management
src/platform/packages/shared/kbn-zod-helpers @elastic/security-detection-rule-management
src/platform/packages/shared/serverless/settings/security_project @elastic/security-solution @elastic/kibana-management
src/platform/plugins/shared/ai_assistant_management/selection @elastic/obs-ai-assistant
src/platform/plugins/shared/console @elastic/kibana-management
Expand Down
2 changes: 1 addition & 1 deletion config/serverless.security.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ xpack.fleet.internal.registry.excludePackages: [
'dga',

# Unsupported in serverless
'cloud-defend',
'cloud_defend',
]
# fleet_server package installed to publish agent metrics
xpack.fleet.packages:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,63 @@ This event will be indexed with the following structure:
}
```

#### Add time ranges

The meta field supports telemetry on time ranges, providing calculated metrics for enhanced context. This includes:

- **Query range in ceconds:**

- Calculated as the time difference in seconds between `rangeFrom` and `rangeTo`.

- **Offset calculation:**
- A **negative offset** indicates that `rangeTo` is in the past.
- A **positive offset** indicates that `rangeTo` is in the future.
- An offset of **zero** indicates that `rangeTo` matches `'now'`.

###### Code example

```
onPageReady({
meta: {
rangeFrom: 'now-15m',
rangeTo: 'now',
}
});
```

This will be indexed as:

```typescript
{
"_index": "backing-ebt-kibana-browser-performance-metrics-000001", // Performance metrics are stored in a dedicated simplified index (browser \ server).
"_source": {
"timestamp": "2024-08-13T11:29:58.275Z"
"event_type": "performance_metric", // All performance events share a common event type to simplify mapping
"eventName": 'kibana:plugin_render_time', // Event name as specified when reporting it
"duration": 736, // Event duration as specified when reporting it
"meta": {
"target": '/home',
"query_range_secs": 900
"query_offset_secs": 0 // now
},
"context": { // Context holds information identifying the deployment, version, application and page that generated the event
"version": "8.16.0-SNAPSHOT",
"cluster_name": "elasticsearch",
"pageName": "application:home:app",
"applicationId": "home",
"page": "app",
"entityId": "61c58ad0-3dd3-11e8-b2b9-5d5dc1715159",
"branch": "main",
...
},

...
},
}
```

#### Add custom metrics

Having `kibana:plugin_render_time` metric event is not always enough, depending on the use case you would likely need some complementary information to give some sense to the value reported by the metric (e.g. number of hosts, number of services, number of dataStreams, etc).
`kibana:plugin_render_time` metric API supports up to 9 numbered free fields that can be used to report numeric metrics that you intend to analyze. Note that they can be used for any type of numeric information you may want to report.

Expand All @@ -304,10 +360,12 @@ We could make use of these custom metrics using the following format:
...
// Call onPageReady once the meaningful data has rendered and visible to the user
onPageReady({
key1: 'datasets',
value1: 5,
key2: 'documents',
value2: 1000,
customMetrics: {
key1: 'datasets',
value1: 5,
key2: 'documents',
value2: 1000,
}
});
...
```
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -713,7 +713,7 @@
"@kbn/observability-utils-server": "link:x-pack/packages/observability/observability_utils/observability_utils_server",
"@kbn/oidc-provider-plugin": "link:x-pack/test/security_api_integration/plugins/oidc_provider",
"@kbn/open-telemetry-instrumented-plugin": "link:test/common/plugins/otel_metrics",
"@kbn/openapi-common": "link:packages/kbn-openapi-common",
"@kbn/openapi-common": "link:src/platform/packages/shared/kbn-openapi-common",
"@kbn/osquery-io-ts-types": "link:src/platform/packages/shared/kbn-osquery-io-ts-types",
"@kbn/osquery-plugin": "link:x-pack/platform/plugins/shared/osquery",
"@kbn/paertial-results-example-plugin": "link:examples/partial_results_example",
Expand Down Expand Up @@ -1027,7 +1027,7 @@
"@kbn/watcher-plugin": "link:x-pack/platform/plugins/private/watcher",
"@kbn/xstate-utils": "link:packages/kbn-xstate-utils",
"@kbn/zod": "link:packages/kbn-zod",
"@kbn/zod-helpers": "link:packages/kbn-zod-helpers",
"@kbn/zod-helpers": "link:src/platform/packages/shared/kbn-zod-helpers",
"@langchain/aws": "^0.1.2",
"@langchain/community": "0.3.14",
"@langchain/core": "^0.3.16",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export const spoConnector: Connector = {
last_indexed_document_count: 1000,
pipeline: {
extract_binary_content: false,
name: 'ent-search-generic-ingestion',
name: 'search-default-ingestion',
reduce_whitespace: true,
run_ml_inference: false,
},
Expand Down Expand Up @@ -99,7 +99,7 @@ export const mysqlConnector: Connector = {
last_indexed_document_count: 2000,
pipeline: {
extract_binary_content: true,
name: 'ent-search-generic-ingestion',
name: 'search-default-ingestion',
reduce_whitespace: true,
run_ml_inference: false,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ describe('createConnectorDocument', () => {
name: 'indexName-name',
pipeline: {
extract_binary_content: true,
name: 'ent-search-generic-ingestion',
name: 'search-default-ingestion',
reduce_whitespace: true,
run_ml_inference: false,
},
Expand Down Expand Up @@ -103,7 +103,7 @@ describe('createConnectorDocument', () => {
name: 'indexName-name',
pipeline: {
extract_binary_content: true,
name: 'ent-search-generic-ingestion',
name: 'search-default-ingestion',
reduce_whitespace: true,
run_ml_inference: false,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ const THIS_REL = Path.relative(REPO_ROOT, THIS_PATH);
const IGNORED_PATHS = [
THIS_PATH,
Path.resolve(REPO_ROOT, 'packages/kbn-test/src/jest/run_check_jest_configs_cli.ts'),
Path.resolve(
REPO_ROOT,
'x-pack/plugins/observability_solution/observability_onboarding/e2e/playwright/playwright.config.ts'
),
];

export async function runCheckFtrConfigsCli() {
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@

module.exports = {
preset: '@kbn/test/jest_node',
rootDir: '../..',
roots: ['<rootDir>/packages/kbn-openapi-common'],
rootDir: '../../../../..',
roots: ['<rootDir>/src/platform/packages/shared/kbn-openapi-common'],
};
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* License v3.0 only", or the "Server Side Public License, v 1".
*/

require('../../../src/setup_node_env');
require('../../../../../setup_node_env');
const { resolve } = require('path');
const { generate } = require('@kbn/openapi-generator');

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"types": ["jest", "node"]
},
"exclude": ["target/**/*"],
"extends": "../../tsconfig.base.json",
"extends": "../../../../../tsconfig.base.json",
"include": ["**/*.ts"],
"kbn_references": [
"@kbn/zod",
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@

module.exports = {
preset: '@kbn/test',
rootDir: '../..',
roots: ['<rootDir>/packages/kbn-zod-helpers'],
rootDir: '../../../../..',
roots: ['<rootDir>/src/platform/packages/shared/kbn-zod-helpers'],
};
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"types": ["jest", "node"]
},
"exclude": ["target/**/*"],
"extends": "../../tsconfig.base.json",
"extends": "../../../../../tsconfig.base.json",
"include": ["**/*.ts"],
"kbn_references": [
"@kbn/datemath",
Expand Down
8 changes: 4 additions & 4 deletions tsconfig.base.json
Original file line number Diff line number Diff line change
Expand Up @@ -1364,8 +1364,8 @@
"@kbn/open-telemetry-instrumented-plugin/*": ["test/common/plugins/otel_metrics/*"],
"@kbn/openapi-bundler": ["packages/kbn-openapi-bundler"],
"@kbn/openapi-bundler/*": ["packages/kbn-openapi-bundler/*"],
"@kbn/openapi-common": ["packages/kbn-openapi-common"],
"@kbn/openapi-common/*": ["packages/kbn-openapi-common/*"],
"@kbn/openapi-common": ["src/platform/packages/shared/kbn-openapi-common"],
"@kbn/openapi-common/*": ["src/platform/packages/shared/kbn-openapi-common/*"],
"@kbn/openapi-generator": ["packages/kbn-openapi-generator"],
"@kbn/openapi-generator/*": ["packages/kbn-openapi-generator/*"],
"@kbn/optimizer": ["packages/kbn-optimizer"],
Expand Down Expand Up @@ -2076,8 +2076,8 @@
"@kbn/yarn-lock-validator/*": ["packages/kbn-yarn-lock-validator/*"],
"@kbn/zod": ["packages/kbn-zod"],
"@kbn/zod/*": ["packages/kbn-zod/*"],
"@kbn/zod-helpers": ["packages/kbn-zod-helpers"],
"@kbn/zod-helpers/*": ["packages/kbn-zod-helpers/*"],
"@kbn/zod-helpers": ["src/platform/packages/shared/kbn-zod-helpers"],
"@kbn/zod-helpers/*": ["src/platform/packages/shared/kbn-zod-helpers/*"],
// END AUTOMATED PACKAGE LISTING
// Allows for importing from `kibana` package for the exported types.
"@emotion/core": ["typings/@emotion"]
Expand Down
4 changes: 2 additions & 2 deletions x-pack/packages/kbn-ai-assistant/src/chat/chat_header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import {
} from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import { css } from '@emotion/css';
import { AssistantAvatar } from '@kbn/observability-ai-assistant-plugin/public';
import { AssistantIcon } from '@kbn/ai-assistant-icon';
import { ChatActionsMenu } from './chat_actions_menu';
import type { UseGenAIConnectorsResult } from '../hooks/use_genai_connectors';
import { FlyoutPositionMode } from './chat_flyout';
Expand Down Expand Up @@ -94,7 +94,7 @@ export function ChatHeader({
{loading ? (
<EuiLoadingSpinner size={breakpoint === 'xs' ? 'm' : 'l'} />
) : (
<AssistantAvatar size={breakpoint === 'xs' ? 'xs' : 's'} />
<AssistantIcon size={breakpoint === 'xs' ? 'm' : 'l'} />
)}
</EuiFlexItem>

Expand Down
20 changes: 3 additions & 17 deletions x-pack/packages/kbn-ai-assistant/src/chat/chat_item_avatar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,17 @@

import React from 'react';
import { UserAvatar } from '@kbn/user-profile-components';
import { css } from '@emotion/css';
import { EuiAvatar, EuiLoadingSpinner } from '@elastic/eui';
import type { AuthenticatedUser } from '@kbn/security-plugin/common';
import { AssistantAvatar, MessageRole } from '@kbn/observability-ai-assistant-plugin/public';
import { MessageRole } from '@kbn/observability-ai-assistant-plugin/public';
import { AssistantAvatar } from '@kbn/ai-assistant-icon';

interface ChatAvatarProps {
currentUser?: Pick<AuthenticatedUser, 'full_name' | 'username'> | undefined;
role: MessageRole;
loading: boolean;
}

const assistantAvatarClassName = css`
svg {
width: 16px;
height: 16px;
}
`;

export function ChatItemAvatar({ currentUser, role, loading }: ChatAvatarProps) {
const isLoading = loading || !currentUser;

Expand All @@ -39,14 +32,7 @@ export function ChatItemAvatar({ currentUser, role, loading }: ChatAvatarProps)
case MessageRole.Assistant:
case MessageRole.Elastic:
case MessageRole.Function:
return (
<EuiAvatar
name="Elastic Assistant"
iconType={AssistantAvatar}
color="subdued"
className={assistantAvatarClassName}
/>
);
return <AssistantAvatar name="Elastic Assistant" color="subdued" size="m" />;

case MessageRole.System:
return <EuiAvatar name="system" iconType="dot" color="subdued" />;
Expand Down
7 changes: 4 additions & 3 deletions x-pack/packages/kbn-ai-assistant/src/chat/welcome_message.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { EuiFlexGroup, EuiFlexItem, EuiSpacer, useCurrentEuiBreakpoint } from '@
import type { ActionConnector } from '@kbn/triggers-actions-ui-plugin/public';
import { GenerativeAIForObservabilityConnectorFeatureId } from '@kbn/actions-plugin/common';
import { isSupportedConnectorType } from '@kbn/observability-ai-assistant-plugin/public';
import { AssistantBeacon } from '@kbn/ai-assistant-icon';
import type { UseKnowledgeBaseResult } from '../hooks/use_knowledge_base';
import type { UseGenAIConnectorsResult } from '../hooks/use_genai_connectors';
import { Disclaimer } from './disclaimer';
Expand Down Expand Up @@ -78,9 +79,11 @@ export function WelcomeMessage({
gutterSize="none"
className={fullHeightClassName}
>
<EuiFlexItem grow={false}>
<AssistantBeacon backgroundColor="ghost" size="xl" />
</EuiFlexItem>
<EuiFlexItem grow className={centerMaxWidthClassName}>
<EuiSpacer size={['xl', 'l'].includes(breakpoint!) ? 'l' : 's'} />

<WelcomeMessageConnectors
connectors={connectors}
onSetupConnectorClick={handleConnectorClick}
Expand All @@ -89,10 +92,8 @@ export function WelcomeMessage({
<WelcomeMessageKnowledgeBase connectors={connectors} knowledgeBase={knowledgeBase} />
) : null}
</EuiFlexItem>

<EuiFlexItem grow={false}>
<StarterPrompts onSelectPrompt={onSelectPrompt} />

<EuiSpacer size="l" />
<Disclaimer />
</EuiFlexItem>
Expand Down
1 change: 1 addition & 0 deletions x-pack/packages/kbn-ai-assistant/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,6 @@
"@kbn/share-plugin",
"@kbn/ai-assistant-common",
"@kbn/storybook",
"@kbn/ai-assistant-icon",
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -22338,8 +22338,6 @@
"xpack.idxMgmt.goToDiscover.discoverIndexButtonLabel": "Découvrir les index",
"xpack.idxMgmt.goToDiscover.showIndexToolTip": "Montrer {indexName} dans Discover",
"xpack.idxMgmt.home.appTitle": "Gestion des index",
"xpack.idxMgmt.home.componentTemplates.checkingPrivilegesDescription": "Vérification des privilèges…",
"xpack.idxMgmt.home.componentTemplates.checkingPrivilegesErrorMessage": "Erreur lors de la récupération des privilèges utilisateur depuis le serveur.",
"xpack.idxMgmt.home.componentTemplates.confirmButtonLabel": "Supprimer {numComponentTemplatesToDelete, plural, one {le modèle de composant} other {les modèles de composants} }",
"xpack.idxMgmt.home.componentTemplates.deleteModal.cancelButtonLabel": "Annuler",
"xpack.idxMgmt.home.componentTemplates.deleteModal.deleteDescription": "Vous êtes sur le point de supprimer {numComponentTemplatesToDelete, plural, one {ce modèle de composant} other {ces modèles de composants} } :",
Expand All @@ -22348,8 +22346,6 @@
"xpack.idxMgmt.home.componentTemplates.deleteModal.multipleErrorsNotificationMessageText": "Erreur lors de la suppression de {count} modèles de composants",
"xpack.idxMgmt.home.componentTemplates.deleteModal.successDeleteMultipleNotificationMessageText": "{numSuccesses, plural, one {# modèle de composant supprimé} other {# modèles de composants supprimés}}",
"xpack.idxMgmt.home.componentTemplates.deleteModal.successDeleteSingleNotificationMessageText": "Le modèle de composant \"{componentTemplateName}\" a bien été supprimé",
"xpack.idxMgmt.home.componentTemplates.deniedPrivilegeDescription": "Pour utiliser les modèles de composants, vous devez posséder {privilegesCount, plural, one {ce privilège de cluster} other {ces privilèges de cluster}} : {missingPrivileges}.",
"xpack.idxMgmt.home.componentTemplates.deniedPrivilegeTitle": "Privilèges de cluster requis",
"xpack.idxMgmt.home.componentTemplates.emptyPromptButtonLabel": "Créer un modèle de composant",
"xpack.idxMgmt.home.componentTemplates.emptyPromptDescription": "Par exemple, vous pouvez créer un modèle de composant pour les paramètres d'index réutilisables dans tous les modèles d'index.",
"xpack.idxMgmt.home.componentTemplates.emptyPromptDocumentionLink": "En savoir plus.",
Expand Down
Loading

0 comments on commit 5c4411d

Please sign in to comment.