Class AlertProcessMetaData
java.lang.Object
com.kingsrook.qqq.backend.core.model.metadata.processes.QSupplementalProcessMetaData
com.kingsrook.qqq.backend.core.alerts.AlertProcessMetaData
"Tell me when this process fails" and "tell me when it didn't run", by
meta-data alone:
process.withSupplementalMetaData(new AlertProcessMetaData()
.withAlertOnFailure(AlertSeverity.ERROR)
.withExpectedEvery(Duration.ofHours(24)));
At enrichment this declares the alert types process.(name).failed (when
alertOnFailure is set) and process.(name).missed (when expectedEvery is set,
with a seeded heartbeat monitor), where (name) is the process name in
lowercase-hyphen form, and registers AlertProcessLifecycleListener, which
raises on failure, resolves on the next success and beats on success.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidenrich(QInstanceEnricher qInstanceEnricher, QProcessMetaData process) Declare this process's alert types and register the lifecycle listener.static StringfailedTypeName(String processName) The alert type raised when the process fails.Getter for alertOnFailureGetter for expectedEverygetType()Getter for typestatic StringheartbeatKey(String processName) The heartbeat key a successful run beats.static StringmissedTypeName(String processName) The alert type raised when the process has not completed in time.static AlertProcessMetaDataof(QProcessMetaData process) The process's alerts meta-data, or null.static StringtoTypeSegment(String processName) A process name as an alert-type segment: camelCase and anything that is not a letter or digit become lowercase words joined by hyphens (alertsEvaluateMonitors becomes alerts-evaluate-monitors).voidvalidate(QInstance qInstance, QProcessMetaData process, QInstanceValidator qInstanceValidator) Something must be asked for, and an interval must be positive.withAlertOnFailure(AlertSeverity alertOnFailure) Fluent setter for alertOnFailure - the severity of the alert raised when a run fails (null: don't alert on failure).withExpectedEvery(Duration expectedEvery) Fluent setter for expectedEvery - how often a successful run is expected (null: don't watch for missed runs).
-
Field Details
-
TYPE
- See Also:
-
GROUP_NAME
-
-
Constructor Details
-
AlertProcessMetaData
public AlertProcessMetaData()
-
-
Method Details
-
of
The process's alerts meta-data, or null. -
toTypeSegment
-
failedTypeName
-
missedTypeName
-
heartbeatKey
-
getType
Description copied from class:QSupplementalProcessMetaDataGetter for type- Specified by:
getTypein classQSupplementalProcessMetaData
-
enrich
Declare this process's alert types and register the lifecycle listener. Safe to run more than once.- Overrides:
enrichin classQSupplementalProcessMetaData
-
validate
public void validate(QInstance qInstance, QProcessMetaData process, QInstanceValidator qInstanceValidator) Something must be asked for, and an interval must be positive.- Overrides:
validatein classQSupplementalProcessMetaData
-
getAlertOnFailure
Getter for alertOnFailure -
withAlertOnFailure
Fluent setter for alertOnFailure - the severity of the alert raised when a run fails (null: don't alert on failure). -
getExpectedEvery
Getter for expectedEvery -
withExpectedEvery
Fluent setter for expectedEvery - how often a successful run is expected (null: don't watch for missed runs).
-