Table of Contents

Class TransportMeter

Namespace
Excalibur.Dispatch.Transport
Assembly
Excalibur.Dispatch.Abstractions.dll

Provides OpenTelemetry-compatible metrics for transport adapter operations using System.Diagnostics.Metrics.

public static class TransportMeter
Inheritance
TransportMeter
Inherited Members

Remarks

This follows .NET best practices by using built-in APIs that OpenTelemetry can collect from, without requiring a direct dependency on OpenTelemetry.

Metric names follow the OpenTelemetry semantic conventions with the dispatch.transport prefix:

  • dispatch.transport.messages_sent_total - Counter of messages sent
  • dispatch.transport.messages_received_total - Counter of messages received
  • dispatch.transport.errors_total - Counter of transport errors
  • dispatch.transport.send.duration - Histogram of send operation durations
  • dispatch.transport.receive.duration - Histogram of receive operation durations
  • dispatch.transport.connection_status - Gauge of connection status (0=disconnected, 1=connected)

Fields

MeterName

The meter name for transport metrics.

public const string MeterName = "Excalibur.Dispatch.Transport"

Field Value

string

MeterVersion

The meter version.

public const string MeterVersion = "1.0.0"

Field Value

string

Methods

RecordError(string, string, string)

Records a transport error.

public static void RecordError(string transportName, string transportType, string errorType)

Parameters

transportName string

The name of the transport.

transportType string

The type of transport.

errorType string

The type of error (e.g., "timeout", "connection_failed", "serialization_error").

RecordMessageReceived(string, string, string?)

Records that a message was received through a transport.

public static void RecordMessageReceived(string transportName, string transportType, string? messageType = null)

Parameters

transportName string

The name of the transport.

transportType string

The type of transport.

messageType string

Optional message type.

RecordMessageSent(string, string, string?)

Records that a message was sent through a transport.

public static void RecordMessageSent(string transportName, string transportType, string? messageType = null)

Parameters

transportName string

The name of the transport.

transportType string

The type of transport.

messageType string

Optional message type.

RecordReceiveDuration(string, string, double)

Records the duration of a receive operation.

public static void RecordReceiveDuration(string transportName, string transportType, double durationMs)

Parameters

transportName string

The name of the transport.

transportType string

The type of transport.

durationMs double

Duration in milliseconds.

RecordSendDuration(string, string, double)

Records the duration of a send operation.

public static void RecordSendDuration(string transportName, string transportType, double durationMs)

Parameters

transportName string

The name of the transport.

transportType string

The type of transport.

durationMs double

Duration in milliseconds.

RecordTransportStarted(string, string)

Records that a transport was started.

public static void RecordTransportStarted(string transportName, string transportType)

Parameters

transportName string

The name of the transport.

transportType string

The type of transport.

RecordTransportStopped(string, string)

Records that a transport was stopped.

public static void RecordTransportStopped(string transportName, string transportType)

Parameters

transportName string

The name of the transport.

transportType string

The type of transport.

RemoveTransport(string)

Removes a transport from metric tracking.

public static void RemoveTransport(string transportName)

Parameters

transportName string

The name of the transport to remove.

UpdateTransportState(string, string, bool, long)

Updates the current state metrics for a transport.

public static void UpdateTransportState(string transportName, string transportType, bool isConnected, long pendingMessages = 0)

Parameters

transportName string

The name of the transport.

transportType string

The type of transport.

isConnected bool

Whether the transport is connected.

pendingMessages long

Number of pending messages.