Skip to content

Commit b998946

Browse files
lukasolsonkibanamachinejughosta
authored
Add warnings to upgrade assistant for search sessions (elastic#206998)
## Summary Part of elastic#203925. Resolves elastic#205813. Adds warning messages to the upgrade assistant if a cluster has unexpired search sessions, since the feature is being disabled by default and will have to be explicitly re-enabled to manage the sessions. --------- Co-authored-by: kibanamachine <[email protected]> Co-authored-by: Julia Rechkunova <[email protected]>
1 parent 71566f3 commit b998946

File tree

7 files changed

+139
-11
lines changed

7 files changed

+139
-11
lines changed

docs/upgrade-notes.asciidoc

+22
Original file line numberDiff line numberDiff line change
@@ -320,4 +320,26 @@ Systems that use HTTP/1 or don't have TLS configured will get a deprecation warn
320320
Verify that TLS is properly configured by enabling it and providing valid certificates in the settings. Test your system to ensure that connections are established securely over HTTP/2.
321321
322322
If your Kibana server is hosted behind a load balancer or reverse proxy we recommend testing your deployment configuration before upgrading to 9.0.
323+
====
324+
325+
326+
[discrete]
327+
[[known-issue-206998]]
328+
.Search sessions disabled by default (9.0.0)
329+
[%collapsible]
330+
====
331+
*Details* +
332+
Starting from version 9.0.0, search sessions are disabled by default. To view, manage, and restore search sessions, the feature needs to be explicitly re-enabled.
333+
334+
*Impact* +
335+
Search sessions will be disabled unless they are explicitly enabled in config.yml.
336+
337+
*Action* +
338+
If you would like to continue using, managing, and restoring search sessions in 9.0, you'll need to re-enable the feature in your kibana.yml configuration file. If not, no action is necessary.
339+
340+
To re-enable search sessions, add the following in your config.yml:
341+
342+
```
343+
data.search.sessions.enabled: true
344+
```
323345
====

src/platform/plugins/shared/data/server/config_deprecations.test.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ describe('Config Deprecations', () => {
6262
expect(messages).toMatchInlineSnapshot(`
6363
Array [
6464
"Setting \\"xpack.data_enhanced.search.sessions\\" has been replaced by \\"data.search.sessions\\"",
65-
"Configuring \\"data.search.sessions.enabled\\" is deprecated and will be removed in 9.0.0.",
65+
"Configuring \\"data.search.sessions.enabled\\" is deprecated and will be removed in 9.1.0.",
6666
]
6767
`);
6868
});
@@ -103,7 +103,7 @@ describe('Config Deprecations', () => {
103103
"You no longer need to configure \\"data.search.sessions.expireInterval\\".",
104104
"You no longer need to configure \\"data.search.sessions.monitoringTaskTimeout\\".",
105105
"You no longer need to configure \\"data.search.sessions.notTouchedInProgressTimeout\\".",
106-
"Configuring \\"data.search.sessions.enabled\\" is deprecated and will be removed in 9.0.0.",
106+
"Configuring \\"data.search.sessions.enabled\\" is deprecated and will be removed in 9.1.0.",
107107
]
108108
`);
109109
});
@@ -147,7 +147,7 @@ describe('Config Deprecations', () => {
147147
"You no longer need to configure \\"data.search.sessions.expireInterval\\".",
148148
"You no longer need to configure \\"data.search.sessions.monitoringTaskTimeout\\".",
149149
"You no longer need to configure \\"data.search.sessions.notTouchedInProgressTimeout\\".",
150-
"Configuring \\"data.search.sessions.enabled\\" is deprecated and will be removed in 9.0.0.",
150+
"Configuring \\"data.search.sessions.enabled\\" is deprecated and will be removed in 9.1.0.",
151151
]
152152
`);
153153
});

src/platform/plugins/shared/data/server/config_deprecations.ts

+8-8
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@ export const configDeprecationProvider: ConfigDeprecationProvider = ({
2727
unusedFromRoot('data.search.sessions.notTouchedInProgressTimeout', { level }),
2828

2929
// Search sessions config deprecations
30-
deprecateFromRoot('data.search.sessions.enabled', '9.0.0', { level }),
31-
deprecateFromRoot('data.search.sessions.notTouchedTimeout', '9.0.0', { level }),
32-
deprecateFromRoot('data.search.sessions.maxUpdateRetries', '9.0.0', { level }),
33-
deprecateFromRoot('data.search.sessions.defaultExpiration', '9.0.0', { level }),
34-
deprecateFromRoot('data.search.sessions.management.maxSessions', '9.0.0', { level }),
35-
deprecateFromRoot('data.search.sessions.management.refreshInterval', '9.0.0', { level }),
36-
deprecateFromRoot('data.search.sessions.management.refreshTimeout', '9.0.0', { level }),
37-
deprecateFromRoot('data.search.sessions.management.expiresSoonWarning', '9.0.0', { level }),
30+
deprecateFromRoot('data.search.sessions.enabled', '9.1.0', { level }),
31+
deprecateFromRoot('data.search.sessions.notTouchedTimeout', '9.1.0', { level }),
32+
deprecateFromRoot('data.search.sessions.maxUpdateRetries', '9.1.0', { level }),
33+
deprecateFromRoot('data.search.sessions.defaultExpiration', '9.1.0', { level }),
34+
deprecateFromRoot('data.search.sessions.management.maxSessions', '9.1.0', { level }),
35+
deprecateFromRoot('data.search.sessions.management.refreshInterval', '9.1.0', { level }),
36+
deprecateFromRoot('data.search.sessions.management.refreshTimeout', '9.1.0', { level }),
37+
deprecateFromRoot('data.search.sessions.management.expiresSoonWarning', '9.1.0', { level }),
3838
];
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 { createSearchSessionsDeprecationsConfig } from './search_sessions';
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
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+
import type {
11+
CoreSetup,
12+
DeprecationsDetails,
13+
GetDeprecationsContext,
14+
RegisterDeprecationsConfig,
15+
SavedObjectsFindResult,
16+
} from '@kbn/core/server';
17+
import { i18n } from '@kbn/i18n';
18+
import type { DeprecationDetailsMessage } from '@kbn/core-deprecations-common';
19+
import { SEARCH_SESSION_TYPE, SearchSessionSavedObjectAttributes } from '../../common';
20+
21+
type SearchSessionAttributes = Pick<
22+
SearchSessionSavedObjectAttributes,
23+
'name' | 'username' | 'expires'
24+
>;
25+
26+
export const createSearchSessionsDeprecationsConfig: (
27+
core: CoreSetup
28+
) => RegisterDeprecationsConfig = (core: CoreSetup) => ({
29+
getDeprecations: async (context: GetDeprecationsContext): Promise<DeprecationsDetails[]> => {
30+
const searchSessionsLink = core.http.basePath.prepend('/app/management/kibana/search_sessions');
31+
const [coreStart] = await core.getStartServices();
32+
const savedObjectsClient = coreStart.savedObjects.getScopedClient(context.request, {
33+
includedHiddenTypes: [SEARCH_SESSION_TYPE],
34+
});
35+
const results = await savedObjectsClient.find<SearchSessionAttributes>({
36+
type: 'search-session',
37+
perPage: 1000,
38+
fields: ['name', 'username', 'expires'],
39+
sortField: 'created',
40+
sortOrder: 'desc',
41+
namespaces: ['*'],
42+
});
43+
44+
const searchSessions: Array<SavedObjectsFindResult<SearchSessionAttributes>> =
45+
results.saved_objects.filter((so) => new Date(so.attributes.expires).getTime() > Date.now());
46+
47+
if (!searchSessions.length) {
48+
return [];
49+
}
50+
51+
return [
52+
{
53+
title: i18n.translate('data.deprecations.searchSessionsTitle', {
54+
defaultMessage: 'Search sessions will be disabled by default',
55+
}),
56+
message: buildMessage({ searchSessions, searchSessionsLink }),
57+
deprecationType: 'feature',
58+
level: 'warning',
59+
correctiveActions: {
60+
manualSteps: [
61+
i18n.translate('data.deprecations.searchSessions.manualStepOneMessage', {
62+
defaultMessage: 'Navigate to Stack Management > Kibana > Search Sessions',
63+
}),
64+
i18n.translate('data.deprecations.searchSessions.manualStepTwoMessage', {
65+
defaultMessage: 'Delete search sessions that have not expired',
66+
}),
67+
i18n.translate('data.deprecations.searchSessions.manualStepTwoMessage', {
68+
defaultMessage:
69+
'Alternatively, to continue using search sessions until 9.1, open the kibana.yml config file and add the following: "data.search.sessions.enabled: true"',
70+
}),
71+
],
72+
},
73+
},
74+
];
75+
},
76+
});
77+
78+
const buildMessage = ({
79+
searchSessions,
80+
searchSessionsLink,
81+
}: {
82+
searchSessions: Array<SavedObjectsFindResult<SearchSessionAttributes>>;
83+
searchSessionsLink: string;
84+
}): DeprecationDetailsMessage => ({
85+
type: 'markdown',
86+
content: i18n.translate('data.deprecations.scriptedFieldsMessage', {
87+
defaultMessage: `The search sessions feature is deprecated and is disabled by default in 9.0. You currently have {numberOfSearchSessions} active search session(s): [Manage Search Sessions]({searchSessionsLink})`,
88+
values: {
89+
numberOfSearchSessions: searchSessions.length,
90+
searchSessionsLink,
91+
},
92+
}),
93+
});

src/platform/plugins/shared/data/server/plugin.ts

+2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import { ExpressionsServerSetup } from '@kbn/expressions-plugin/server';
1212
import { PluginStart as DataViewsServerPluginStart } from '@kbn/data-views-plugin/server';
1313
import { UsageCollectionSetup } from '@kbn/usage-collection-plugin/server';
1414
import { FieldFormatsSetup, FieldFormatsStart } from '@kbn/field-formats-plugin/server';
15+
import { createSearchSessionsDeprecationsConfig } from './deprecations';
1516
import { ConfigSchema } from './config';
1617
import type { ISearchSetup, ISearchStart } from './search';
1718
import { DatatableUtilitiesService } from './datatable_utilities';
@@ -90,6 +91,7 @@ export class DataServerPlugin
9091
this.kqlTelemetryService.setup(core, { usageCollection });
9192

9293
core.uiSettings.register(getUiSettings(core.docLinks, this.config.enableUiSettingsValidations));
94+
core.deprecations.registerDeprecations(createSearchSessionsDeprecationsConfig(core));
9395

9496
const searchSetup = this.searchService.setup(core, {
9597
expressions,

src/platform/plugins/shared/data/tsconfig.json

+1
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
"@kbn/safer-lodash-set",
5555
"@kbn/esql-utils",
5656
"@kbn/shared-ux-table-persist",
57+
"@kbn/core-deprecations-common",
5758
],
5859
"exclude": [
5960
"target/**/*",

0 commit comments

Comments
 (0)