-
Notifications
You must be signed in to change notification settings - Fork 8k
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
Unable to throw user type errors in the connector executor code #180419
Labels
bug
Fixes for quality problems that affect the customer experience
Feature:Actions
Team:ResponseOps
Label for the ResponseOps team (formerly the Cases and Alerting teams)
Comments
mikecote
added
the
bug
Fixes for quality problems that affect the customer experience
label
Apr 9, 2024
mikecote
added
the
Team:ResponseOps
Label for the ResponseOps team (formerly the Cases and Alerting teams)
label
Apr 9, 2024
This was referenced Apr 9, 2024
ymao1
added a commit
that referenced
this issue
May 24, 2024
…rs if defined. (#184015) Resolves #180419 ## Summary Updates action executor to use error source from errors thrown within the connector type executor, defaulting to framework error if no error source is specified. ## To Verify Modify the server log connector to throw a user error: ``` --- a/x-pack/plugins/stack_connectors/server/connector_types/server_log/index.ts +++ b/x-pack/plugins/stack_connectors/server/connector_types/server_log/index.ts @@ -14,6 +14,7 @@ import type { ActionTypeExecutorOptions as ConnectorTypeExecutorOptions, ActionTypeExecutorResult as ConnectorTypeExecutorResult, } from '@kbn/actions-plugin/server/types'; +import { createTaskRunError, TaskErrorSource } from '@kbn/task-manager-plugin/server'; import { AlertingConnectorFeatureId, UptimeConnectorFeatureId, @@ -78,6 +79,7 @@ async function executor( execOptions: ServerLogConnectorTypeExecutorOptions ): Promise<ConnectorTypeExecutorResult<void>> { const { actionId, params, logger } = execOptions; + throw createTaskRunError(new Error('fail'), TaskErrorSource.USER); const sanitizedMessage = withoutControlCharacters(params.message); ``` Create a rule that will trigger a server log action. Let the action run and then check the metrics endpoint at https://localhost:5601/api/task_manager/metrics?reset=false to see that this error was captured as a user error. Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
rshen91
pushed a commit
to rshen91/kibana
that referenced
this issue
May 30, 2024
…rs if defined. (elastic#184015) Resolves elastic#180419 ## Summary Updates action executor to use error source from errors thrown within the connector type executor, defaulting to framework error if no error source is specified. ## To Verify Modify the server log connector to throw a user error: ``` --- a/x-pack/plugins/stack_connectors/server/connector_types/server_log/index.ts +++ b/x-pack/plugins/stack_connectors/server/connector_types/server_log/index.ts @@ -14,6 +14,7 @@ import type { ActionTypeExecutorOptions as ConnectorTypeExecutorOptions, ActionTypeExecutorResult as ConnectorTypeExecutorResult, } from '@kbn/actions-plugin/server/types'; +import { createTaskRunError, TaskErrorSource } from '@kbn/task-manager-plugin/server'; import { AlertingConnectorFeatureId, UptimeConnectorFeatureId, @@ -78,6 +79,7 @@ async function executor( execOptions: ServerLogConnectorTypeExecutorOptions ): Promise<ConnectorTypeExecutorResult<void>> { const { actionId, params, logger } = execOptions; + throw createTaskRunError(new Error('fail'), TaskErrorSource.USER); const sanitizedMessage = withoutControlCharacters(params.message); ``` Create a rule that will trigger a server log action. Let the action run and then check the metrics endpoint at https://localhost:5601/api/task_manager/metrics?reset=false to see that this error was captured as a user error. Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
bug
Fixes for quality problems that affect the customer experience
Feature:Actions
Team:ResponseOps
Label for the ResponseOps team (formerly the Cases and Alerting teams)
I am unable to inject code in a connector executor that will mark an error as a user error, it gets flagged as a framework error instead.
Steps to reproduce
/api/task_manager/metrics
/api/task_manager/metrics
actions:.server-log
has zerouser_errors
, but oneframework_errors
Expected outcome
Errors thrown as user errors in connector executor code to be marked as
user_errors
in the task manager metrics.cc @elastic/response-ops-execution @kobelb @heespi
The text was updated successfully, but these errors were encountered: