Skip to content

Commit

Permalink
[Logs] Deprecate HTTP APIs used in LogStream app (elastic#201974)
Browse files Browse the repository at this point in the history
## 📓 Summary

Closes elastic#200968 

These changes deprecate internal APIs used by the LogStream app, which
is also deprecated.

With v9, any internal API will become unreachable from external origins.
In case we get an external request to these APIs (although it should be
less likely to happen), the deprecation will be surfaced on the Upgrade
Assistant UI as a warning.

<img width="3005" alt="Screenshot 2024-11-27 at 13 16 39"
src="https://github.com/user-attachments/assets/c3864a5a-49c7-4cbd-8893-9041b5ee207e">

<img width="3007" alt="Screenshot 2024-11-27 at 13 16 25"
src="https://github.com/user-attachments/assets/f9fb254f-b795-4d01-8d92-463a0ca526a3">

Co-authored-by: Marco Antonio Ghiani <marcoantonio.ghiani@elastic.co>
  • Loading branch information
tonyghiani and Marco Antonio Ghiani authored Dec 11, 2024
1 parent 38f30a9 commit a176c0f
Show file tree
Hide file tree
Showing 6 changed files with 79 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { fold } from 'fp-ts/lib/Either';
import { identity } from 'fp-ts/lib/function';
import { schema } from '@kbn/config-schema';

import { i18n } from '@kbn/i18n';
import { logEntriesV1 } from '../../../common/http_api';
import { throwErrors } from '../../../common/runtime_types';

Expand All @@ -33,6 +34,20 @@ export const initLogEntriesHighlightsRoute = ({ framework, logEntries }: LogsSha
{
version: '1',
validate: { request: { body: escapeHatch } },
options: {
deprecated: {
documentationUrl: '',
severity: 'warning',
message: i18n.translate(
'xpack.logsShared.deprecations.postLogEntriesHighlightsRoute.message',
{
defaultMessage:
'Given the deprecation of the LogStream feature, this API will not return reliable data in upcoming versions of Kibana.',
}
),
reason: { type: 'deprecate' },
},
},
},
async (requestContext, request, response) => {
const payload = pipe(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { fold } from 'fp-ts/lib/Either';
import { identity } from 'fp-ts/lib/function';
import { schema } from '@kbn/config-schema';

import { i18n } from '@kbn/i18n';
import { logEntriesV1 } from '../../../common/http_api';
import { throwErrors } from '../../../common/runtime_types';

Expand All @@ -36,6 +37,20 @@ export const initLogEntriesSummaryRoute = ({
{
version: '1',
validate: { request: { body: escapeHatch } },
options: {
deprecated: {
documentationUrl: '',
severity: 'warning',
message: i18n.translate(
'xpack.logsShared.deprecations.postLogEntriesSummaryRoute.message',
{
defaultMessage:
'Given the deprecation of the LogStream feature, this API will not return reliable data in upcoming versions of Kibana.',
}
),
reason: { type: 'deprecate' },
},
},
},
async (requestContext, request, response) => {
const payload = pipe(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { fold } from 'fp-ts/lib/Either';
import { identity } from 'fp-ts/lib/function';
import { schema } from '@kbn/config-schema';

import { i18n } from '@kbn/i18n';
import { logEntriesV1 } from '../../../common/http_api';
import { throwErrors } from '../../../common/runtime_types';

Expand All @@ -35,6 +36,20 @@ export const initLogEntriesSummaryHighlightsRoute = ({
{
version: '1',
validate: { request: { body: escapeHatch } },
options: {
deprecated: {
documentationUrl: '',
severity: 'warning',
message: i18n.translate(
'xpack.logsShared.deprecations.postLogEntriesSummaryHighlightsRoute.message',
{
defaultMessage:
'Given the deprecation of the LogStream feature, this API will not return reliable data in upcoming versions of Kibana.',
}
),
reason: { type: 'deprecate' },
},
},
},
async (requestContext, request, response) => {
const payload = pipe(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* 2.0.
*/

import { i18n } from '@kbn/i18n';
import { logViewsV1 } from '../../../common/http_api';
import { LOG_VIEW_URL } from '../../../common/http_api/log_views';
import { createValidationFunction } from '../../../common/runtime_types';
Expand All @@ -30,6 +31,17 @@ export const initGetLogViewRoute = ({
params: createValidationFunction(logViewsV1.getLogViewRequestParamsRT),
},
},
options: {
deprecated: {
documentationUrl: '',
severity: 'warning',
message: i18n.translate('xpack.logsShared.deprecations.getLogViewRoute.message', {
defaultMessage:
'Given the deprecation of the LogStream feature, this API will not have any effect configuring upcoming versions of Kibana.',
}),
reason: { type: 'deprecate' },
},
},
},
async (_requestContext, request, response) => {
const { logViewId } = request.params;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* 2.0.
*/

import { i18n } from '@kbn/i18n';
import { logViewsV1 } from '../../../common/http_api';
import { LOG_VIEW_URL } from '../../../common/http_api/log_views';
import { createValidationFunction } from '../../../common/runtime_types';
Expand All @@ -26,6 +27,17 @@ export const initPutLogViewRoute = ({ framework, getStartServices }: LogsSharedB
body: createValidationFunction(logViewsV1.putLogViewRequestPayloadRT),
},
},
options: {
deprecated: {
documentationUrl: '',
severity: 'warning',
message: i18n.translate('xpack.logsShared.deprecations.putLogViewRoute.message', {
defaultMessage:
'Given the deprecation of the LogStream feature, this API will not have any effect configuring upcoming versions of Kibana.',
}),
reason: { type: 'deprecate' },
},
},
},
async (_requestContext, request, response) => {
const { logViewId } = request.params;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,20 @@ export class LogEntriesService {
setupDeps: LogEntriesServiceSetupDeps
) {
void core.getStartServices().then(([, startDeps, selfStartDeps]) => {
/**
* @deprecated
*
* Given the deprecation of the LogStream feature, this API will not return reliable data in upcoming versions of Kibana.
*/
setupDeps.data.search.registerSearchStrategy(
LOG_ENTRIES_SEARCH_STRATEGY,
logEntriesSearchStrategyProvider({ ...setupDeps, ...startDeps, ...selfStartDeps })
);
/**
* @deprecated
*
* Given the deprecation of the LogStream feature, this API will not return reliable data in upcoming versions of Kibana.
*/
setupDeps.data.search.registerSearchStrategy(
LOG_ENTRY_SEARCH_STRATEGY,
logEntrySearchStrategyProvider({ ...setupDeps, ...startDeps, ...selfStartDeps })
Expand Down

0 comments on commit a176c0f

Please sign in to comment.