Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Response Ops] Remove ephemeral tasks from action and alerting plugins #197421

Merged
merged 13 commits into from
Dec 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions docs/settings/alert-action-settings.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -577,12 +577,6 @@ For a <<servicenow-action-type,{sn-itsm}>>, <<servicenow-sir-action-type,{sn-sir
[[alert-settings]]
=== Alerting settings

`xpack.alerting.maxEphemeralActionsPerAlert` {ess-icon}::
deprecated:[8.8.0]
Sets the number of actions that will run ephemerally. To use this, enable
ephemeral tasks in task manager first with
<<task-manager-settings,`xpack.task_manager.ephemeral_tasks.enabled`>>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'll probably need a cloud PR to remove them from the allow-list: https://github.com/elastic/cloud/pull/84878

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmmm ... not sure. I know the allow-list must be used when creating / updating the Kibana yml in the clould admin panels, but when else would it be used? If it gets used at some other time (cluster restart), then potentially it could prevent the restart because of invalid config?

It's fine if it's only used while creating / updating the Kibana yml in the cloud admin panel - presumably the config wouldn't be saveable next time a customer edited it, till they removed the config setting.

Have we done this in the past? I feel like we must have ...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess that's true. I guess we're just ignoring it now if it's set so it doesn't matter if it's still there

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps we should create a PR to label these in comments as deprecated, if we're not sure? Breadcrumbs for future cleanups?

Copy link
Contributor

@mikecote mikecote Nov 27, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From https://github.com/elastic/cloud/pull/133738#discussion_r1828211350, we can set a max value as we have to keep it around for deployments running 8.x for a long time.


`xpack.alerting.cancelAlertsOnRuleTimeout` {ess-icon}::
Specifies whether to skip writing alerts and scheduling actions if rule
processing was cancelled due to a timeout. Default: `true`. This setting can be
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ const createActionsClientMock = () => {
getBulk: jest.fn(),
getOAuthAccessToken: jest.fn(),
execute: jest.fn(),
ephemeralEnqueuedExecution: jest.fn(),
bulkEnqueueExecution: jest.fn(),
listTypes: jest.fn(),
isActionTypeEnabled: jest.fn(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ const unsecuredSavedObjectsClient = savedObjectsClientMock.create();
const scopedClusterClient = elasticsearchServiceMock.createScopedClusterClient();
const actionExecutor = actionExecutorMock.create();
const authorization = actionsAuthorizationMock.create();
const ephemeralExecutionEnqueuer = jest.fn();
const bulkExecutionEnqueuer = jest.fn();
const request = httpServerMock.createKibanaRequest();
const auditLogger = auditLoggerMock.create();
Expand Down Expand Up @@ -138,7 +137,6 @@ beforeEach(() => {
kibanaIndices,
inMemoryConnectors: [],
actionExecutor,
ephemeralExecutionEnqueuer,
bulkExecutionEnqueuer,
request,
authorization: authorization as unknown as ActionsAuthorization,
Expand Down Expand Up @@ -613,7 +611,6 @@ describe('create()', () => {
kibanaIndices,
inMemoryConnectors: [],
actionExecutor,
ephemeralExecutionEnqueuer,
bulkExecutionEnqueuer,
request,
authorization: authorization as unknown as ActionsAuthorization,
Expand Down Expand Up @@ -739,7 +736,6 @@ describe('create()', () => {
],

actionExecutor,
ephemeralExecutionEnqueuer,
bulkExecutionEnqueuer,
request,
authorization: authorization as unknown as ActionsAuthorization,
Expand Down Expand Up @@ -801,7 +797,6 @@ describe('create()', () => {
scopedClusterClient,
kibanaIndices,
actionExecutor,
ephemeralExecutionEnqueuer,
bulkExecutionEnqueuer,
request,
authorization: authorization as unknown as ActionsAuthorization,
Expand Down Expand Up @@ -862,7 +857,6 @@ describe('get()', () => {
scopedClusterClient,
kibanaIndices,
actionExecutor,
ephemeralExecutionEnqueuer,
bulkExecutionEnqueuer,
request,
authorization: authorization as unknown as ActionsAuthorization,
Expand Down Expand Up @@ -899,7 +893,6 @@ describe('get()', () => {
scopedClusterClient,
kibanaIndices,
actionExecutor,
ephemeralExecutionEnqueuer,
bulkExecutionEnqueuer,
request,
authorization: authorization as unknown as ActionsAuthorization,
Expand Down Expand Up @@ -956,7 +949,6 @@ describe('get()', () => {
scopedClusterClient,
kibanaIndices,
actionExecutor,
ephemeralExecutionEnqueuer,
bulkExecutionEnqueuer,
request,
authorization: authorization as unknown as ActionsAuthorization,
Expand Down Expand Up @@ -999,7 +991,6 @@ describe('get()', () => {
scopedClusterClient,
kibanaIndices,
actionExecutor,
ephemeralExecutionEnqueuer,
bulkExecutionEnqueuer,
request,
authorization: authorization as unknown as ActionsAuthorization,
Expand Down Expand Up @@ -1121,7 +1112,6 @@ describe('get()', () => {
scopedClusterClient,
kibanaIndices,
actionExecutor,
ephemeralExecutionEnqueuer,
bulkExecutionEnqueuer,
request,
authorization: authorization as unknown as ActionsAuthorization,
Expand Down Expand Up @@ -1165,7 +1155,6 @@ describe('get()', () => {
scopedClusterClient,
kibanaIndices,
actionExecutor,
ephemeralExecutionEnqueuer,
bulkExecutionEnqueuer,
request,
authorization: authorization as unknown as ActionsAuthorization,
Expand Down Expand Up @@ -1199,7 +1188,6 @@ describe('get()', () => {
scopedClusterClient,
kibanaIndices,
actionExecutor,
ephemeralExecutionEnqueuer,
bulkExecutionEnqueuer,
request,
authorization: authorization as unknown as ActionsAuthorization,
Expand Down Expand Up @@ -1270,7 +1258,6 @@ describe('getBulk()', () => {
scopedClusterClient,
kibanaIndices,
actionExecutor,
ephemeralExecutionEnqueuer,
bulkExecutionEnqueuer,
request,
authorization: authorization as unknown as ActionsAuthorization,
Expand Down Expand Up @@ -1408,7 +1395,6 @@ describe('getBulk()', () => {
scopedClusterClient,
kibanaIndices,
actionExecutor,
ephemeralExecutionEnqueuer,
bulkExecutionEnqueuer,
request,
authorization: authorization as unknown as ActionsAuthorization,
Expand Down Expand Up @@ -1503,7 +1489,6 @@ describe('getBulk()', () => {
scopedClusterClient,
kibanaIndices,
actionExecutor,
ephemeralExecutionEnqueuer,
bulkExecutionEnqueuer,
request,
authorization: authorization as unknown as ActionsAuthorization,
Expand Down Expand Up @@ -1577,7 +1562,6 @@ describe('getBulk()', () => {
scopedClusterClient,
kibanaIndices,
actionExecutor,
ephemeralExecutionEnqueuer,
bulkExecutionEnqueuer,
request,
authorization: authorization as unknown as ActionsAuthorization,
Expand Down Expand Up @@ -1662,7 +1646,6 @@ describe('getOAuthAccessToken()', () => {
scopedClusterClient,
kibanaIndices,
actionExecutor,
ephemeralExecutionEnqueuer,
bulkExecutionEnqueuer,
request,
authorization: authorization as unknown as ActionsAuthorization,
Expand Down Expand Up @@ -2097,7 +2080,6 @@ describe('delete()', () => {
},
],
actionExecutor,
ephemeralExecutionEnqueuer,
bulkExecutionEnqueuer,
request,
authorization: authorization as unknown as ActionsAuthorization,
Expand Down Expand Up @@ -2133,7 +2115,6 @@ describe('delete()', () => {
},
],
actionExecutor,
ephemeralExecutionEnqueuer,
bulkExecutionEnqueuer,
request,
authorization: authorization as unknown as ActionsAuthorization,
Expand Down Expand Up @@ -2653,7 +2634,6 @@ describe('update()', () => {
},
],
actionExecutor,
ephemeralExecutionEnqueuer,
bulkExecutionEnqueuer,
request,
authorization: authorization as unknown as ActionsAuthorization,
Expand Down Expand Up @@ -2696,7 +2676,6 @@ describe('update()', () => {
},
],
actionExecutor,
ephemeralExecutionEnqueuer,
bulkExecutionEnqueuer,
request,
authorization: authorization as unknown as ActionsAuthorization,
Expand Down Expand Up @@ -2782,7 +2761,6 @@ describe('execute()', () => {
scopedClusterClient,
kibanaIndices,
actionExecutor,
ephemeralExecutionEnqueuer,
bulkExecutionEnqueuer,
request,
authorization: authorization as unknown as ActionsAuthorization,
Expand Down Expand Up @@ -2845,7 +2823,6 @@ describe('execute()', () => {
scopedClusterClient,
kibanaIndices,
actionExecutor,
ephemeralExecutionEnqueuer,
bulkExecutionEnqueuer,
request,
authorization: authorization as unknown as ActionsAuthorization,
Expand Down Expand Up @@ -2907,7 +2884,6 @@ describe('execute()', () => {
scopedClusterClient,
kibanaIndices,
actionExecutor,
ephemeralExecutionEnqueuer,
bulkExecutionEnqueuer,
request,
authorization: authorization as unknown as ActionsAuthorization,
Expand Down Expand Up @@ -3180,7 +3156,6 @@ describe('isPreconfigured()', () => {
scopedClusterClient,
kibanaIndices,
actionExecutor,
ephemeralExecutionEnqueuer,
bulkExecutionEnqueuer,
request,
authorization: authorization as unknown as ActionsAuthorization,
Expand Down Expand Up @@ -3230,7 +3205,6 @@ describe('isPreconfigured()', () => {
scopedClusterClient,
kibanaIndices,
actionExecutor,
ephemeralExecutionEnqueuer,
bulkExecutionEnqueuer,
request,
authorization: authorization as unknown as ActionsAuthorization,
Expand Down Expand Up @@ -3282,7 +3256,6 @@ describe('isSystemAction()', () => {
scopedClusterClient,
kibanaIndices,
actionExecutor,
ephemeralExecutionEnqueuer,
bulkExecutionEnqueuer,
request,
authorization: authorization as unknown as ActionsAuthorization,
Expand Down Expand Up @@ -3332,7 +3305,6 @@ describe('isSystemAction()', () => {
scopedClusterClient,
kibanaIndices,
actionExecutor,
ephemeralExecutionEnqueuer,
bulkExecutionEnqueuer,
request,
authorization: authorization as unknown as ActionsAuthorization,
Expand Down
18 changes: 0 additions & 18 deletions x-pack/plugins/actions/server/actions_client/actions_client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import {
Logger,
} from '@kbn/core/server';
import { AuditLogger } from '@kbn/security-plugin/server';
import { RunNowResult } from '@kbn/task-manager-plugin/server';
import { IEventLogClient } from '@kbn/event-log-plugin/server';
import { KueryNode } from '@kbn/es-query';
import { Connector, ConnectorWithExtraFindData } from '../application/connector/types';
Expand Down Expand Up @@ -46,7 +45,6 @@ import {
} from '../types';
import { PreconfiguredActionDisabledModificationError } from '../lib/errors/preconfigured_action_disabled_modification';
import {
ExecutionEnqueuer,
ExecuteOptions as EnqueueExecutionOptions,
BulkExecutionEnqueuer,
ExecutionResponse,
Expand Down Expand Up @@ -92,7 +90,6 @@ export interface ConstructorOptions {
unsecuredSavedObjectsClient: SavedObjectsClientContract;
inMemoryConnectors: InMemoryConnector[];
actionExecutor: ActionExecutorContract;
ephemeralExecutionEnqueuer: ExecutionEnqueuer<RunNowResult>;
bulkExecutionEnqueuer: BulkExecutionEnqueuer<ExecutionResponse>;
request: KibanaRequest;
authorization: ActionsAuthorization;
Expand All @@ -112,7 +109,6 @@ export interface ActionsClientContext {
actionExecutor: ActionExecutorContract;
request: KibanaRequest;
authorization: ActionsAuthorization;
ephemeralExecutionEnqueuer: ExecutionEnqueuer<RunNowResult>;
bulkExecutionEnqueuer: BulkExecutionEnqueuer<ExecutionResponse>;
auditLogger?: AuditLogger;
usageCounter?: UsageCounter;
Expand All @@ -131,7 +127,6 @@ export class ActionsClient {
unsecuredSavedObjectsClient,
inMemoryConnectors,
actionExecutor,
ephemeralExecutionEnqueuer,
bulkExecutionEnqueuer,
request,
authorization,
Expand All @@ -148,7 +143,6 @@ export class ActionsClient {
kibanaIndices,
inMemoryConnectors,
actionExecutor,
ephemeralExecutionEnqueuer,
bulkExecutionEnqueuer,
request,
authorization,
Expand Down Expand Up @@ -504,18 +498,6 @@ export class ActionsClient {
return this.context.bulkExecutionEnqueuer(this.context.unsecuredSavedObjectsClient, options);
}

public async ephemeralEnqueuedExecution(options: EnqueueExecutionOptions): Promise<RunNowResult> {
await this.context.authorization.ensureAuthorized({
operation: 'execute',
actionTypeId: options.actionTypeId,
});

return this.context.ephemeralExecutionEnqueuer(
this.context.unsecuredSavedObjectsClient,
options
);
}

public async listTypes({
featureId,
includeSystemActionTypes = false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ const unsecuredSavedObjectsClient = savedObjectsClientMock.create();
const scopedClusterClient = elasticsearchServiceMock.createScopedClusterClient();
const actionExecutor = actionExecutorMock.create();
const authorization = actionsAuthorizationMock.create();
const ephemeralExecutionEnqueuer = jest.fn();
const bulkExecutionEnqueuer = jest.fn();
const request = httpServerMock.createKibanaRequest();
const auditLogger = auditLoggerMock.create();
Expand Down Expand Up @@ -131,7 +130,6 @@ beforeEach(() => {
kibanaIndices,
inMemoryConnectors: [],
actionExecutor,
ephemeralExecutionEnqueuer,
bulkExecutionEnqueuer,
request,
authorization: authorization as unknown as ActionsAuthorization,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ const unsecuredSavedObjectsClient = savedObjectsClientMock.create();
const scopedClusterClient = elasticsearchServiceMock.createScopedClusterClient();
const actionExecutor = actionExecutorMock.create();
const authorization = actionsAuthorizationMock.create();
const ephemeralExecutionEnqueuer = jest.fn();
const bulkExecutionEnqueuer = jest.fn();
const request = httpServerMock.createKibanaRequest();
const auditLogger = auditLoggerMock.create();
Expand All @@ -78,7 +77,6 @@ describe('getAll()', () => {
kibanaIndices,
inMemoryConnectors: [],
actionExecutor,
ephemeralExecutionEnqueuer,
bulkExecutionEnqueuer,
request,
authorization: authorization as unknown as ActionsAuthorization,
Expand Down Expand Up @@ -134,7 +132,6 @@ describe('getAll()', () => {
scopedClusterClient,
kibanaIndices,
actionExecutor,
ephemeralExecutionEnqueuer,
bulkExecutionEnqueuer,
request,
authorization: authorization as unknown as ActionsAuthorization,
Expand Down Expand Up @@ -279,7 +276,6 @@ describe('getAll()', () => {
scopedClusterClient,
kibanaIndices,
actionExecutor,
ephemeralExecutionEnqueuer,
bulkExecutionEnqueuer,
request,
authorization: authorization as unknown as ActionsAuthorization,
Expand Down Expand Up @@ -382,7 +378,6 @@ describe('getAll()', () => {
scopedClusterClient,
kibanaIndices,
actionExecutor,
ephemeralExecutionEnqueuer,
bulkExecutionEnqueuer,
request,
authorization: authorization as unknown as ActionsAuthorization,
Expand Down Expand Up @@ -487,7 +482,6 @@ describe('getAll()', () => {
scopedClusterClient,
kibanaIndices,
actionExecutor,
ephemeralExecutionEnqueuer,
bulkExecutionEnqueuer,
request,
authorization: authorization as unknown as ActionsAuthorization,
Expand Down Expand Up @@ -579,7 +573,6 @@ describe('getAll()', () => {
scopedClusterClient,
kibanaIndices,
actionExecutor,
ephemeralExecutionEnqueuer,
bulkExecutionEnqueuer,
request,
authorization: authorization as unknown as ActionsAuthorization,
Expand Down Expand Up @@ -613,7 +606,6 @@ describe('getAll()', () => {
scopedClusterClient,
kibanaIndices,
actionExecutor,
ephemeralExecutionEnqueuer,
bulkExecutionEnqueuer,
request,
authorization: authorization as unknown as ActionsAuthorization,
Expand Down Expand Up @@ -690,7 +682,6 @@ describe('getAll()', () => {
scopedClusterClient,
kibanaIndices,
actionExecutor,
ephemeralExecutionEnqueuer,
bulkExecutionEnqueuer,
request,
authorization: authorization as unknown as ActionsAuthorization,
Expand Down
Loading
Loading