ConsumerEvent
Table of contents
Description
Received when requesting Undelivered or Matched APIs. Represents a stored event which was either delivered or undelivered. To see which methods are returning such response see here.
Note: This object is returned on response from Alert Notification service Undelivered and Matched APIs
Properties
Field | Type | Description |
---|---|---|
id? | string | Identification guid of the event, created by Alert Notification service |
body | string | Describes what the event is about in details |
subject | string | Self explanatory title, which summarises what the sent event is about |
eventType | string | Type of the event, e.g. it can be HighCPUUsage, MemoryTooLow, etc. |
region | Region | Region on which the event was executed, e.g. ‘CF_AWS_FRANKFURT’ (its alias is ‘EU10’) |
regionType | string | Type of the region, e.g. ‘sap-cp’ |
severity | Severity (string) | Represents the event impact in the context of the affected resource |
category | Category (string) | Represents the event impact in the context of the affected resource |
resource | AffectedResource (object) | Identifies the action’s current state, that is, if it’s currently enabled or disabled |
metadata | ConsumerEventMetadata (object) | Holds a useful data about the stored event |
eventTimestamp? | string | Event timestamp, represents when it was created in the source, if missing Alert Notification service will populate it for you and will set the time it was ingested for processing |
priority? | number | Priority of the raised event |
tags? | object<string, string> | Any other useful information about the event. Some useful known tags by Alert Notification service are: - ans:sourceEventId? - generated by the source, will be used for further stateful interactions with Alert Notification service - ans:correlationId? - generated by the source in order to correlate this event with other activities or issues - ans:status? - will be used for incient management systems. Possible values: ‘CREATE_OR_UPDATE’, ‘CREATE’, ‘UPDATE’, ‘COMMENT’ or ‘CLOSE’ - ans:recommendedActionLink? - a URL that contains details for recommended actions regarding this event - ans:detailsLink? - a URL that contains details for this event, e.g. dashboards showing what triggered it |
@Example:
import { Severity, Category } from '@sap_oss/alert-notification-client';
const consumerEvent = {
id: 'matched-or-undelivered-event-id',
body: 'Your test-resource has been',
subject: 'test-resource exceeds cpu limits',
eventType: 'HighCpu',
severity: 'WARNING',
category: 'ALERT,
resource: {
resourceName: 'test-resource',
resourceType: 'application',
resourceInstance: '123456',
tags: {
detailsLink: 'https://example.details.com'
}
},
eventTimestamp: 1602787032,
priority: 1,
metadata: {
cacheTime: 1602788032,
affectedActionId: 'to-store',
deliveryStatus: 'MATCHED',
failureReasons: [
{
code: 400,
reason: 'Bad request',
timestamp: 1602788020
}
]
}
};
FailureReason
Description
Describes why the delivery of the event has failed. This property is only returned if you have specified the value FAILURE_REASON in the include query parameter.
Properties
Field | Type | Description |
---|---|---|
code | number | The error code that represents the failure |
reason | string | The reason why the delivery of the event has failed |
timestamp | number | Time in UNIX epoch format that specifies when the event failure occurred |
@Example
const failureReason = {
code: 400,
reason: 'Bad request',
timestamp: 1602788020
};
DeliveryStatus
Description
An enum which shows the status of an event. If the event was not delivered its status will be UNDELIVERED, on the other hand if a STORE action was delivered and saved the status of the event will be MATCHED.
Properties
Type | Available values |
---|---|
string | UNDELIVERED |
string | MATCHED |
@Example
import { DeliveryStatus } from '@sap_oss/alert-notification-client';
console.log(DeliveryStatus.UNDELIVERED); // will print 'UNDELIVERED'
console.log(DeliveryStatus.MATCHED); // will print 'MATCHED'
ConsumerEventMetadata
Description
Describes details regarding the undelivered/matched event, e.g. when it was stored in Alert Notification service, what is the delivery status, etc.
Properties
Field | Type | Description |
---|---|---|
cacheTime | string | Time in UNIX epoch format when the event was stored by Alert Notification service |
affectedActionId | string | Id of the action which was executed for the matched/undelivered event |
deliveryStatus | DeliveryStatus (object) | Describes if the event has been delivered or not |
failureReasons? | FailureReason (object) | Describes why the delivery of an event failed, will only be returned if a query parameter is present |
@Example
const failureReason = {
cacheTime: 1602788020,
affectedActionId: 'action-name',
deliveryStatus: 'UNDELIVERED',
failuerReasons: [
{
code: 400,
reason: 'Bad request',
timestamp: 1602788020
}
]
};