Wide events are very similar to canonical logs. Instead of scattering data across multiple logs or events, a wide event compiles all key data related to a request into a singular, detailed "wide" event (with more fields that a typical event would count). This approach enables powerful queries on the data without the need for complex and computationally expensive joins.
Consider a web application where a user sends a request. In a wide event approach, every detail from the start to the end of this request — including user inputs, system states, network and database calls, and even business logic metrics — is captured in a single, expansive event. This contrasts with traditional methods where such information might be split across multiple logs throughout all the request.
const transactionEvent = {
userId: '12345',
action: 'purchase',
items: ['item1', 'item2'],
totalCost: 150,
timestamp: new Date(),
networkLatency: 120, // in milliseconds
// ...other relevant fields
};
console.log(JSON.stringify(transactionEvent));
A single wide events enables you to leverage your observability platform more effectively; you could for instance query request latency per user, or analyse if there's a correlation between the cost and the action performed by a user. Wide events enable you to answer questions about your system you couldn't predict you'd need to answer when you wrote the application code.
From wide events, there's only one step to distributed tracing: automatic accurate latency measurements.