mirror of
https://github.com/elastic/kibana.git
synced 2025-06-29 03:24:45 -04:00
Follow-up to https://github.com/elastic/kibana/pull/181501 This moves the alert details context used by the AI Assistant from the apm api `GET /internal/apm/assistant/get_obs_alert_details_context` to the Obs api `/internal/observability/assistant/alert_details_contextual_insights`. This also involves adding a type safe API client to the observability API tests ### Other changes: - Rename `synthtraceEsClient` to `apmSynthtraceEsClient` to indicate it is specific to APM
50 lines
1.4 KiB
TypeScript
50 lines
1.4 KiB
TypeScript
/*
|
|
* 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 {
|
|
ApmSynthtraceEsClient,
|
|
ApmSynthtraceKibanaClient,
|
|
createLogger,
|
|
LogLevel,
|
|
} from '@kbn/apm-synthtrace';
|
|
import url from 'url';
|
|
import { kbnTestConfig } from '@kbn/test';
|
|
import { FtrProviderContext } from './ftr_provider_context';
|
|
|
|
export async function bootstrapApmSynthtraceEsClient(
|
|
context: FtrProviderContext,
|
|
kibanaClient: ApmSynthtraceKibanaClient
|
|
) {
|
|
const es = context.getService('es');
|
|
|
|
const kibanaVersion = await kibanaClient.fetchLatestApmPackageVersion();
|
|
await kibanaClient.installApmPackage(kibanaVersion);
|
|
|
|
const esClient = new ApmSynthtraceEsClient({
|
|
client: es,
|
|
logger: createLogger(LogLevel.info),
|
|
version: kibanaVersion,
|
|
refreshAfterIndex: true,
|
|
});
|
|
|
|
return esClient;
|
|
}
|
|
|
|
export function getSynthtraceKibanaClient(kibanaServerUrl: string) {
|
|
const kibanaServerUrlWithAuth = url
|
|
.format({
|
|
...url.parse(kibanaServerUrl),
|
|
auth: `elastic:${kbnTestConfig.getUrlParts().password}`,
|
|
})
|
|
.slice(0, -1);
|
|
|
|
const kibanaClient = new ApmSynthtraceKibanaClient({
|
|
target: kibanaServerUrlWithAuth,
|
|
logger: createLogger(LogLevel.debug),
|
|
});
|
|
|
|
return kibanaClient;
|
|
}
|