[Monitoring] Read expiryDateMS from the right path in License rule (#148129)

The license details have been placed under the `meta` property but the
context messages were not updated to read correctly from that path, this
PR fixes that little issue.
This commit is contained in:
Milton Hultgren 2022-12-29 18:28:13 +01:00 committed by GitHub
parent c71f2d196f
commit 0b83a2a61a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

View file

@ -111,7 +111,9 @@ export interface AlertThreadPoolRejectionsState extends AlertNodeState {
}
export interface AlertLicenseState extends AlertState {
expiryDateMS: number;
meta: {
expiryDateMS: number;
};
}
export interface AlertNodesChangedState extends AlertState {

View file

@ -155,7 +155,7 @@ export class LicenseExpirationRule extends BaseRule {
// Logic in the base alert assumes that all alerts will operate against multiple nodes/instances (such as a CPU alert against ES nodes)
// However, some alerts operate on the state of the cluster itself and are only concerned with a single state
const state: AlertLicenseState = alertStates[0] as AlertLicenseState;
const $duration = moment.duration(+new Date() - state.expiryDateMS);
const $duration = moment.duration(+new Date() - state.meta.expiryDateMS);
const actionText = i18n.translate('xpack.monitoring.alerts.licenseExpiration.action', {
defaultMessage: 'Please update your license.',
});