LiteBus
CatalogStorage

Diagnostics Store Role

  • ID: storage.role.diagnostics
  • Name: Diagnostics store role
  • Maturity: GA
  • Summary: Status counts and schema metadata for operators, health probes, and queue depth metrics.

What It Does

IInboxDiagnosticsStore and IOutboxDiagnosticsStore expose GetStatusCountsAsync and GetSchemaInfoAsync. Counts feed OpenTelemetry observable gauges (litebus.inbox.queue.depth, litebus.outbox.queue.depth) tagged by status. Schema info reports table schema version, store technology, and configured object names for management endpoints and operator tooling.

Public Surface

Consumer Contracts

TypeRole
IInboxDiagnosticsStoreInbox status counts and schema metadata
IOutboxDiagnosticsStoreOutbox status counts and schema metadata
InboxStatusCounts / OutboxStatusCountsPer-status row totals
Schema info DTOsVersion, technology, object names

Invocation

MethodTypical caller
GetStatusCountsAsyncOpenTelemetry observable gauge callbacks, managers
GetSchemaInfoAsyncIInboxManager / IOutboxManager, management HTTP endpoints

Registration

  • Operations composite on singleton store; OpenTelemetry packages register gauge observers that call diagnostics store at scrape time.

Configuration

Option surfacePurpose
Store optionsSchema and table names reflected in GetSchemaInfoAsync
OpenTelemetry host registrationAddLiteBusInboxMetrics() / AddLiteBusOutboxMetrics() required for gauges

Extension Points

  • Custom stores must return live counts (not indefinitely cached) and schema info matching configured object names.

Packages

PackageRole
LiteBus.Inbox.AbstractionsIInboxDiagnosticsStore
LiteBus.Outbox.AbstractionsIOutboxDiagnosticsStore
LiteBus.Inbox.Extensions.OpenTelemetryQueue depth gauges
LiteBus.Outbox.Extensions.OpenTelemetryQueue depth gauges

Requires

  • Operations composite store registered
  • For PostgreSQL schema probes: storage.postgresql.schema-management diagnostic checks (separate from counts)

Invariants

  • Status counts reflect store truth at query time (not cached indefinitely).
  • Schema info for PostgreSQL includes expected version 1 for greenfield v6.
  • InMemory stores report synthetic schema info suitable for tests.

Non-Goals

  • Does not explain per-message failure reasons (query role + management APIs).
  • Does not replace PostgreSQL ValidateAsync drift detection.
  • Does not emit broker connectivity diagnostics.

Observability

MeterInstrumentTypeWhen observedTagsStorage coupling
LiteBus.Inboxlitebus.inbox.queue.depthObservable gaugeEach OpenTelemetry scrapelitebus.inbox.status (pending, processing, failed, completed, dead_lettered)GetStatusCountsAsync on inbox diagnostics store
LiteBus.Outboxlitebus.outbox.queue.depthObservable gaugeEach OpenTelemetry scrapelitebus.outbox.status (pending, publishing, failed, published, dead_lettered)GetStatusCountsAsync on outbox diagnostics store
Probe / APISourcePurpose
inbox.postgresql.schema / outbox.postgresql.schemaIDiagnosticCheckSchema drift detection (PostgreSQL adapters)
Management GET schema infoGetSchemaInfoAsyncHuman-readable schema version and object names

Instrument names are public constants on LiteBusInboxTelemetry and LiteBusOutboxTelemetry; renames are breaking changes.

Deep Docs

Test Coverage

Covered

InboxStoreContractTests.GetStatusCountsAsync_ShouldGroupByStatus

  • Use case: Group inbox status counts by status
  • Test kind: Contract
  • Description: Store rows in multiple statuses then query counts
  • Behavior: GetStatusCountsAsync
  • Expected outcome: Counts match rows per status bucket
  • Remarks: LiteBus.Storage.Testing; inherited by all inbox backends

OutboxStoreContractTests.GetStatusCountsAsync_ShouldGroupByStatus

  • Use case: Group outbox status counts by status
  • Test kind: Contract
  • Description: Store rows in multiple statuses then query counts
  • Behavior: GetStatusCountsAsync
  • Expected outcome: Counts match rows per status bucket
  • Remarks: Inherited by PostgreSQL, EF, and InMemory outbox suites

InMemoryInboxGetAllFilterTests.GetAll_WithStatusAndContractName_ShouldFilterResults

  • Use case: Filter InMemory inbox diagnostics via GetAll
  • Test kind: Unit
  • Description: InMemory test helper filters by status and contract
  • Behavior: GetAll with status and contract name predicates
  • Expected outcome: Filtered subset returned
  • Remarks: LiteBus.Inbox.Storage.InMemory.UnitTests; test-only surface

InMemoryOutboxGetAllFilterTests.GetAll_WithStatusAndContractName_ShouldFilterResults

  • Use case: Filter InMemory outbox diagnostics via GetAll
  • Test kind: Unit
  • Description: InMemory test helper filters by status and contract
  • Behavior: GetAll with predicates
  • Expected outcome: Filtered subset returned
  • Remarks: LiteBus.Outbox.Storage.InMemory.UnitTests; test-only surface

Untested

  • Dedicated GetSchemaInfoAsync contract tests on each adapter (schema info exercised indirectly via management and PostgreSQL diagnostic checks).
  • OpenTelemetry queue depth gauge registration and scrape values (hosting axis OpenTelemetry packages).

Out-of-Scope

  • Per-message failure reason drill-down (query role and management APIs).
  • PostgreSQL ValidateAsync drift detection (schema-management capability).
  • Broker connectivity diagnostics.

On this page