Skip to main content

Metrics Reference

Complete catalog of all OpenTelemetry metrics exposed by Excalibur framework components.

Before You Start

  • .NET 8.0+ (or .NET 9/10 for latest features)
  • Install the required packages:
    dotnet add package Excalibur.Dispatch.Observability
    dotnet add package OpenTelemetry.Extensions.Hosting
  • Familiarity with OpenTelemetry and health checks

Quick Start

Enable metrics collection with OpenTelemetry:

builder.Services.AddOpenTelemetry()
.WithMetrics(metrics =>
{
// Core Dispatch metrics
metrics.AddMeter("Excalibur.Dispatch.*");

// Data layer metrics
metrics.AddMeter("Excalibur.Data.*");

// Event sourcing metrics
metrics.AddMeter("Excalibur.EventSourcing.*");
});

Naming Convention

All meters follow the pattern: Excalibur.{Namespace}.{Component}

PrefixDescription
Excalibur.Dispatch.*Core messaging, transport, and pipeline metrics
Excalibur.Data.*Data access and persistence metrics
Excalibur.EventSourcing.*Event store and snapshot metrics

Core Metrics

Excalibur.Dispatch.Core

Core message dispatching metrics.

MetricTypeUnitDescription
dispatch.messages.processedCountercountTotal number of messages processed
dispatch.messages.publishedCountercountTotal number of messages published
dispatch.messages.failedCountercountTotal number of messages that failed
dispatch.messages.durationHistogrammsMessage processing duration
dispatch.sessions.activeGaugecountNumber of active sessions

Tags: message_type, handler, result


Excalibur.Dispatch.CircuitBreaker

Circuit breaker state and operations.

MetricTypeUnitDescription
dispatch.circuitbreaker.state_changesCountercountCircuit breaker state transitions
dispatch.circuitbreaker.rejectionsCountercountRequests rejected due to open circuit
dispatch.circuitbreaker.failuresCountercountFailed requests tracked by circuit
dispatch.circuitbreaker.successesCountercountSuccessful requests tracked by circuit
dispatch.circuitbreaker.stateObservableGaugestateCurrent circuit state (0=Closed, 1=Open, 2=HalfOpen)

Tags: circuit_name, state


Excalibur.Dispatch.DeadLetterQueue

Dead letter queue operations.

MetricTypeUnitDescription
dispatch.dlq.enqueuedCountercountMessages added to dead letter queue
dispatch.dlq.replayedCountercountMessages replayed from dead letter queue
dispatch.dlq.purgedCountercountMessages purged from dead letter queue
dispatch.dlq.depthObservableGaugemessagesCurrent dead letter queue depth

Tags: reason, message_type


Excalibur.Dispatch.Sagas

Saga orchestration metrics.

MetricTypeUnitDescription
dispatch.saga.started_totalCountersagasSagas initiated
dispatch.saga.completed_totalCountersagasSagas completed successfully
dispatch.saga.failed_totalCountersagasSagas that failed
dispatch.saga.compensated_totalCountersagasSagas that triggered compensation
dispatch.saga.duration_msHistogrammsTotal saga execution duration
dispatch.saga.handler_duration_msHistogrammsIndividual handler execution duration
dispatch.saga.activeObservableGaugesagasCurrently active sagas

Tags: saga_type, state, handler


Excalibur.Dispatch.BackgroundServices

Background processor metrics (outbox, inbox, CDC).

MetricTypeUnitDescription
excalibur.background_service.processing_cyclesCountercyclesProcessing cycles executed
excalibur.background_service.messages_processedCountermessagesMessages processed
excalibur.background_service.messages_failedCountermessagesMessages that failed processing
excalibur.background_service.processing_durationHistogrammsProcessing cycle duration
excalibur.background_service.processing_errorsCountererrorsProcessing cycle errors

Tags: service_type (outbox, inbox, cdc), operation


Transport Metrics

Excalibur.Dispatch.Transport

Common transport layer metrics (all transports).

MetricTypeUnitDescription
dispatch.transport.messages.sentCountercountMessages sent
dispatch.transport.messages.send_failedCountercountMessage send failures
dispatch.transport.messages.receivedCountercountMessages received
dispatch.transport.messages.acknowledgedCountercountMessages acknowledged
dispatch.transport.messages.rejectedCountercountMessages rejected
dispatch.transport.messages.dead_letteredCountercountMessages routed to dead letter queue
dispatch.transport.messages.requeuedCountercountMessages requeued for redelivery
dispatch.transport.send.durationHistogrammsSend operation duration
dispatch.transport.receive.durationHistogrammsReceive operation duration
dispatch.transport.batch.sizeHistogramcountBatch sizes
dispatch.transport.handler.errorsCountercountHandler errors during subscriber processing
dispatch.transport.handler.durationHistogrammsSubscriber handler invocation duration

Tags: transport, endpoint, result


Excalibur.Dispatch.Transport.GooglePubSub

Google Cloud Pub/Sub specific metrics.

MetricTypeUnitDescription
pubsub.messages.enqueuedCountermessagesMessages enqueued for processing
pubsub.messages.dequeuedCountermessagesMessages dequeued
pubsub.messages.processedCountermessagesMessages successfully processed
pubsub.messages.failedCountermessagesMessages that failed processing
pubsub.messages.publishedCountercountMessages published
pubsub.messages.acknowledgedCountercountMessages acknowledged
pubsub.messages.nackedCountercountMessages negatively acknowledged
pubsub.batches.createdCounterbatchesBatches created
pubsub.batches.completedCounterbatchesBatches completed
pubsub.connections.createdCounterconnectionsConnections created
pubsub.connections.closedCounterconnectionsConnections closed
pubsub.message.queue_timeHistogrammsTime messages spend in queue
pubsub.message.processing_timeHistogrammsMessage processing time
pubsub.batch.sizeHistogrammessagesBatch sizes
pubsub.batch.durationHistogrammsBatch processing duration
pubsub.flow_control.permitsObservableGaugepermitsAvailable flow control permits
pubsub.flow_control.bytesObservableGaugebytesAvailable flow control bytes

Tags: subscription, topic, result


Azure Storage Queues

Azure Storage Queue metrics (part of Azure Service Bus transport).

MetricTypeUnitDescription
azurequeue.messages.processedCountercountMessages processed
azurequeue.processing.durationHistogrammsProcessing duration
azurequeue.batches.processedCountercountBatches processed
azurequeue.batch.sizeHistogramcountBatch sizes
azurequeue.receive.operationsCountercountReceive operations
azurequeue.receive.durationHistogrammsReceive duration
azurequeue.delete.operationsCountercountDelete operations
azurequeue.visibility.updatesCountercountVisibility timeout updates
azurequeue.queue.depthGaugecountCurrent queue depth

Tags: queue_name, result


Data Layer Metrics

Excalibur.Data.Persistence

Generic data persistence metrics.

MetricTypeUnitDescription
persistence.queriesCountercountQueries executed
persistence.commandsCountercountCommands executed
persistence.errorsCountercountPersistence errors
persistence.rows_affectedCountercountRows affected by operations
persistence.cache.hitsCountercountCache hits
persistence.cache.missesCountercountCache misses
persistence.query.durationHistogrammsQuery execution duration
persistence.transaction.durationHistogrammsTransaction duration
persistence.connections.activeObservableGaugecountActive connections
persistence.connections.idleObservableGaugecountIdle connections

Tags: operation, entity, result


Excalibur.Data.SqlServer.Persistence

SQL Server specific persistence metrics.

MetricTypeUnitDescription
sqlserver.connections.createdCountercountConnections created
sqlserver.queries.executedCountercountQueries executed
sqlserver.commands.executedCountercountCommands executed
sqlserver.transactions.startedCountercountTransactions started
sqlserver.transactions.committedCountercountTransactions committed
sqlserver.transactions.rolledbackCountercountTransactions rolled back
sqlserver.retriesCountercountRetry operations
sqlserver.errorsCountercountError count
sqlserver.deadlocksCountercountDeadlock count
sqlserver.query.durationHistogrammsQuery duration
sqlserver.command.durationHistogrammsCommand duration
sqlserver.transaction.durationHistogrammsTransaction duration
sqlserver.connection.waitHistogrammsConnection wait time
sqlserver.batch.sizeHistogramcountBatch sizes
sqlserver.connections.activeObservableGaugecountActive connections
sqlserver.transactions.activeObservableGaugecountActive transactions
sqlserver.cdc.events.processedCountercountCDC events processed
sqlserver.cdc.processing.durationHistogrammsCDC processing duration
sqlserver.cdc.lagObservableGaugesecondsCDC lag
sqlserver.cache.hitsCountercountCache hits
sqlserver.cache.missesCountercountCache misses
sqlserver.cache.hit_ratioObservableGaugeratioCache hit ratio

Tags: database, operation, result


Excalibur.Data.Postgres.Persistence

PostgreSQL specific persistence metrics.

MetricTypeUnitDescription
postgres.queries.totalCountercountTotal queries
postgres.commands.totalCountercountTotal commands
postgres.transactions.totalCountercountTotal transactions
postgres.queries.failedCountercountFailed queries
postgres.commands.failedCountercountFailed commands
postgres.transactions.failedCountercountFailed transactions
postgres.connection.errorsCountercountConnection errors
postgres.timeoutsCountercountTimeout count
postgres.deadlocksCountercountDeadlock count
postgres.cache.hitsCountercountCache hits
postgres.cache.missesCountercountCache misses
postgres.query.durationHistogrammsQuery duration
postgres.command.durationHistogrammsCommand duration
postgres.transaction.durationHistogrammsTransaction duration
postgres.connection.acquisitionHistogrammsConnection acquisition time
postgres.connections.activeObservableGaugecountActive connections
postgres.connections.idleObservableGaugecountIdle connections
postgres.pool.sizeObservableGaugecountPool size
postgres.pool.utilizationObservableGaugeratioPool utilization
postgres.prepared_statementsObservableGaugecountPrepared statement count

Tags: database, operation, result


Excalibur.Data.Postgres.Outbox

PostgreSQL outbox store metrics.

MetricTypeUnitDescription
postgres.outbox.save.durationHistogrammsSave messages duration
postgres.outbox.reserve.durationHistogrammsReserve messages duration
postgres.outbox.unreserve.durationHistogrammsUnreserve messages duration
postgres.outbox.delete.durationHistogrammsDelete record duration
postgres.outbox.increase_attempts.durationHistogrammsIncrease attempts duration
postgres.outbox.move_to_dlq.durationHistogrammsMove to DLQ duration
postgres.outbox.batch_delete.durationHistogrammsBatch delete duration
postgres.outbox.batch_increase_attempts.durationHistogrammsBatch increase attempts duration
postgres.outbox.batch_move_to_dlq.durationHistogrammsBatch move to DLQ duration
postgres.outbox.messages.processedCountercountMessages processed
postgres.outbox.operations.completedCountercountOperations completed

Tags: operation, result


Compliance Metrics

Excalibur.Dispatch.Compliance

Security and compliance metrics.

MetricTypeUnitDescription
dispatch.compliance.key_rotationsCountercountKey rotations performed
dispatch.compliance.key_rotation_failuresCountercountKey rotation failures
dispatch.compliance.encryption_latencyHistogrammsEncryption operation latency
dispatch.compliance.encryption_operationsCountercountEncryption operations
dispatch.compliance.encryption_bytes_processedCounterbytesBytes encrypted/decrypted
dispatch.compliance.audit_events_loggedCountercountAudit events logged
dispatch.compliance.audit_integrity_checksCountercountIntegrity checks performed
dispatch.compliance.audit_integrity_violationsCountercountIntegrity violations detected
dispatch.compliance.audit_integrity_check_durationHistogrammsIntegrity check duration
dispatch.compliance.key_usage_operationsCountercountKey usage operations

Tags: key_id, algorithm, result


Caching Metrics

Excalibur.Dispatch.Caching

Caching middleware metrics.

MetricTypeUnitDescription
dispatch.cache.hitsCountercountCache hits
dispatch.cache.missesCountercountCache misses
dispatch.cache.timeoutsCountercountCache operation timeouts
dispatch.cache.durationHistogrammsCache operation latency

Tags: cache_name, operation, result


Context Flow Metrics

Excalibur.Dispatch.Observability.Context

Message context flow and preservation metrics.

MetricTypeUnitDescription
dispatch.context.flow.snapshotsCountercountContext snapshots taken
dispatch.context.flow.mutationsCountercountContext mutations
dispatch.context.flow.errorsCountercountContext errors
dispatch.context.flow.validation_failuresCountercountValidation failures
dispatch.context.flow.cross_boundary_transitionsCountercountCross-boundary transitions
dispatch.context.flow.preservation_successCountercountSuccessful context preservation
dispatch.context.flow.field_lossCountercountContext field loss events
dispatch.context.flow.size_threshold_exceededCountercountSize threshold exceeded
dispatch.context.flow.size_bytesHistogrambytesContext size distribution
dispatch.context.flow.field_countHistogramcountField count distribution
dispatch.context.flow.stage_latency_msHistogrammsPipeline stage latency
dispatch.context.flow.serialization_latency_msHistogrammsSerialization latency
dispatch.context.flow.deserialization_latency_msHistogrammsDeserialization latency
dispatch.context.flow.active_contextsObservableGaugecountActive contexts
dispatch.context.flow.preservation_rateObservableGaugeratioContext preservation rate
dispatch.context.flow.lineage_depthObservableGaugecountLineage depth

Tags: stage, boundary_type, result


Prometheus Query Examples

Message Throughput

# Messages processed per second
rate(dispatch_messages_processed_total[5m])

# Error rate
rate(dispatch_messages_failed_total[5m]) / rate(dispatch_messages_processed_total[5m])

Latency Percentiles

# P99 message processing latency
histogram_quantile(0.99, sum(rate(dispatch_messages_duration_bucket[5m])) by (le))

# P50 (median) processing latency
histogram_quantile(0.50, sum(rate(dispatch_messages_duration_bucket[5m])) by (le))

Circuit Breaker Health

# Circuit breaker state (0=Closed/Healthy, 1=Open, 2=HalfOpen)
dispatch_circuitbreaker_state

# Circuit breaker rejection rate
rate(dispatch_circuitbreaker_rejections_total[5m])

Database Performance

# Average query duration
rate(sqlserver_query_duration_sum[5m]) / rate(sqlserver_query_duration_count[5m])

# Connection pool utilization
postgres_pool_utilization

Grafana Dashboard Templates

Pre-built Grafana dashboards are available in the grafana-dashboards documentation.

Key Dashboards

DashboardDescription
Dispatch OverviewMessage throughput, latency, error rates
Transport HealthPer-transport metrics and connection status
Circuit BreakersCircuit states across all breakers
Database PerformanceQuery latency, connection pools, deadlocks
Compliance MonitoringEncryption operations, key rotation, audit trail

See Also

  • Production Observability — Operational best practices for monitoring Dispatch in production environments
  • Health Checks — Application health monitoring with built-in and custom health check endpoints
  • Grafana Dashboards — Pre-built Grafana dashboard templates for visualizing Dispatch metrics