LiteBus
CatalogTransport

Transport Metrics

  • ID: transport.metrics
  • Name: Transport metrics
  • Maturity: GA
  • Summary: Shared OpenTelemetry meter and observable circuit-breaker gauges for all transport adapters.

What It Does

TransportMetricsRegistration.RegisterIfNeeded installs one startup initializer (TransportObservableMetricsInitializer) and optional broker identity (TransportBrokerIdentity). The initializer creates TransportObservableMetrics, which exports aggregate publisher state from ITransportCircuitBreakerRegistry.

Applications subscribe with AddLiteBusTransportMetrics(). AMQP package keeps compatibility alias AddLiteBusAmqpMetrics() and points to the same shared meter.

Public Surface

APIRole
TransportMetricsRegistration.RegisterIfNeeded(IModuleConfiguration, string? broker)One-time registration of metrics hooks
TransportObservableMetricsInitializerStartup task that creates gauges
TransportObservableMetricsGauge producer bound to aggregate publisher breaker state
TransportBrokerIdentityBroker tag identity value
TransportMetricsRegisteredMarkerMarker to prevent duplicate registration
AddLiteBusTransportMetrics()OpenTelemetry meter registration extension
AddLiteBusAmqpMetrics()AMQP alias to shared meter
LiteBusTransportTelemetry constantsStable meter, instrument, and tag names

Packages

  • LiteBus.Transport
  • LiteBus.Transport.Extensions.OpenTelemetry
  • LiteBus.Transport.Amqp.Extensions.OpenTelemetry (alias)

Requires

  • transport.circuit-breaker
  • Host startup execution for IStartupTask

Invariants

  • Shared meter name is LiteBus.Transport.
  • Public gauge names remain stable on LiteBusTransportTelemetry.
  • Registration is idempotent per module configuration.

Non-Goals

  • Per-message publish and consume counters.
  • Prebuilt dashboard bundles.
  • Legacy AMQP-only meter names from pre-v6.

Observability

Shared Meter Contract

ConstantValue
LiteBusTransportTelemetry.MeterNameLiteBus.Transport
LiteBusTransportTelemetry.BrokerTagNamelitebus.transport.broker
LiteBusTransportTelemetry.CircuitBreakerOpenInstrumentNamelitebus.transport.circuit_breaker.open
LiteBusTransportTelemetry.CircuitBreakerFailureCountInstrumentNamelitebus.transport.circuit_breaker.failure_count

Observable Gauges

InstrumentSourceValue
litebus.transport.circuit_breaker.openITransportCircuitBreakerRegistry.IsAnyOpen1 when any publisher circuit is open or half-open; otherwise 0
litebus.transport.circuit_breaker.failure_countITransportCircuitBreakerRegistry.FailureCountsum of current failures across publisher circuits

Broker Tag Values

BrokerTag value
AMQPamqp
Kafkakafka
AWS SQSsqs
Azure Service Busazure_service_bus
In-memoryinmemory

OpenTelemetry Registration

ExtensionPackageEffect
AddLiteBusTransportMetrics()LiteBus.Transport.Extensions.OpenTelemetryAdds meter LiteBus.Transport
AddLiteBusAmqpMetrics()LiteBus.Transport.Amqp.Extensions.OpenTelemetryAdds the same meter

Test Coverage

Covered

Test methodProject
RecordFailure_until_threshold_ShouldOpenCircuitAndExposeFailureCountLiteBus.Transport.UnitTests (Amqp/)
RecordSuccess_after_failures_ShouldCloseCircuitLiteBus.Transport.UnitTests (Amqp/)
ObservableGauges_ShouldReportBreakerStateAndStopAfterDisposalLiteBus.Transport.UnitTests
ProcessPendingAsync_WhenCircuitBreakerOpen_ShouldNotPublishLiteBus.Durable.IntegrationTests (Dispatch/Outbox/Kafka/, Dispatch/Outbox/AwsSqs/)

Untested

  • Assertions for startup task registration and execution in host composition tests.
  • Assertions for OpenTelemetry meter provider subscription (AddLiteBusTransportMetrics, AddLiteBusAmqpMetrics).
  • Broker-tagged gauge export assertions.

Out-of-Scope

  • Transport-level throughput and latency histograms.
  • Bundled exporter configurations.

Deep Docs

On this page