Status Types
Types related to tracker status and status history.
TrackerStatus
"""
Possible states for a tracker.
"""
enum TrackerStatus {
"""
Tracker is actively reporting.
"""
ACTIVE
"""
Tracker is offline or not responding.
"""
OFFLINE
"""
Tracker has reported an error condition.
"""
ERROR
"""
Tracker is in maintenance mode.
"""
MAINTENANCE
"""
Tracker has been deactivated.
"""
DEACTIVATED
}
StatusHistory
"""
Record of a tracker's status change.
"""
type StatusHistory {
"""
Unique identifier for the status record.
"""
id: ID!
"""
The tracker this status belongs to.
"""
tracker: Tracker!
"""
Status value.
"""
status: TrackerStatus!
"""
When the status was recorded.
Unix timestamp in seconds.
"""
timestamp: Int!
"""
Optional reason for the status change.
"""
reason: String
"""
Optional metadata about the status change.
"""
metadata: JSONObject
}
Fields
StatusHistory Type
| Field | Type | Description |
|---|---|---|
id | ID! | Required. Unique identifier |
tracker | Tracker! | Required. Associated tracker |
status | TrackerStatus! | Required. Status value |
timestamp | Int! | Required. Record timestamp |
reason | String | Optional. Change reason |
metadata | JSONObject | Optional. Additional data |
Usage
Query Status History
query GetStatusHistory {
tracker(id: "tracker_123") {
statusHistory {
status
timestamp
reason
metadata
}
}
}
Filter by Status
query GetActiveTrackers {
trackers(status: ACTIVE) {
nodes {
id
name
currentStatus
lastReportReceived
}
}
}
Best Practices
-
Status Changes
- Document status change reasons
- Include relevant metadata
- Consider notifications
-
History Management
- Implement retention policies
- Archive old records
- Maintain audit trails
-
Error Handling
- Handle status transitions
- Validate status changes
- Log invalid transitions
-
Performance
- Index status fields
- Cache current status
- Batch status updates