Create an Event
For creating Event
, we need to create the EventModel
first with an Entity
type of SYSTEM
or COMPONENT
on which the event will be attached.
Note: You can perform these operations using either the DRIVR UI at https://{your-domain-slug}.ui.drivr.cloud/
or the DRIVR GraphQL API at https://{your-domain-slug}.api.drivr.cloud/
.
Let's create an EventModel
for errors
level (eventLevel: ERROR
) on system
entity (entityType: SYSTEM
) within a given timestamp (eventType:RANGED
) with following:
- Navigate to Prototypes → Event Models
- Click "Add New"
-
Enter the following details:
- Code: Provide a unique identifier
- Message: Enter a message for the event
- Event Type: Select the type (Options:
RANGED
orSINGLE_POINT
) - Entity Type: Select the type (Options:
SYSTEM
orCOMPONENT
) - Event Level: Select the type (Options:
ERROR
,INFO
,SUCCESS
, orWARNING
) - Click "Create"
- Code:
ErrorSystemCode1
- Message:
Error message on System1
- Event Type:
RANGED
- Entity Type:
SYSTEM
- Event Level:
ERROR
mutation createEventModel {
createEventModel(
message: "Error message on System1",
eventType: RANGED,
eventLevel: ERROR,
entityType: SYSTEM,
code: "ErrorSystemCode1",
status: ACTIVATED
) {
uuid
code
message
eventType
eventLevel
entityType
status
}
}
Response
{
"data": {
"createEventModel": {
"uuid": "181ca359-96a7-4f5d-9d18-8c2dcf2ac9fa",
"code": "ErrorSystemCode1",
"message": "Error message on System1",
"eventType": "RANGED",
"eventLevel": "ERROR",
"entityType": "SYSTEM",
"status": "ACTIVATED"
}
}
}
In order to be able to emit an Event for a System we need to have one setup in DRIVR.
Let's create an Entity
of type SYSTEM
with the following mutation if you have not done so yet:
- Navigate to
System
- Click "Create System"
-
Enter the following details:
- Name: Select a name for your system
- Unique Code: Provide a unique identifier or use the auto-generated one
- System Owner: Owner of the system you want to create
- Description (Optional): Add additional details about the system
- Click "Create"
- Code:
SystemCode1
- Name:
System1
- Description:
This is system's description
- Status:
ACTIVATED
- System Owner:
Owner1
mutation createEntity {
createSystem(
name: "System1",
code: "SystemCode1",
description: "This is system's description",
status: ACTIVATED
) {
uuid
code
name
description
status
}
}
Response
{
"data": {
"createSystem": {
"uuid": "3c10f7cc-3205-46ac-99d9-71e31a192cb5",
"code": "SystemCode1",
"name": "System1",
"description": "This is system's description",
"status": "ACTIVATED"
}
}
}
Now, let's create an Event
for the System
with the following mutation:
- Navigate to
System
- Click the system you recently created for the event.
- You will see "Events" tab there. Click "Go to Events" button.
- Click "Create Event" button.
-
Enter the following details:
- Event Model: From the dropdown, select a
event model
you created earlier. - Time of occurrence: Specify the time range during which the event should begin.
- Event Model: From the dropdown, select a
- Click "Create"
- Event Model:
event_model_system_error
- Time of occurrence:
2022-01-01T00:00:00Z
- Resolved Time :
2022-01-01T01:00:00Z
(In case ofRANGED
event type)
You need to get the eventModelUuid
and entityUuid
from the above created EventModel
and Entity
respectively if you are using Graphql API. You may use the following to get the UUID
for eventModel
and entity
:
query getEventModel{
eventModels(where :{code:{_eq: "ErrorSystemCode1" }}){
items
{
uuid
code
}
}
}
Response
{
"data": {
"eventModels": {
"items": [
{
"uuid": "181ca359-96a7-4f5d-9d18-8c2dcf2ac9fa",
"code": "ErrorSystemCode1"
}
]
}
}
}
query getEntity{
systems(where :{code:{_eq: "SystemCode1" }}){
items
{
uuid
code
}
}
}
Response
{
"data": {
"systems": {
"items": [
{
"uuid": "3c10f7cc-3205-46ac-99d9-71e31a192cb5",
"code": "SystemCode1"
}
]
}
}
}
Then you can do the following mutation to create an event
:
mutation createEvent {
createEvent(
eventModelUuid:"181ca359-96a7-4f5d-9d18-8c2dcf2ac9fa",
entityUuid: "3c10f7cc-3205-46ac-99d9-71e31a192cb5",
time: "2025-07-01T00:00:00Z",
endTime: "2030-01-01T01:00:00Z"
) {
uuid
eventModelUuid
entityUuid
time
}
}
Response
{
"data": {
"createEvent": {
"uuid": "de7cafbf-dfeb-4a52-a35f-9424bfa14cb9",
"eventModelUuid": "181ca359-96a7-4f5d-9d18-8c2dcf2ac9fa",
"entityUuid": "3c10f7cc-3205-46ac-99d9-71e31a192cb5",
"time": "2025-07-01T00:00:00+00:00"
}
}
}
Acknowledging an Event
signifies that it has been noticed or addressed. Events support manual acknowledgment
, allowing users to track who has seen the event and is actively working to resolve or manage it.
We can acknowledge the event
in the following ways:
- Navigate to
System
- Click the system you recently created for the event.
- You will see "Events" tab there. Click "Go to Events" button.
- Click the event you recently created.
- Click "Acknowledged by" checkbox.
To acknowledgment the event for a system, we use the ackEvent
mutation:
You need to get the eventUuid
to acknowledge the event. You can get the UUID
for event
using the following query:
query events{
events(where: {eventModel:{uuid:{_eq:"de7cafbf-dfeb-4a52-a35f-9424bfa14cb9"}}}){
items{
uuid
acknowledged
}
}
}
Response
{
"data": {
"events": {
"items": [
{
"uuid": "de7cafbf-dfeb-4a52-a35f-9424bfa14cb9",
"acknowledged": false
}
]
}
}
}
Then you can do the following mutation to acknowledge that event
:
mutation ackEvent{
ackEvent(uuid: "de7cafbf-dfeb-4a52-a35f-9424bfa14cb9")
{
ok
}
}
Response
{
"data": {
"ackEvent": {
"ok": true
}
}
}
You can also create events
for components
in the same way and try different event types and levels.
Now you know, how to create an event
in DRIVR. 🚀 Lets see how to create event
using MQTT APIs.