Skip to content

[Context]: add ICorrelationIdGenerator with TimeProvider support #13

Description

@rian-be

Summary

Add a small, reusable ICorrelationIdGenerator that produces correlation identifiers, with TimeProvider injection for deterministic unit tests.

Goal

Give IContext implementations a clean supported way to mint CorrelationId (used by header propagation and logging) without each app reinvent the format.

Problem

Propagation examples hand-write X-Correlation-Id values ad hoc. There is no uniform generator, so formats differ across services, which breaks 1.1 header correlation and 1.2 trace correlation on the wire.

Scope

  • ICorrelationIdGenerator abstraction.
  • Default implementation (time + random/sequence based) supporting injected TimeProvider for deterministic tests.
  • CorrelationContext sample that takes the generator and sets CorrelationId = generator.Next().
  • Unit tests covering format, uniqueness, and TimeProvider-driven determinism.

Design Expectations

Acceptance Criteria

  • Generator is injectable and produces reasonably unique, transport-friendly ids.
  • Tests are deterministic when TimeProvider is substituted.
  • No coupling to serialization, HTTP, or the core runtime.

Non-Goals

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    coreCore contracts / primitivesenhancementNew feature or requesttraceabilityTracing, Activity, correlation, diagnostics

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions