Module event_queue

Module event_queue 

Source
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§

EventQueue
A queue of event queue per request from the engine.
ExecutedHttpRequest
Represents an HTTP request that was executed.
ExecutedOperation
Represents an executed GraphQL operation with detailed metrics.
ExecutedSubgraphRequest
Represents a request made to a subgraph with detailed execution information.
ExtensionEvent
Represents a custom extension log entry with serialized data.
FieldError
Contains information about field-level errors in a GraphQL response.
RequestError
Contains information about request-level errors in a GraphQL response.
SubgraphResponse
Contains timing and status information for a successful subgraph response.

Enums§

CacheStatus
Represents the cache status of a subgraph request.
Event
Represents different types of event queue entries.
GraphqlResponseStatus
Represents the status of a GraphQL response.
OperationType
Represents the type of GraphQL operation.
RequestExecution
Represents a single execution attempt of a subgraph request.

Functions§

send
Sends an event queue entry to the system.