RFR: 7490: Trigger action does not return error message on failure.
Marcus Hirt
hirt at openjdk.org
Tue Sep 10 19:31:09 UTC 2024
On Tue, 3 Sep 2024 07:49:53 GMT, Virag Purnam <vpurnam at openjdk.org> wrote:
> If trigger action encounters any exception/error, it does not display the trigger value. On failure with the failure message, trigger value also should be displayed for the user.
>
> For example, if we are writing log to the drive which does not exists. Trigger action fails with IO exception.
>
> <img width="563" alt="FileWriteExceptionWithoutShowingTriggerValue" src="https://github.com/user-attachments/assets/9ec6b71e-ba14-432a-b51b-3865327cdeac">
>
> With this change, trigger value has been displayed along with IO exception.
>
> <img width="594" alt="FileWriteExceptionShowingTriggerValue" src="https://github.com/user-attachments/assets/f026e9ca-56f7-44a1-8af9-ea2d1018f34c">
>
>
> This change has been done for all the trigger actions.
>
>
> Along with this, few basic path and email validation has been added.
>
> Path validation:
>
> <img width="523" alt="PathValidation" src="https://github.com/user-attachments/assets/839c97eb-940f-4a90-ba22-bf1bc654e06c">
>
> Email validation:
>
> <img width="574" alt="EmailValidation" src="https://github.com/user-attachments/assets/1b99889a-4d3e-4a51-a990-10f24376a7c3">
application/org.openjdk.jmc.rjmx/src/main/java/org/openjdk/jmc/rjmx/triggers/internal/NotificationTrigger.java line 241:
> 239: - stateStore.m_lastTriggerErrorTimestamp >= TRIGGER_ERROR_HANDLING_LIMIT_TIME_MS)) {
> 240: stateStore.m_lastTriggerErrorTimestamp = aspectEvent.getTimestamp();
> 241: handleException(connectionHandle, rule, e, "");
Nit: I'm one of these weird people who prefer sending null to indicate that there is no trigger message rather than having a message that happened to be empty, and then adapting the output when encountering that to something that is a bit more clear and unambiguous, e.g. "no trigger message available". If that is not what you want to go for, then perhaps maybe just set as message here something that explains why there is not trigger message.
-------------
PR Review Comment: https://git.openjdk.org/jmc/pull/581#discussion_r1752611744
More information about the jmc-dev
mailing list