Skip to main content

Module correlation_id

Module correlation_id 

Source
Expand description

CorrelationId newtype for cross-service request correlation.

A CorrelationId is distinct from a crate::request_id::RequestId:

  • RequestId identifies a single HTTP request at the edge.
  • CorrelationId groups related requests across multiple services (e.g. an entire user-initiated action that fans out to N microservices).

The value is an opaque string transported in the X-Correlation-Id HTTP header. UUID v4 generation is provided for convenience.

§Example

use api_bones::correlation_id::CorrelationId;

let id = CorrelationId::new_uuid();
assert_eq!(id.header_name(), "X-Correlation-Id");

let parsed: CorrelationId = "my-correlation-123".parse().unwrap();
assert_eq!(parsed.as_str(), "my-correlation-123");

Structs§

CorrelationId
An opaque cross-service correlation identifier, transported via X-Correlation-Id.

Enums§

CorrelationIdError
Error returned when constructing a CorrelationId from a string fails.