[Infra UI] Removed unused saved object attribute and unused source configuration code (#169430)

Resolves https://github.com/elastic/kibana/issues/168240

### Changes

- Removes `fields.message` from the `infrastructure-ui-source` saved
object who's value was being populated by
`xpack.infra.sources.default.fields.message` from config. See
https://www.elastic.co/guide/en/kibana/master/logs-ui-settings-kb.html
- Removes `getInternalSourceConfiguration` and
`defineInternalSourceConfiguration` functions introduced in
https://github.com/elastic/kibana/pull/36066 as I cannot see them being
used anywhere. Stops exposing `defineInternalSourceConfiguration` as
part of server plugin interface.
- Removes `getStaticDefaultSourceConfiguration` from InfraSources class
as we aren't using `sources` from kibana config in source configuration
anymore.
- Removes deprecations warning of removal in 8.0 for other fields
belonging to config xpack.infra.sources.* introduced in
https://github.com/elastic/kibana/pull/115103
- Removes `getAllSourceConfigurations` used only in removed deprecations
file
f427278322 (diff-081721894fc437938eb652beae0a0640ddeee532ec5e48af1f3093c8074f1eecL195)
- Removed `getAllSavedSourceConfigurations` only used in
`getAllSourceConfigurations`

### How to test 
- `infrastructure-ui-source` saved object no longer has `fields`
attributes
- in kibana.yml set `xpack.infra.sources.default.fields.message:
['testmessage', '@testmessage']`
  - go to Infra -> Settings
  - Change the name and save the form
- view the `infrastructure-ui-source` saved object and no `fields`
attribute should exist (unless it previously existed in an already
existing `infrastructure-ui-source` saved object
- changes do not affect`fields.message` is used in logs_shared plugin
- i'm not sure how to easily test this and relying on someone with more
Logs knowledge to help out, but from what I can see logs accesses the
config directly (`xpack.infra.sources.default.fields.message`) and never
uses the saved object field being removed.
This commit is contained in:
Sandra G 2023-11-07 06:54:32 -05:00 committed by GitHub
parent cecd175d34
commit ea7ae45028
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
22 changed files with 17 additions and 589 deletions

View file

@ -16,9 +16,6 @@ export const defaultSourceConfiguration: InfraSourceConfiguration = {
type: 'index_name',
indexName: LOGS_INDEX_PATTERN,
},
fields: {
message: ['message', '@message'],
},
inventoryDefaultView: '0',
metricsExplorerDefaultView: '0',
logColumns: [

View file

@ -17,29 +17,8 @@
/* eslint-disable @typescript-eslint/no-empty-interface */
import { omit } from 'lodash';
import * as rt from 'io-ts';
/**
* Source configuration config file properties.
* These are properties that can appear in the kibana.yml file.
* This is a legacy method of providing properties, and will be deprecated in the future (v 8.0.0).
*/
export const sourceConfigurationConfigFilePropertiesRT = rt.type({
sources: rt.type({
default: rt.partial({
fields: rt.partial({
message: rt.array(rt.string),
}),
}),
}),
});
export type SourceConfigurationConfigFileProperties = rt.TypeOf<
typeof sourceConfigurationConfigFilePropertiesRT
>;
/**
* Log columns
*/
@ -104,18 +83,6 @@ export type LogIndexNameReference = rt.TypeOf<typeof logIndexNameReferenceRT>;
export const logIndexReferenceRT = rt.union([logIndexPatternReferenceRT, logIndexNameReferenceRT]);
export type LogIndexReference = rt.TypeOf<typeof logIndexReferenceRT>;
/**
* Fields
*/
const SourceConfigurationFieldsRT = rt.type({
message: rt.array(rt.string),
});
/**
* Properties that represent a full source configuration, which is the result of merging static values with
* saved values.
*/
export const SourceConfigurationRT = rt.type({
name: rt.string,
description: rt.string,
@ -123,7 +90,6 @@ export const SourceConfigurationRT = rt.type({
logIndices: logIndexReferenceRT,
inventoryDefaultView: rt.string,
metricsExplorerDefaultView: rt.string,
fields: SourceConfigurationFieldsRT,
logColumns: rt.array(SourceConfigurationColumnRuntimeType),
anomalyThreshold: rt.number,
});
@ -131,20 +97,8 @@ export const SourceConfigurationRT = rt.type({
/**
* Stored source configuration as read from and written to saved objects
*/
const SavedSourceConfigurationFieldsRuntimeType = rt.partial(
omit(SourceConfigurationFieldsRT.props, ['message'])
);
export type InfraSavedSourceConfigurationFields = rt.TypeOf<
typeof SavedSourceConfigurationFieldsRuntimeType
>;
export const SavedSourceConfigurationRuntimeType = rt.intersection([
rt.partial(omit(SourceConfigurationRT.props, ['fields'])),
rt.partial({
fields: SavedSourceConfigurationFieldsRuntimeType,
}),
]);
export const SavedSourceConfigurationRuntimeType = rt.partial(SourceConfigurationRT.props);
export interface InfraSavedSourceConfiguration
extends rt.TypeOf<typeof SavedSourceConfigurationRuntimeType> {}
@ -154,10 +108,8 @@ export interface InfraSavedSourceConfiguration
* hardcoded defaults.
*/
const StaticSourceConfigurationFieldsRuntimeType = rt.partial(SourceConfigurationFieldsRT.props);
export const StaticSourceConfigurationRuntimeType = rt.partial({
...SourceConfigurationRT.props,
fields: StaticSourceConfigurationFieldsRuntimeType,
});
export interface InfraStaticSourceConfiguration
@ -167,11 +119,8 @@ export interface InfraStaticSourceConfiguration
* Full source configuration type after all cleanup has been done at the edges
*/
export type InfraSourceConfigurationFields = rt.TypeOf<typeof SourceConfigurationFieldsRT>;
export const SourceConfigurationRuntimeType = rt.type({
...SourceConfigurationRT.props,
fields: SourceConfigurationFieldsRT,
logColumns: rt.array(SourceConfigurationColumnRuntimeType),
});

View file

@ -1,86 +0,0 @@
/*
* 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 { getInfraDeprecationsFactory } from './deprecations';
describe('Infra plugin deprecations', () => {
describe('Source configuration deprecations', () => {
test('returns no deprecations when all fields are set to the default values', async () => {
const sources = {
getAllSourceConfigurations: () => [
{
configuration: {
name: 'Default',
fields: {
timestamp: '@timestamp',
tiebreaker: '_doc',
container: 'container.id',
host: 'host.name',
pod: 'kubernetes.pod.uid',
},
},
},
{
configuration: {
name: 'Alternate',
fields: {
timestamp: '@timestamp',
tiebreaker: '_doc',
container: 'container.id',
host: 'host.name',
pod: 'kubernetes.pod.uid',
},
},
},
],
};
const getDeprecations = getInfraDeprecationsFactory(sources as any);
const deprecations = await getDeprecations({} as any);
expect(deprecations.length).toBe(0);
});
});
test('returns expected deprecations when some fields are not set to default values in one or more source configurations', async () => {
const sources = {
getAllSourceConfigurations: () => [
{
configuration: {
name: 'Default',
fields: {
timestamp: 'not-@timestamp',
tiebreaker: '_doc',
container: 'not-container.id',
host: 'host.name',
pod: 'not-kubernetes.pod.uid',
},
},
},
{
configuration: {
name: 'Alternate',
fields: {
timestamp: 'not-@timestamp',
tiebreaker: 'not-_doc',
container: 'container.id',
host: 'not-host.name',
pod: 'kubernetes.pod.uid',
},
},
},
],
};
const getDeprecations = getInfraDeprecationsFactory(sources as any);
const deprecations = await getDeprecations({} as any);
expect(deprecations.length).toBe(5);
expect(
deprecations.map((d) =>
d.title.replace(/Source configuration field "(.*)" is deprecated./, '$1')
)
).toEqual(
expect.arrayContaining(['timestamp', 'tiebreaker', 'container ID', 'host name', 'pod ID'])
);
});
});

View file

@ -1,218 +0,0 @@
/*
* 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 { i18n } from '@kbn/i18n';
import { get } from 'lodash';
import {
ConfigDeprecationProvider,
ConfigDeprecation,
DeprecationsDetails,
GetDeprecationsContext,
} from '@kbn/core/server';
import {
TIMESTAMP_FIELD,
TIEBREAKER_FIELD,
CONTAINER_FIELD,
HOST_FIELD,
POD_FIELD,
} from '../common/constants';
import { InfraSources } from './lib/sources';
const deprecatedFieldMessage = (fieldName: string, defaultValue: string, configNames: string[]) =>
i18n.translate('xpack.infra.deprecations.deprecatedFieldDescription', {
defaultMessage:
'Configuring the "{fieldName}" field has been deprecated and will be removed in 8.0.0. This plugin is designed to work with ECS, and expects this field to have a value of `{defaultValue}`. It has a different value configured in Source {configCount, plural, one {Configuration} other {Configurations}}: {configNames}',
values: {
fieldName,
defaultValue,
configNames: configNames.join(', '),
configCount: configNames.length,
},
});
const DEFAULT_VALUES = {
timestamp: TIMESTAMP_FIELD,
tiebreaker: TIEBREAKER_FIELD,
container: CONTAINER_FIELD,
host: HOST_FIELD,
pod: POD_FIELD,
};
const FIELD_DEPRECATION_FACTORIES: Record<string, (configNames: string[]) => DeprecationsDetails> =
{
timestamp: (configNames) => ({
level: 'critical',
title: i18n.translate('xpack.infra.deprecations.timestampFieldTitle', {
defaultMessage: 'Source configuration field "timestamp" is deprecated.',
}),
message: deprecatedFieldMessage(
i18n.translate('xpack.infra.deprecations.timestampFieldName', {
defaultMessage: 'timestamp',
}),
DEFAULT_VALUES.timestamp,
configNames
),
correctiveActions: {
manualSteps: [
i18n.translate('xpack.infra.deprecations.timestampAdjustIndexing', {
defaultMessage: 'Adjust your indexing to use "{field}" as a timestamp.',
values: { field: '@timestamp' },
}),
],
},
}),
tiebreaker: (configNames) => ({
level: 'critical',
title: i18n.translate('xpack.infra.deprecations.tiebreakerFieldTitle', {
defaultMessage: 'Source configuration field "tiebreaker" is deprecated.',
}),
message: deprecatedFieldMessage(
i18n.translate('xpack.infra.deprecations.tiebreakerFieldName', {
defaultMessage: 'tiebreaker',
}),
DEFAULT_VALUES.tiebreaker,
configNames
),
correctiveActions: {
manualSteps: [
i18n.translate('xpack.infra.deprecations.tiebreakerAdjustIndexing', {
defaultMessage: 'Adjust your indexing to use "{field}" as a tiebreaker.',
values: { field: '_doc' },
}),
],
},
}),
host: (configNames) => ({
level: 'critical',
title: i18n.translate('xpack.infra.deprecations.hostnameFieldTitle', {
defaultMessage: 'Source configuration field "host name" is deprecated.',
}),
message: deprecatedFieldMessage(
i18n.translate('xpack.infra.deprecations.hostnameFieldName', {
defaultMessage: 'host name',
}),
DEFAULT_VALUES.host,
configNames
),
correctiveActions: {
manualSteps: [
i18n.translate('xpack.infra.deprecations.hostAdjustIndexing', {
defaultMessage: 'Adjust your indexing to identify hosts using "{field}"',
values: { field: 'host.name' },
}),
],
},
}),
pod: (configNames) => ({
level: 'critical',
title: i18n.translate('xpack.infra.deprecations.podIdFieldTitle', {
defaultMessage: 'Source configuration field "pod ID" is deprecated.',
}),
message: deprecatedFieldMessage(
i18n.translate('xpack.infra.deprecations.podIdFieldName', { defaultMessage: 'pod ID' }),
DEFAULT_VALUES.pod,
configNames
),
correctiveActions: {
manualSteps: [
i18n.translate('xpack.infra.deprecations.podAdjustIndexing', {
defaultMessage: 'Adjust your indexing to identify Kubernetes pods using "{field}"',
values: { field: 'kubernetes.pod.uid' },
}),
],
},
}),
container: (configNames) => ({
level: 'critical',
title: i18n.translate('xpack.infra.deprecations.containerIdFieldTitle', {
defaultMessage: 'Source configuration field "container ID" is deprecated.',
}),
message: deprecatedFieldMessage(
i18n.translate('xpack.infra.deprecations.containerIdFieldName', {
defaultMessage: 'container ID',
}),
DEFAULT_VALUES.container,
configNames
),
correctiveActions: {
manualSteps: [
i18n.translate('xpack.infra.deprecations.containerAdjustIndexing', {
defaultMessage: 'Adjust your indexing to identify Docker containers using "{field}"',
values: { field: 'container.id' },
}),
],
},
}),
};
export const configDeprecations: ConfigDeprecationProvider = ({ deprecate }) => [
...Object.keys(FIELD_DEPRECATION_FACTORIES).map(
(key): ConfigDeprecation =>
(completeConfig, rootPath, addDeprecation) => {
const configuredValue = get(completeConfig, `xpack.infra.sources.default.fields.${key}`);
if (typeof configuredValue === 'undefined') {
return completeConfig;
}
addDeprecation({
title: i18n.translate('xpack.infra.deprecations.deprecatedFieldConfigTitle', {
defaultMessage: '"{fieldKey}" is deprecated.',
values: {
fieldKey: key,
},
}),
message: i18n.translate('xpack.infra.deprecations.deprecatedFieldConfigDescription', {
defaultMessage:
'Configuring "xpack.infra.sources.default.fields.{fieldKey}" has been deprecated and will be removed in 8.0.0.',
values: {
fieldKey: key,
},
}),
level: 'warning',
correctiveActions: {
manualSteps: [
i18n.translate('xpack.infra.deprecations.removeConfigField', {
defaultMessage:
'Remove "xpack.infra.sources.default.fields.{fieldKey}" from your Kibana configuration.',
values: { fieldKey: key },
}),
],
},
} as Parameters<typeof addDeprecation>[0]);
return completeConfig;
}
),
];
export const getInfraDeprecationsFactory =
(sources: InfraSources) =>
async ({ savedObjectsClient }: GetDeprecationsContext) => {
const deprecatedFieldsToSourceConfigMap: Map<string, string[]> = new Map();
const sourceConfigurations = await sources.getAllSourceConfigurations(savedObjectsClient);
for (const { configuration } of sourceConfigurations) {
const { name, fields } = configuration;
for (const [key, defaultValue] of Object.entries(DEFAULT_VALUES)) {
const configuredValue = Reflect.get(fields, key);
if (configuredValue !== undefined && configuredValue !== defaultValue) {
const affectedConfigNames = deprecatedFieldsToSourceConfigMap.get(key) ?? [];
affectedConfigNames.push(name);
deprecatedFieldsToSourceConfigMap.set(key, affectedConfigNames);
}
}
}
const deprecations: DeprecationsDetails[] = [];
if (deprecatedFieldsToSourceConfigMap.size > 0) {
for (const [fieldName, affectedConfigNames] of deprecatedFieldsToSourceConfigMap.entries()) {
const deprecationFactory = Reflect.get(FIELD_DEPRECATION_FACTORIES, fieldName);
deprecations.push(deprecationFactory(affectedConfigNames));
}
}
return deprecations;
};

View file

@ -16,9 +16,6 @@ export const createTestSourceConfiguration = (
attributes: {
name: 'TEST CONFIGURATION',
description: '',
fields: {
message: ['TEST MESSAGE FIELD'],
},
inventoryDefaultView: '0',
metricsExplorerDefaultView: '0',
logColumns: [

View file

@ -15,7 +15,4 @@ export const createInfraSourcesMock = (): jest.Mocked<IInfraSources> => ({
createSourceConfiguration: jest.fn(),
deleteSourceConfiguration: jest.fn(),
updateSourceConfiguration: jest.fn(),
getAllSourceConfigurations: jest.fn(),
getInternalSourceConfiguration: jest.fn(),
defineInternalSourceConfiguration: jest.fn(),
});

View file

@ -100,9 +100,6 @@ describe('resolveSavedObjectReferences function', () => {
const sourceConfigurationWithIndexPatternReference: InfraSourceConfiguration = {
name: 'NAME',
description: 'DESCRIPTION',
fields: {
message: ['MESSAGE_FIELD'],
},
logColumns: [],
logIndices: {
type: 'index_pattern',

View file

@ -15,7 +15,7 @@ describe('the InfraSources lib', () => {
describe('getSourceConfiguration method', () => {
test('returns a source configuration if it exists', async () => {
const sourcesLib = new InfraSources({
config: createMockStaticConfiguration({}),
config: createMockStaticConfiguration(),
metricsClient: createMockMetricsDataClient('METRIC_ALIAS'),
});
@ -50,42 +50,9 @@ describe('the InfraSources lib', () => {
});
});
test('adds missing attributes from the static configuration to a source configuration', async () => {
const sourcesLib = new InfraSources({
config: createMockStaticConfiguration({
default: {
metricAlias: 'METRIC_ALIAS',
logIndices: { type: 'index_pattern', indexPatternId: 'LOG_ALIAS' },
},
}),
metricsClient: createMockMetricsDataClient('METRIC_ALIAS'),
});
const request: any = createRequestContext({
id: 'TEST_ID',
version: 'foo',
type: infraSourceConfigurationSavedObjectName,
updated_at: '2000-01-01T00:00:00.000Z',
attributes: {},
references: [],
});
expect(
await sourcesLib.getSourceConfiguration(request.core.savedObjects.client, 'TEST_ID')
).toMatchObject({
id: 'TEST_ID',
version: 'foo',
updatedAt: 946684800000,
configuration: {
metricAlias: 'METRIC_ALIAS',
logIndices: { type: 'index_pattern', indexPatternId: 'LOG_ALIAS' },
},
});
});
test('adds missing attributes from the default configuration to a source configuration', async () => {
const sourcesLib = new InfraSources({
config: createMockStaticConfiguration({}),
config: createMockStaticConfiguration(),
metricsClient: createMockMetricsDataClient(),
});
@ -113,7 +80,7 @@ describe('the InfraSources lib', () => {
});
});
const createMockStaticConfiguration = (sources: any): InfraConfig => ({
const createMockStaticConfiguration = (): InfraConfig => ({
alerting: {
inventory_threshold: {
group_by_page_size: 10000,
@ -135,7 +102,6 @@ const createMockStaticConfiguration = (sources: any): InfraConfig => ({
logThresholdAlertRuleEnabled: true,
alertsAndRulesDropdownEnabled: true,
},
sources,
enabled: true,
});

View file

@ -6,7 +6,7 @@
*/
import { fold, map } from 'fp-ts/lib/Either';
import { constant, identity } from 'fp-ts/lib/function';
import { identity } from 'fp-ts/lib/function';
import { pipe } from 'fp-ts/lib/pipeable';
import { failure } from 'io-ts/lib/PathReporter';
import { inRange } from 'lodash';
@ -21,13 +21,11 @@ import {
InfraSource,
InfraSourceConfiguration,
InfraStaticSourceConfiguration,
SourceConfigurationConfigFileProperties,
sourceConfigurationConfigFilePropertiesRT,
} from '../../../common/source_configuration/source_configuration';
import { SourceConfigurationSavedObjectRT } from '.';
import { InfraConfig } from '../..';
import { defaultSourceConfiguration } from './defaults';
import { AnomalyThresholdRangeError, NotFoundError } from './errors';
import { AnomalyThresholdRangeError } from './errors';
import {
extractSavedObjectReferences,
resolveSavedObjectReferences,
@ -43,7 +41,6 @@ interface Libs {
export type IInfraSources = Pick<InfraSources, keyof InfraSources>;
export class InfraSources {
private internalSourceConfigurations: Map<string, InfraStaticSourceConfiguration> = new Map();
private readonly libs: Libs;
constructor(libs: Libs) {
@ -54,29 +51,14 @@ export class InfraSources {
savedObjectsClient: SavedObjectsClientContract,
sourceId: string
): Promise<InfraSource> {
const staticDefaultSourceConfiguration = await this.getStaticDefaultSourceConfiguration();
const savedSourceConfiguration = await this.getInternalSourceConfiguration(sourceId)
.then((internalSourceConfiguration) => ({
id: sourceId,
version: undefined,
updatedAt: undefined,
origin: 'internal' as 'internal',
configuration: mergeSourceConfiguration(
staticDefaultSourceConfiguration,
internalSourceConfiguration
),
const savedSourceConfiguration = await this.getSavedSourceConfiguration(
savedObjectsClient,
sourceId
)
.then((result) => ({
...result,
configuration: mergeSourceConfiguration(defaultSourceConfiguration, result.configuration),
}))
.catch((err) =>
err instanceof NotFoundError
? this.getSavedSourceConfiguration(savedObjectsClient, sourceId).then((result) => ({
...result,
configuration: mergeSourceConfiguration(
staticDefaultSourceConfiguration,
result.configuration
),
}))
: Promise.reject(err)
)
.catch((err) =>
SavedObjectsErrorHelpers.isNotFoundError(err)
? Promise.resolve({
@ -84,7 +66,7 @@ export class InfraSources {
version: undefined,
updatedAt: undefined,
origin: 'fallback' as 'fallback',
configuration: staticDefaultSourceConfiguration,
configuration: defaultSourceConfiguration,
})
: Promise.reject(err)
);
@ -107,36 +89,16 @@ export class InfraSources {
return sourceConfiguration;
}
public async getAllSourceConfigurations(savedObjectsClient: SavedObjectsClientContract) {
const staticDefaultSourceConfiguration = await this.getStaticDefaultSourceConfiguration();
const savedSourceConfigurations = await this.getAllSavedSourceConfigurations(
savedObjectsClient
);
return savedSourceConfigurations.map((savedSourceConfiguration) => ({
...savedSourceConfiguration,
configuration: mergeSourceConfiguration(
staticDefaultSourceConfiguration,
savedSourceConfiguration.configuration
),
}));
}
public async createSourceConfiguration(
savedObjectsClient: SavedObjectsClientContract,
sourceId: string,
source: InfraSavedSourceConfiguration
) {
const staticDefaultSourceConfiguration = await this.getStaticDefaultSourceConfiguration();
const { anomalyThreshold } = source;
if (anomalyThreshold && !inRange(anomalyThreshold, 0, 101))
throw new AnomalyThresholdRangeError('Anomaly threshold must be 1-100');
const newSourceConfiguration = mergeSourceConfiguration(
staticDefaultSourceConfiguration,
source
);
const newSourceConfiguration = mergeSourceConfiguration(defaultSourceConfiguration, source);
const { attributes, references } = extractSavedObjectReferences(newSourceConfiguration);
const createdSourceConfiguration = convertSavedObjectToSavedSourceConfiguration(
@ -154,7 +116,7 @@ export class InfraSources {
return {
...createdSourceConfiguration,
configuration: mergeSourceConfiguration(
staticDefaultSourceConfiguration,
defaultSourceConfiguration,
createdSourceConfiguration.configuration
),
};
@ -172,7 +134,6 @@ export class InfraSources {
sourceId: string,
sourceProperties: InfraSavedSourceConfiguration
) {
const staticDefaultSourceConfiguration = await this.getStaticDefaultSourceConfiguration();
const { anomalyThreshold } = sourceProperties;
if (anomalyThreshold && !inRange(anomalyThreshold, 0, 101))
@ -210,42 +171,12 @@ export class InfraSources {
return {
...updatedSourceConfiguration,
configuration: mergeSourceConfiguration(
staticDefaultSourceConfiguration,
defaultSourceConfiguration,
updatedSourceConfiguration.configuration
),
};
}
public async defineInternalSourceConfiguration(
sourceId: string,
sourceProperties: InfraStaticSourceConfiguration
) {
this.internalSourceConfigurations.set(sourceId, sourceProperties);
}
public async getInternalSourceConfiguration(sourceId: string) {
const internalSourceConfiguration = this.internalSourceConfigurations.get(sourceId);
if (!internalSourceConfiguration) {
throw new NotFoundError(
`Failed to load internal source configuration: no configuration "${sourceId}" found.`
);
}
return internalSourceConfiguration;
}
private async getStaticDefaultSourceConfiguration() {
const staticSourceConfiguration: SourceConfigurationConfigFileProperties['sources']['default'] =
pipe(
sourceConfigurationConfigFilePropertiesRT.decode(this.libs.config),
map(({ sources: { default: defaultConfiguration } }) => defaultConfiguration),
fold(constant({}), identity)
);
return mergeSourceConfiguration(defaultSourceConfiguration, staticSourceConfiguration);
}
private async getSavedSourceConfiguration(
savedObjectsClient: SavedObjectsClientContract,
sourceId: string
@ -257,14 +188,6 @@ export class InfraSources {
return convertSavedObjectToSavedSourceConfiguration(savedObject);
}
private async getAllSavedSourceConfigurations(savedObjectsClient: SavedObjectsClientContract) {
const savedObjects = await savedObjectsClient.find({
type: infraSourceConfigurationSavedObjectName,
});
return savedObjects.saved_objects.map(convertSavedObjectToSavedSourceConfiguration);
}
}
export const mergeSourceConfiguration = (
@ -275,10 +198,6 @@ export const mergeSourceConfiguration = (
(previousSourceConfiguration, currentSourceConfiguration) => ({
...previousSourceConfiguration,
...currentSourceConfiguration,
fields: {
...previousSourceConfiguration.fields,
...currentSourceConfiguration.fields,
},
}),
first
);

View file

@ -73,7 +73,6 @@ export const SourceConfigurationSavedObjectAttributesRT = rt.type({
logIndices: logIndexSavedObjectReferenceRT,
inventoryDefaultView: rt.string,
metricsExplorerDefaultView: rt.string,
fields: rt.record(rt.string, rt.unknown),
logColumns: rt.array(SourceConfigurationSavedObjectColumnRT),
anomalyThreshold: rt.number,
});

View file

@ -17,7 +17,6 @@ import { InfraPluginSetup, InfraPluginStart } from './types';
const createInfraSetupMock = () => {
const infraSetupMock: jest.Mocked<InfraPluginSetup> = {
defineInternalSourceConfiguration: jest.fn(),
inventoryViews: createInventoryViewsServiceSetupMock(),
metricsExplorerViews: createMetricsExplorerViewsServiceSetupMock(),
};

View file

@ -21,7 +21,6 @@ import { DEFAULT_SPACE_ID } from '@kbn/spaces-plugin/common';
import { GetMetricIndicesOptions } from '@kbn/metrics-data-access-plugin/server';
import { LOGS_FEATURE_ID, METRICS_FEATURE_ID } from '../common/constants';
import { publicConfigKeys } from '../common/plugin_config_types';
import { configDeprecations, getInfraDeprecationsFactory } from './deprecations';
import { LOGS_FEATURE, METRICS_FEATURE } from './features';
import { initInfraServer } from './infra_server';
import { FrameworkFieldsAdapter } from './lib/adapters/fields/framework_fields_adapter';
@ -115,7 +114,6 @@ export const config: PluginConfigDescriptor<InfraConfig> = {
}),
}),
}),
deprecations: configDeprecations,
exposeToBrowser: publicConfigKeys,
};
@ -275,13 +273,7 @@ export class InfraServerPlugin
// Telemetry
UsageCollector.registerUsageCollector(plugins.usageCollection);
// register deprecated source configuration fields
core.deprecations.registerDeprecations({
getDeprecations: getInfraDeprecationsFactory(sources),
});
return {
defineInternalSourceConfiguration: sources.defineInternalSourceConfiguration.bind(sources),
inventoryViews,
metricsExplorerViews,
} as InfraPluginSetup;

View file

@ -46,9 +46,6 @@ const source: InfraSource = {
type: 'index_pattern',
indexPatternId: 'kibana_index_pattern',
},
fields: {
message: ['message', '@message'],
},
inventoryDefaultView: '0',
metricsExplorerDefaultView: '0',
logColumns: [

View file

@ -202,9 +202,6 @@ const basicTestSourceConfiguration: InfraSource = {
indexPatternId: 'INDEX_PATTERN_ID',
},
logColumns: [],
fields: {
message: [],
},
metricAlias: 'METRIC_ALIAS',
inventoryDefaultView: '0',
metricsExplorerDefaultView: 'METRICS_EXPLORER_DEFAULT_VIEW',

View file

@ -209,9 +209,6 @@ const basicTestSourceConfiguration: InfraSource = {
indexPatternId: 'INDEX_PATTERN_ID',
},
logColumns: [],
fields: {
message: [],
},
metricAlias: 'METRIC_ALIAS',
inventoryDefaultView: '0',
metricsExplorerDefaultView: '0',

View file

@ -8,7 +8,6 @@
import type { CoreSetup, CustomRequestHandlerContext } from '@kbn/core/server';
import type { SearchRequestHandlerContext } from '@kbn/data-plugin/server';
import type { MlPluginSetup } from '@kbn/ml-plugin/server';
import type { InfraStaticSourceConfiguration } from '../common/source_configuration/source_configuration';
import { InfraServerPluginStartDeps } from './lib/adapters/framework';
import { InventoryViewsServiceSetup, InventoryViewsServiceStart } from './services/inventory_views';
import {
@ -22,10 +21,6 @@ export type InfraPluginCoreSetup = CoreSetup<InfraServerPluginStartDeps, InfraPl
export type InfraPluginStartServicesAccessor = InfraPluginCoreSetup['getStartServices'];
export interface InfraPluginSetup {
defineInternalSourceConfiguration: (
sourceId: string,
sourceProperties: InfraStaticSourceConfiguration
) => void;
inventoryViews: InventoryViewsServiceSetup;
metricsExplorerViews?: MetricsExplorerViewsServiceSetup;
}

View file

@ -48,9 +48,6 @@ const basicTestSourceConfiguration: InfraSource = {
indexPatternId: 'INDEX_PATTERN_ID',
},
logColumns: [],
fields: {
message: [],
},
metricAlias: 'METRIC_ALIAS',
inventoryDefaultView: 'INVENTORY_DEFAULT_VIEW',
metricsExplorerDefaultView: 'METRICS_EXPLORER_DEFAULT_VIEW',

View file

@ -18334,15 +18334,6 @@
"xpack.infra.analysisSetup.indicesSelectionIndexNotFound": "Aucun index ne correspond au modèle {index}",
"xpack.infra.analysisSetup.indicesSelectionNoTimestampField": "Il manque un champ {field} obligatoire dans au moins un index correspondant à {index}.",
"xpack.infra.analysisSetup.indicesSelectionTimestampNotValid": "Au moins un index correspondant à {index} comprend un champ appelé {field} sans le type correct.",
"xpack.infra.deprecations.containerAdjustIndexing": "Ajustez votre indexation pour identifier les conteneurs Docker utilisant \"{field}\"",
"xpack.infra.deprecations.deprecatedFieldConfigDescription": "La configuration de \"xpack.infra.sources.default.fields.{fieldKey}\" a été déclassée et sera retirée dans la version 8.0.0.",
"xpack.infra.deprecations.deprecatedFieldConfigTitle": "\"{fieldKey}\" est déclassé.",
"xpack.infra.deprecations.deprecatedFieldDescription": "La configuration du champ \"{fieldName}\" a été déclassée et sera retirée dans la version 8.0.0. Ce plug-in est conçu pour fonctionner avec ECS et attend la valeur \"{defaultValue}\" pour ce champ. Celui-ci présente une valeur différente dans la configuration source {configCount, plural, one {Configuration} many {Configurations} other {Configurations}} : {configNames}",
"xpack.infra.deprecations.hostAdjustIndexing": "Ajustez votre indexation pour identifier les hôtes utilisant \"{field}\"",
"xpack.infra.deprecations.podAdjustIndexing": "Ajustez votre indexation pour identifier les pods Kubernetes utilisant \"{field}\"",
"xpack.infra.deprecations.removeConfigField": "Retirez \"xpack.infra.sources.default.fields.{fieldKey}\" de votre configuration Kibana.",
"xpack.infra.deprecations.tiebreakerAdjustIndexing": "Ajustez votre indexation pour utiliser \"{field}\" comme moyen de départager.",
"xpack.infra.deprecations.timestampAdjustIndexing": "Ajustez votre indexation pour utiliser \"{field}\" comme horodatage.",
"xpack.infra.homePage.toolbar.showingLastOneMinuteDataText": "Dernières {duration} de données pour l'heure sélectionnée",
"xpack.infra.hostsViewPage.errorOnCreateOrLoadDataview": "Une erreur sest produite lors de la création dune vue de données : {metricAlias}. Essayez de recharger la page.",
"xpack.infra.hostsViewPage.kpi.subtitle.average.limit": "Moyenne (de {limit} hôtes)",
@ -18494,16 +18485,6 @@
"xpack.infra.chartSection.notEnoughDataPointsToRenderTitle": "Données insuffisantes",
"xpack.infra.common.tabBetaBadgeLabel": "Bêta",
"xpack.infra.configureSourceActionLabel": "Modifier la configuration de la source",
"xpack.infra.deprecations.containerIdFieldName": "ID de conteneur",
"xpack.infra.deprecations.containerIdFieldTitle": "Le champ de configuration source \"ID de conteneur\" est déclassé.",
"xpack.infra.deprecations.hostnameFieldName": "nom d'hôte",
"xpack.infra.deprecations.hostnameFieldTitle": "Le champ de configuration source \"nom dhôte\" est déclassé.",
"xpack.infra.deprecations.podIdFieldName": "ID de pod",
"xpack.infra.deprecations.podIdFieldTitle": "Le champ de configuration source \"ID de pod\" est déclassé.",
"xpack.infra.deprecations.tiebreakerFieldName": "Départage",
"xpack.infra.deprecations.tiebreakerFieldTitle": "Le champ de configuration source \"départage\" est déclassé.",
"xpack.infra.deprecations.timestampFieldName": "timestamp",
"xpack.infra.deprecations.timestampFieldTitle": "Le champ de configuration source \"horodatage\" est déclassé.",
"xpack.infra.durationUnits.days.plural": "jours",
"xpack.infra.durationUnits.days.singular": "jour",
"xpack.infra.durationUnits.hours.plural": "heures",

View file

@ -18348,15 +18348,6 @@
"xpack.infra.analysisSetup.indicesSelectionIndexNotFound": "インデックスがパターン{index}と一致しません",
"xpack.infra.analysisSetup.indicesSelectionNoTimestampField": "{index}と一致する1つ以上のインデックスに、必須フィールド{field}がありません。",
"xpack.infra.analysisSetup.indicesSelectionTimestampNotValid": "{index}と一致する1つ以上のインデックスに、正しい型がない{field}フィールドがあります。",
"xpack.infra.deprecations.containerAdjustIndexing": "インデックスを調整し、\"{field}\"を使用してDockerコンテナーを特定",
"xpack.infra.deprecations.deprecatedFieldConfigDescription": "「xpack.infra.sources.default.fields.{fieldKey}」の構成は廃止予定であり、8.0.0で削除されます。",
"xpack.infra.deprecations.deprecatedFieldConfigTitle": "\"{fieldKey}\"は廃止予定です。",
"xpack.infra.deprecations.deprecatedFieldDescription": "\"{fieldName}\"フィールドの構成は廃止予定です。8.0.0で削除されます。このプラグインはECSと連動するように設計され、このフィールドには`{defaultValue}`の値が入ることが想定されています。ソース{configCount, plural, other {構成}}で設定されている値が異なります:{configNames}",
"xpack.infra.deprecations.hostAdjustIndexing": "インデックスを調整し、\"{field}\"を使用してホストを特定",
"xpack.infra.deprecations.podAdjustIndexing": "インデックスを調整し、\"{field}\"を使用してKubernetesポッドを特定",
"xpack.infra.deprecations.removeConfigField": "「xpack.infra.sources.default.fields.{fieldKey}」をKibana構成から削除します。",
"xpack.infra.deprecations.tiebreakerAdjustIndexing": "インデックスを調整し、\"{field}\"をタイブレーカーとして使用します。",
"xpack.infra.deprecations.timestampAdjustIndexing": "インデックスを調整し、\"{field}\"をタイムスタンプとして使用します。",
"xpack.infra.homePage.toolbar.showingLastOneMinuteDataText": "指定期間のデータの最後の{duration}",
"xpack.infra.hostsViewPage.errorOnCreateOrLoadDataview": "データビューの作成中にエラーが発生しました:{metricAlias}。ページを再読み込みしてください。",
"xpack.infra.hostsViewPage.kpi.subtitle.average.limit": "{limit}ホストの)平均",
@ -18508,16 +18499,6 @@
"xpack.infra.chartSection.notEnoughDataPointsToRenderTitle": "データが不十分です",
"xpack.infra.common.tabBetaBadgeLabel": "ベータ",
"xpack.infra.configureSourceActionLabel": "ソース構成を変更",
"xpack.infra.deprecations.containerIdFieldName": "コンテナーID",
"xpack.infra.deprecations.containerIdFieldTitle": "ソース構成フィールドコンテナーIDは廃止予定です。",
"xpack.infra.deprecations.hostnameFieldName": "ホスト名",
"xpack.infra.deprecations.hostnameFieldTitle": "ソース構成フィールド[ホスト名]は廃止予定です。",
"xpack.infra.deprecations.podIdFieldName": "ポッド ID",
"xpack.infra.deprecations.podIdFieldTitle": "ソース構成フィールドポッドIDは廃止予定です。",
"xpack.infra.deprecations.tiebreakerFieldName": "タイブレーカー",
"xpack.infra.deprecations.tiebreakerFieldTitle": "ソース構成フィールド[タイブレーカー]は廃止予定です。",
"xpack.infra.deprecations.timestampFieldName": "タイムスタンプ",
"xpack.infra.deprecations.timestampFieldTitle": "ソース構成フィールド[タイムスタンプ]は廃止予定です。",
"xpack.infra.durationUnits.days.plural": "日",
"xpack.infra.durationUnits.days.singular": "日",
"xpack.infra.durationUnits.hours.plural": "時間",

View file

@ -18348,15 +18348,6 @@
"xpack.infra.analysisSetup.indicesSelectionIndexNotFound": "没有索引匹配模式 {index}",
"xpack.infra.analysisSetup.indicesSelectionNoTimestampField": "匹配 {index} 的索引至少有一个缺少必需字段 {field}。",
"xpack.infra.analysisSetup.indicesSelectionTimestampNotValid": "匹配 {index} 的索引至少有一个具有称作 {field} 且类型不正确的字段。",
"xpack.infra.deprecations.containerAdjustIndexing": "调整索引以使用“{field}”标识 Docker 容器",
"xpack.infra.deprecations.deprecatedFieldConfigDescription": "配置“xpack.infra.sources.default.fields.{fieldKey}”已过时,将在 8.0.0 中移除。",
"xpack.infra.deprecations.deprecatedFieldConfigTitle": "“{fieldKey}”已过时。",
"xpack.infra.deprecations.deprecatedFieldDescription": "配置“{fieldName}”字段已过时,将在 8.0.0 中移除。此插件专用于 ECS预计该字段的值为 `{defaultValue}`。其在以下源{configCount, plural, other {配置}}中配置了不同的值:{configNames}",
"xpack.infra.deprecations.hostAdjustIndexing": "调整索引以使用“{field}”标识主机",
"xpack.infra.deprecations.podAdjustIndexing": "调整索引以使用“{field}”标识 Kubernetes pod",
"xpack.infra.deprecations.removeConfigField": "从 Kibana 配置中移除“xpack.infra.sources.default.fields.{fieldKey}”。",
"xpack.infra.deprecations.tiebreakerAdjustIndexing": "调整索引以将“{field}”用作决胜属性。",
"xpack.infra.deprecations.timestampAdjustIndexing": "调整索引以将“{field}”用作时间戳。",
"xpack.infra.homePage.toolbar.showingLastOneMinuteDataText": "选定时间过去 {duration}的数据",
"xpack.infra.hostsViewPage.errorOnCreateOrLoadDataview": "尝试创建以下数据视图时出错:{metricAlias}。尝试重新加载该页面。",
"xpack.infra.hostsViewPage.kpi.subtitle.average.limit": "平均值(属于 {limit} 台主机)",
@ -18508,16 +18499,6 @@
"xpack.infra.chartSection.notEnoughDataPointsToRenderTitle": "没有足够的数据",
"xpack.infra.common.tabBetaBadgeLabel": "公测版",
"xpack.infra.configureSourceActionLabel": "更改源配置",
"xpack.infra.deprecations.containerIdFieldName": "容器 ID",
"xpack.infra.deprecations.containerIdFieldTitle": "源配置字段“容器 ID”已过时。",
"xpack.infra.deprecations.hostnameFieldName": "主机名",
"xpack.infra.deprecations.hostnameFieldTitle": "源配置字段“主机名”已过时。",
"xpack.infra.deprecations.podIdFieldName": "Pod ID",
"xpack.infra.deprecations.podIdFieldTitle": "源配置字段“Pod ID”已过时。",
"xpack.infra.deprecations.tiebreakerFieldName": "决胜属性",
"xpack.infra.deprecations.tiebreakerFieldTitle": "源配置字段“决胜属性”已过时。",
"xpack.infra.deprecations.timestampFieldName": "时间戳",
"xpack.infra.deprecations.timestampFieldTitle": "源配置字段“时间戳”已过时。",
"xpack.infra.durationUnits.days.plural": "天",
"xpack.infra.durationUnits.days.singular": "天",
"xpack.infra.durationUnits.hours.plural": "小时",

View file

@ -43,9 +43,6 @@ export default function ({ getService }: FtrProviderContext) {
inventoryDefaultView: 'default',
metricsExplorerDefaultView: 'default',
anomalyThreshold: 70,
fields: {
message: ['message'],
},
logColumns: [
{
timestampColumn: {

View file

@ -56,9 +56,6 @@ export default function ({ getService }: FtrProviderContext) {
inventoryDefaultView: 'default',
metricsExplorerDefaultView: 'default',
anomalyThreshold: 70,
fields: {
message: ['message'],
},
logColumns: [
{
timestampColumn: {