Expand description
Event queuing functionality for tracking and recording request events.
This module provides comprehensive event queuing capabilities for tracking various types of operations and requests within the Grafbase Gateway system. It supports tracking of GraphQL operations, subgraph requests, HTTP requests, and custom extension logs.
§Overview
The event queue system is designed to capture detailed information about:
- GraphQL operation execution (including timing, caching, and status)
- Subgraph request details (including retries, caching, and response times)
- HTTP request execution
- Custom extension logs with serializable data
§Example
use grafbase_sdk::host_io::event_queue;
use serde::Serialize;
#[derive(Serialize)]
struct CustomEvent {
user_id: String,
action: String,
timestamp: u64,
}
// Send a custom event
let log = CustomEvent {
user_id: "user123".to_string(),
action: "query_execution".to_string(),
timestamp: 1234567890,
};
event_queue::send("custom_event", log).expect("Failed to send event");
§Log Aggregation
By itself, event queue calls do nothing in the Grafbase Gateway. You must implement
an [Hosts
] type of an extension with event filtering, which will be called after
a response is sent back to the user.
Structs§
- Event
Queue - A queue of event queue per request from the engine.
- Executed
Http Request - Represents an HTTP request that was executed.
- Executed
Operation - Represents an executed GraphQL operation with detailed metrics.
- Executed
Subgraph Request - Represents a request made to a subgraph with detailed execution information.
- Extension
Event - Represents a custom extension log entry with serialized data.
- Field
Error - Contains information about field-level errors in a GraphQL response.
- Request
Error - Contains information about request-level errors in a GraphQL response.
- Subgraph
Response - Contains timing and status information for a successful subgraph response.
Enums§
- Cache
Status - Represents the cache status of a subgraph request.
- Event
- Represents different types of event queue entries.
- Graphql
Response Status - Represents the status of a GraphQL response.
- Operation
Type - Represents the type of GraphQL operation.
- Request
Execution - Represents a single execution attempt of a subgraph request.
Functions§
- send
- Sends an event queue entry to the system.