mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 01:13:23 -04:00
[Logs UI] Migrate usages of defineInternalSourceConfiguration
to defineInternalLogView
with new LogViewService (#147673)
## 📝 Summary Closes https://github.com/elastic/kibana/issues/129080 With the introduction of the "log view" concept in https://github.com/elastic/kibana/pull/125014, this PR migrates all usages of the previous `defineInternalSourceConfiguration` function in the infra plugin's setup() contract to the new `logViews.defineInternalLogView` function on the contract. This affects `enterprise_search`, `monitoring` and `upgrade_assistant` plugins. **N.B.** As these usages were not following the same restrictive configuration for the attributes we have now defined in the `.defineInternalLogView` method, I made the `logViewAttributes` passed to `logViews.defineInternalLogView` merge with the `defaultLogViewAttributes`. Co-authored-by: Marco Antonio Ghiani <marcoantonio.ghiani@elastic.co> Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
parent
494d3599c2
commit
57934183eb
6 changed files with 16 additions and 15 deletions
|
@ -237,28 +237,28 @@ export class EnterpriseSearchPlugin implements Plugin {
|
|||
* Register logs source configuration, used by LogStream components
|
||||
* @see https://github.com/elastic/kibana/blob/main/x-pack/plugins/infra/public/components/log_stream/log_stream.stories.mdx#with-a-source-configuration
|
||||
*/
|
||||
infra.defineInternalSourceConfiguration(ENTERPRISE_SEARCH_RELEVANCE_LOGS_SOURCE_ID, {
|
||||
name: 'Enterprise Search Search Relevance Logs',
|
||||
infra.logViews.defineInternalLogView(ENTERPRISE_SEARCH_RELEVANCE_LOGS_SOURCE_ID, {
|
||||
logIndices: {
|
||||
type: 'index_name',
|
||||
indexName: 'logs-app_search.search_relevance_suggestions-*',
|
||||
type: 'index_name',
|
||||
},
|
||||
name: 'Enterprise Search Search Relevance Logs',
|
||||
});
|
||||
|
||||
infra.defineInternalSourceConfiguration(ENTERPRISE_SEARCH_AUDIT_LOGS_SOURCE_ID, {
|
||||
name: 'Enterprise Search Audit Logs',
|
||||
infra.logViews.defineInternalLogView(ENTERPRISE_SEARCH_AUDIT_LOGS_SOURCE_ID, {
|
||||
logIndices: {
|
||||
type: 'index_name',
|
||||
indexName: 'logs-enterprise_search*',
|
||||
type: 'index_name',
|
||||
},
|
||||
name: 'Enterprise Search Audit Logs',
|
||||
});
|
||||
|
||||
infra.defineInternalSourceConfiguration(ENTERPRISE_SEARCH_ANALYTICS_LOGS_SOURCE_ID, {
|
||||
name: 'Enterprise Search Behaviorial Analytics Logs',
|
||||
infra.logViews.defineInternalLogView(ENTERPRISE_SEARCH_ANALYTICS_LOGS_SOURCE_ID, {
|
||||
logIndices: {
|
||||
type: 'index_name',
|
||||
indexName: 'logs-elastic_analytics.events-*',
|
||||
type: 'index_name',
|
||||
},
|
||||
name: 'Enterprise Search Behaviorial Analytics Logs',
|
||||
});
|
||||
|
||||
/**
|
||||
|
|
|
@ -72,6 +72,7 @@ export const logViewAttributesRT = rt.strict({
|
|||
logIndices: logIndexReferenceRT,
|
||||
logColumns: rt.array(logViewColumnConfigurationRT),
|
||||
});
|
||||
|
||||
export type LogViewAttributes = rt.TypeOf<typeof logViewAttributesRT>;
|
||||
|
||||
export const logViewRT = rt.exact(
|
||||
|
|
|
@ -11,7 +11,7 @@ import {
|
|||
Logger,
|
||||
SavedObjectsClientContract,
|
||||
} from '@kbn/core/server';
|
||||
import { LogView, LogViewAttributes } from '../../../common/log_views';
|
||||
import { defaultLogViewAttributes, LogView, LogViewAttributes } from '../../../common/log_views';
|
||||
import { LogViewsClient } from './log_views_client';
|
||||
import { LogViewsServiceSetup, LogViewsServiceStart, LogViewsServiceStartDeps } from './types';
|
||||
|
||||
|
@ -24,11 +24,11 @@ export class LogViewsService {
|
|||
const { internalLogViews } = this;
|
||||
|
||||
return {
|
||||
defineInternalLogView(logViewId: string, logViewAttributes: LogViewAttributes) {
|
||||
defineInternalLogView(logViewId: string, logViewAttributes: Partial<LogViewAttributes>) {
|
||||
internalLogViews.set(logViewId, {
|
||||
id: logViewId,
|
||||
origin: 'internal',
|
||||
attributes: logViewAttributes,
|
||||
attributes: { ...defaultLogViewAttributes, ...logViewAttributes },
|
||||
updatedAt: Date.now(),
|
||||
});
|
||||
},
|
||||
|
|
|
@ -30,7 +30,7 @@ export interface LogViewsServiceStartDeps {
|
|||
}
|
||||
|
||||
export interface LogViewsServiceSetup {
|
||||
defineInternalLogView(logViewId: string, logViewAttributes: LogViewAttributes): void;
|
||||
defineInternalLogView(logViewId: string, logViewAttributes: Partial<LogViewAttributes>): void;
|
||||
}
|
||||
|
||||
export interface LogViewsServiceStart {
|
||||
|
|
|
@ -18,7 +18,7 @@ export const initInfraSource = (config: MonitoringConfig, infraPlugin: InfraPlug
|
|||
ccs: CCS_REMOTE_PATTERN,
|
||||
});
|
||||
|
||||
infraPlugin.defineInternalSourceConfiguration(INFRA_SOURCE_ID, {
|
||||
infraPlugin.logViews.defineInternalLogView(INFRA_SOURCE_ID, {
|
||||
name: 'Elastic Stack Logs',
|
||||
logIndices: {
|
||||
type: 'index_name',
|
||||
|
|
|
@ -106,7 +106,7 @@ export class UpgradeAssistantServerPlugin implements Plugin {
|
|||
|
||||
// We need to initialize the deprecation logs plugin so that we can
|
||||
// navigate from this app to the observability app using a source_id.
|
||||
infra?.defineInternalSourceConfiguration(DEPRECATION_LOGS_SOURCE_ID, {
|
||||
infra?.logViews.defineInternalLogView(DEPRECATION_LOGS_SOURCE_ID, {
|
||||
name: 'deprecationLogs',
|
||||
description: 'deprecation logs',
|
||||
logIndices: {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue