Skip to content

Commit

Permalink
Merge branch 'main' into 164995-add-log-explorer-app-locator
Browse files Browse the repository at this point in the history
  • Loading branch information
mohamedhamed-ahmed authored Sep 20, 2023
2 parents 276e575 + 23b2f3b commit 94c89c6
Show file tree
Hide file tree
Showing 86 changed files with 1,734 additions and 730 deletions.
7 changes: 4 additions & 3 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -1041,6 +1041,7 @@ x-pack/plugins/infra/server/lib/alerting @elastic/actionable-observability
/packages/kbn-test/src/functional_test_runner @elastic/appex-qa
/packages/kbn-performance-testing-dataset-extractor @elastic/appex-qa
/x-pack/test_serverless/**/*config.base.ts @elastic/appex-qa
/x-pack/test_serverless/**/deployment_agnostic_services.ts @elastic/appex-qa

# Core
/config/ @elastic/kibana-core
Expand Down Expand Up @@ -1319,9 +1320,6 @@ x-pack/plugins/cloud_integrations/cloud_full_story/server/config.ts @elastic/kib
/x-pack/test/security_solution_endpoint/ @elastic/security-defend-workflows
/x-pack/test/security_solution_endpoint_api_int/ @elastic/security-defend-workflows
/x-pack/test_serverless/shared/lib/security/kibana_roles/ @elastic/security-defend-workflows
/x-pack/test_serverless/functional/test_suites/security/cypress/e2e/endpoint_management @elastic/security-defend-workflows
/x-pack/test_serverless/functional/test_suites/security/cypress/screens/endpoint_management @elastic/security-defend-workflows
/x-pack/test_serverless/functional/test_suites/security/cypress/tasks/endpoint_management @elastic/security-defend-workflows
/x-pack/plugins/security_solution_serverless/public/upselling/sections/endpoint_management @elastic/security-defend-workflows
/x-pack/plugins/security_solution_serverless/server/endpoint @elastic/security-defend-workflows

Expand Down Expand Up @@ -1398,6 +1396,9 @@ x-pack/plugins/translations/translations
# Profiling api integration testing
x-pack/test/profiling_api_integration @elastic/profiling-ui

# Observability shared profiling
x-pack/plugins/observability_shared/public/components/profiling @elastic/profiling-ui

# Shared UX
packages/react @elastic/appex-sharedux

Expand Down
35 changes: 5 additions & 30 deletions docs/management/connectors/action-types/gen-ai.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
++++
<titleabbrev>Generative AI</titleabbrev>
++++
:frontmatter-description: Add a connector that can send requests to an OpenAI provider.
:frontmatter-tags-products: [kibana]
:frontmatter-tags-content-type: [how-to]
:frontmatter-tags-user-goals: [configure]


The Generative AI connector uses https://github.com/axios/axios[axios] to send a POST request to an OpenAI provider, either OpenAI or Azure OpenAI. The connector uses the <<execute-connector-api,run connector API>> to send the request.

Expand All @@ -27,36 +32,6 @@ API Provider:: The OpenAI API provider, either OpenAI or Azure OpenAI.
API URL:: The OpenAI request URL.
API Key:: The OpenAI or Azure OpenAI API key for authentication.

[float]
[[preconfigured-gen-ai-configuration]]
=== Create preconfigured connectors

If you are running {kib} on-prem, you can define connectors by
adding `xpack.actions.preconfigured` settings to your `kibana.yml` file.
For example:

[source,text]
--
xpack.actions.preconfigured:
my-gen-ai:
name: preconfigured-gen-ai-connector-type
actionTypeId: .gen-ai
config:
apiUrl: https://api.openai.com/v1/chat/completions
apiProvider: 'Azure OpenAI'
secrets:
apiKey: superlongapikey
--

Config defines information for the connector type.

`apiProvider`:: A string that corresponds to *OpenAI API Provider*.
`apiUrl`:: A URL string that corresponds to the *OpenAI API URL*.

Secrets defines sensitive information for the connector type.

`apiKey`:: A string that corresponds to *OpenAI API Key*.

[float]
[[gen-ai-action-configuration]]
=== Test connectors
Expand Down
27 changes: 26 additions & 1 deletion docs/management/connectors/pre-configured-connectors.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,9 @@ Index names must start with `kibana-alert-history-` to take advantage of the pre
=== Examples

* <<preconfigured-d3security-configuration>>
* <<preconfigured-resilient-configuration>>
* <<preconfigured-email-configuration>>
* <<preconfigured-gen-ai-configuration>>
* <<preconfigured-resilient-configuration>>
* <<preconfigured-index-configuration>>
* <<preconfigured-jira-configuration>>
* <<preconfigured-opsgenie-configuration>>
Expand Down Expand Up @@ -276,6 +277,30 @@ secrets:
password: <password>
--------------------------------------------------

[float]
[[preconfigured-gen-ai-configuration]]
==== Generative AI connectors

The following example creates a <<gen-ai-action-type,generative AI connector>>:

[source,text]
--
xpack.actions.preconfigured:
my-gen-ai:
name: preconfigured-gen-ai-connector-type
actionTypeId: .gen-ai
config:
apiUrl: https://api.openai.com/v1/chat/completions <1>
apiProvider: 'OpenAI' <2>
defaultModel: gpt-4 <3>
secrets:
apiKey: superlongapikey <4>
--
<1> The OpenAI request URL
<2> The OpenAI API provider, either `OpenAI` or `Azure OpenAI`.
<3> The default model to use for requests. This setting is optional and applicable only when `apiProvider` is `OpenAI`.
<4> The OpenAI or Azure OpenAI API key for authentication.

[float]
[[preconfigured-resilient-configuration]]
==== {ibm-r} connectors
Expand Down
8 changes: 8 additions & 0 deletions docs/settings/alert-action-settings.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -260,10 +260,14 @@ For example: `.email`, `.index`, `.opsgenie`, `.server-log`, `.resilient`, `.sla
`xpack.actions.preconfigured.<connector-id>.config`::
The configuration details, which are specific to the type of preconfigured connector.

`xpack.actions.preconfigured.<connector-id>.config.apiProvider`::
For a <<gen-ai-action-type,generative AI connector>>, specifies the OpenAI API provider, either `OpenAI` or `Azure OpenAI`.

`xpack.actions.preconfigured.<connector-id>.config.apiUrl`::
A configuration URL that varies by connector:
+
--
* For a <<gen-ai-action-type,generative AI connector>>, specifies the OpenAI request URL.
* For a <<resilient-action-type,{ibm-r} connector>>, specifies the {ibm-r} instance URL.
* For a <<jira-action-type,Jira connector>>, specifies the Jira instance URL.
* For an <<opsgenie-action-type,{opsgenie} connector>>, specifies the {opsgenie} URL. For example, `https://api.opsgenie.com` or `https://api.eu.opsgenie.com`.
Expand Down Expand Up @@ -316,6 +320,9 @@ NOTE: If you are using the `xpack.actions.allowedHosts` setting, make sure the h
`xpack.actions.preconfigured.<connector-id>.config.createIncidentResponseKey`::
For a <<cases-webhook-action-type,{webhook-cm} connector>>, specifies a string from the response body of the create case method that corresponds to the external service identifier.

`xpack.actions.preconfigured.<connector-id>.config.defaultModel`::
For a <<gen-ai-action-type,generative AI connector>>, specifies the default model to use for requests. It is optional and applicable only when `xpack.actions.preconfigured.<connector-id>.config.apiProvider` is `OpenAI`.

`xpack.actions.preconfigured.<connector-id>.config.executionTimeField`::
For an <<index-action-type,index connector>>, a field that indicates when the document was indexed.

Expand Down Expand Up @@ -437,6 +444,7 @@ TIP: Sensitive properties, such as passwords, should be stored in the <<creating
An API key secret that varies by connector:
+
--
* For a <<gen-ai-action-type,generative AI connector>>, specifies the OpenAI or Azure OpenAI API key for authentication.
* For an <<opsgenie-action-type,{opsgenie} connector>>, specifies the {opsgenie} API authentication key for HTTP basic authentication.
--

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
/*
* 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.
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/

import { sum } from 'lodash';
import { createTopNFunctions } from './functions';
import { decodeStackTraceResponse } from '@kbn/profiling-utils';
import { decodeStackTraceResponse } from '..';
import { stackTraceFixtures } from './__fixtures__/stacktraces';

describe('TopN function operations', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
/*
* 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.
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
import * as t from 'io-ts';
import { sumBy } from 'lodash';
import type {
Executable,
FileID,
Expand All @@ -13,16 +16,14 @@ import type {
StackFrameMetadata,
StackTrace,
StackTraceID,
} from '@kbn/profiling-utils';
} from '..';
import {
createFrameGroupID,
createStackFrameMetadata,
emptyExecutable,
emptyStackFrame,
emptyStackTrace,
} from '@kbn/profiling-utils';
import * as t from 'io-ts';
import { sumBy } from 'lodash';
} from '..';

interface TopNFunctionAndFrameGroup {
Frame: StackFrameMetadata;
Expand Down
6 changes: 6 additions & 0 deletions packages/kbn-profiling-utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ export {
} from './common/profiling';
export { getFieldNameForTopNType, TopNType, StackTracesDisplayOption } from './common/stack_traces';
export { createFrameGroupID } from './common/frame_group';
export {
createTopNFunctions,
TopNFunctionSortField,
topNFunctionSortFieldRt,
} from './common/functions';

export type { CalleeTree } from './common/callee';
export type {
Expand All @@ -44,3 +49,4 @@ export type {
StackTrace,
StackTraceID,
} from './common/profiling';
export type { TopNFunctions } from './common/functions';
29 changes: 29 additions & 0 deletions x-pack/plugins/apm/common/utils/to_kuery_filter_format.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
* 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 { toKueryFilterFormat } from './to_kuery_filter_format';

describe('toKueryFilterFormat', () => {
it('returns a single value', () => {
expect(toKueryFilterFormat('key', ['foo'])).toEqual(`key : "foo"`);
});

it('returns multiple values default separator', () => {
expect(toKueryFilterFormat('key', ['foo', 'bar', 'baz'])).toEqual(
`key : "foo" OR key : "bar" OR key : "baz"`
);
});

it('returns multiple values custom separator', () => {
expect(toKueryFilterFormat('key', ['foo', 'bar', 'baz'], 'AND')).toEqual(
`key : "foo" AND key : "bar" AND key : "baz"`
);
});

it('return empty string when no hostname', () => {
expect(toKueryFilterFormat('key', [])).toEqual('');
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,10 @@
* 2.0.
*/

export * from './response_actions';
export function toKueryFilterFormat(
key: string,
values: string[],
separator: 'OR' | 'AND' = 'OR'
) {
return values.map((value) => `${key} : "${value}"`).join(` ${separator} `);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/*
* 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,
EuiIcon,
EuiText,
EuiToolTip,
} from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import React from 'react';

interface Props {
hostNames?: string[];
}
export function HostnamesFilterWarning({ hostNames = [] }: Props) {
function renderTooltipOptions() {
return (
<ul>
{hostNames.map((hostName) => (
<li key={hostName}>{`- ${hostName}`}</li>
))}
</ul>
);
}

return (
<EuiFlexGroup gutterSize="none">
<EuiFlexItem grow={false}>
<EuiText size="xs" color="subdued">
{i18n.translate('xpack.apm.profiling.flamegraph.filteredLabel', {
defaultMessage: 'Displaying items from specific host names',
})}
</EuiText>
</EuiFlexItem>
<EuiFlexItem grow={false}>
<EuiToolTip content={renderTooltipOptions()}>
<EuiIcon type="questionInCircle" />
</EuiToolTip>
</EuiFlexItem>
</EuiFlexGroup>
);
}
Loading

0 comments on commit 94c89c6

Please sign in to comment.