Skip to content

Commit a41d43e

Browse files
committed
Update o11y logs profiles to check profileId instead of solutionType
1 parent 1a6d95e commit a41d43e

15 files changed

Lines changed: 41 additions & 17 deletions

File tree

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/*
2+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3+
* or more contributor license agreements. Licensed under the "Elastic License
4+
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
5+
* Public License v 1"; you may not use this file except in compliance with, at
6+
* your election, the "Elastic License 2.0", the "GNU Affero General Public
7+
* License v3.0 only", or the "Server Side Public License, v 1".
8+
*/
9+
10+
export const OBSERVABILITY_ROOT_PROFILE_ID = 'observability-root-profile';

src/plugins/discover/public/context_awareness/profile_providers/observability/log_document_profile/profile.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,14 @@ import {
2020
import { createContextAwarenessMocks } from '../../../__mocks__';
2121
import { createObservabilityLogDocumentProfileProvider } from './profile';
2222
import { ContextWithProfileId } from '../../../profile_service';
23+
import { OBSERVABILITY_ROOT_PROFILE_ID } from '../consts';
2324

2425
const mockServices = createContextAwarenessMocks().profileProviderServices;
2526

2627
describe('logDocumentProfileProvider', () => {
2728
const logDocumentProfileProvider = createObservabilityLogDocumentProfileProvider(mockServices);
2829
const ROOT_CONTEXT: ContextWithProfileId<RootContext> = {
29-
profileId: 'root-profile',
30+
profileId: OBSERVABILITY_ROOT_PROFILE_ID,
3031
solutionType: SolutionType.Observability,
3132
};
3233
const DATA_SOURCE_CONTEXT: ContextWithProfileId<DataSourceContext> = {

src/plugins/discover/public/context_awareness/profile_providers/observability/log_document_profile/profile.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,10 @@
88
*/
99

1010
import { DataTableRecord } from '@kbn/discover-utils';
11-
import { DocumentProfileProvider, DocumentType, SolutionType } from '../../../profiles';
11+
import { DocumentProfileProvider, DocumentType } from '../../../profiles';
1212
import { ProfileProviderServices } from '../../profile_provider_services';
1313
import { getDocViewer } from './accessors';
14+
import { OBSERVABILITY_ROOT_PROFILE_ID } from '../consts';
1415

1516
export const createObservabilityLogDocumentProfileProvider = (
1617
services: ProfileProviderServices
@@ -20,7 +21,7 @@ export const createObservabilityLogDocumentProfileProvider = (
2021
getDocViewer,
2122
},
2223
resolve: ({ record, rootContext }) => {
23-
if (rootContext.solutionType !== SolutionType.Observability) {
24+
if (rootContext.profileId !== OBSERVABILITY_ROOT_PROFILE_ID) {
2425
return { isMatch: false };
2526
}
2627

src/plugins/discover/public/context_awareness/profile_providers/observability/logs_data_source_profile/profile.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import { createLogsDataSourceProfileProvider } from './profile';
2222
import { DataGridDensity } from '@kbn/unified-data-table';
2323
import { dataViewWithTimefieldMock } from '../../../../__mocks__/data_view_with_timefield';
2424
import type { ContextWithProfileId } from '../../../profile_service';
25+
import { OBSERVABILITY_ROOT_PROFILE_ID } from '../consts';
2526

2627
const mockServices = createContextAwarenessMocks().profileProviderServices;
2728

@@ -31,7 +32,7 @@ describe('logsDataSourceProfileProvider', () => {
3132
const MIXED_INDEX_PATTERN = 'logs-nginx.access-*,metrics-*';
3233
const INVALID_INDEX_PATTERN = 'my_source-access-*';
3334
const ROOT_CONTEXT: ContextWithProfileId<RootContext> = {
34-
profileId: 'root-profile',
35+
profileId: OBSERVABILITY_ROOT_PROFILE_ID,
3536
solutionType: SolutionType.Observability,
3637
};
3738
const RESOLUTION_MATCH = {

src/plugins/discover/public/context_awareness/profile_providers/observability/logs_data_source_profile/profile.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,15 @@
77
* License v3.0 only", or the "Server Side Public License, v 1".
88
*/
99

10-
import { DataSourceCategory, DataSourceProfileProvider, SolutionType } from '../../../profiles';
10+
import { DataSourceCategory, DataSourceProfileProvider } from '../../../profiles';
1111
import { ProfileProviderServices } from '../../profile_provider_services';
1212
import {
1313
getCellRenderers,
1414
getRowIndicatorProvider,
1515
getRowAdditionalLeadingControls,
1616
} from './accessors';
1717
import { extractIndexPatternFrom } from '../../extract_index_pattern_from';
18+
import { OBSERVABILITY_ROOT_PROFILE_ID } from '../consts';
1819

1920
export const createLogsDataSourceProfileProvider = (
2021
services: ProfileProviderServices
@@ -26,7 +27,7 @@ export const createLogsDataSourceProfileProvider = (
2627
getRowAdditionalLeadingControls,
2728
},
2829
resolve: (params) => {
29-
if (params.rootContext.solutionType !== SolutionType.Observability) {
30+
if (params.rootContext.profileId !== OBSERVABILITY_ROOT_PROFILE_ID) {
3031
return { isMatch: false };
3132
}
3233

src/plugins/discover/public/context_awareness/profile_providers/observability/logs_data_source_profile/sub_profiles/apache_error_logs.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,10 @@ import { createContextAwarenessMocks } from '../../../../__mocks__';
1414
import { createLogsDataSourceProfileProvider } from '../profile';
1515
import { createApacheErrorLogsDataSourceProfileProvider } from './apache_error_logs';
1616
import type { ContextWithProfileId } from '../../../../profile_service';
17+
import { OBSERVABILITY_ROOT_PROFILE_ID } from '../../consts';
1718

1819
const ROOT_CONTEXT: ContextWithProfileId<RootContext> = {
19-
profileId: 'root-profile',
20+
profileId: OBSERVABILITY_ROOT_PROFILE_ID,
2021
solutionType: SolutionType.Observability,
2122
};
2223
const { profileProviderServices } = createContextAwarenessMocks();

src/plugins/discover/public/context_awareness/profile_providers/observability/logs_data_source_profile/sub_profiles/aws_s3access_logs.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,10 @@ import { createContextAwarenessMocks } from '../../../../__mocks__';
1414
import { createLogsDataSourceProfileProvider } from '../profile';
1515
import { createAwsS3accessLogsDataSourceProfileProvider } from './aws_s3access_logs';
1616
import type { ContextWithProfileId } from '../../../../profile_service';
17+
import { OBSERVABILITY_ROOT_PROFILE_ID } from '../../consts';
1718

1819
const ROOT_CONTEXT: ContextWithProfileId<RootContext> = {
19-
profileId: 'root-profile',
20+
profileId: OBSERVABILITY_ROOT_PROFILE_ID,
2021
solutionType: SolutionType.Observability,
2122
};
2223
const { profileProviderServices } = createContextAwarenessMocks();

src/plugins/discover/public/context_awareness/profile_providers/observability/logs_data_source_profile/sub_profiles/create_resolve.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,13 @@ import {
1616
SolutionType,
1717
} from '../../../../profiles';
1818
import { createResolve } from './create_resolve';
19+
import { OBSERVABILITY_ROOT_PROFILE_ID } from '../../consts';
1920

2021
describe('createResolve', () => {
2122
const VALID_INDEX_PATTERN = 'valid';
2223
const INVALID_INDEX_PATTERN = 'invalid';
2324
const ROOT_CONTEXT: ContextWithProfileId<RootContext> = {
24-
profileId: 'root-profile',
25+
profileId: OBSERVABILITY_ROOT_PROFILE_ID,
2526
solutionType: SolutionType.Observability,
2627
};
2728
const RESOLUTION_MATCH = {

src/plugins/discover/public/context_awareness/profile_providers/observability/logs_data_source_profile/sub_profiles/create_resolve.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,17 @@
88
*/
99

1010
import { createRegExpPatternFrom, testPatternAgainstAllowedList } from '@kbn/data-view-utils';
11-
import { DataSourceCategory, DataSourceProfileProvider, SolutionType } from '../../../../profiles';
11+
import { DataSourceCategory, DataSourceProfileProvider } from '../../../../profiles';
1212
import { extractIndexPatternFrom } from '../../../extract_index_pattern_from';
13+
import { OBSERVABILITY_ROOT_PROFILE_ID } from '../../consts';
1314

1415
export const createResolve = (baseIndexPattern: string): DataSourceProfileProvider['resolve'] => {
1516
const testIndexPattern = testPatternAgainstAllowedList([
1617
createRegExpPatternFrom(baseIndexPattern),
1718
]);
1819

1920
return (params) => {
20-
if (params.rootContext.solutionType !== SolutionType.Observability) {
21+
if (params.rootContext.profileId !== OBSERVABILITY_ROOT_PROFILE_ID) {
2122
return { isMatch: false };
2223
}
2324

src/plugins/discover/public/context_awareness/profile_providers/observability/logs_data_source_profile/sub_profiles/kubernetes_container_logs.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,10 @@ import { createContextAwarenessMocks } from '../../../../__mocks__';
1414
import { createLogsDataSourceProfileProvider } from '../profile';
1515
import { createKubernetesContainerLogsDataSourceProfileProvider } from './kubernetes_container_logs';
1616
import { ContextWithProfileId } from '../../../../profile_service';
17+
import { OBSERVABILITY_ROOT_PROFILE_ID } from '../../consts';
1718

1819
const ROOT_CONTEXT: ContextWithProfileId<RootContext> = {
19-
profileId: 'root-profile',
20+
profileId: OBSERVABILITY_ROOT_PROFILE_ID,
2021
solutionType: SolutionType.Observability,
2122
};
2223
const { profileProviderServices } = createContextAwarenessMocks();

0 commit comments

Comments
 (0)