Class ContextFlowMetrics
- Namespace
- Excalibur.Dispatch.Observability.Context
- Assembly
- Excalibur.Dispatch.Observability.dll
Metrics collection component for context flow observability, tracking context field preservation rate, mutation frequency, size metrics, and cross-boundary success rate.
public sealed class ContextFlowMetrics : IContextFlowMetrics, IContextFlowCounterMetrics, IContextFlowHistogramMetrics, IContextFlowGaugeMetrics, IDisposable
- Inheritance
-
ContextFlowMetrics
- Implements
- Inherited Members
- Extension Methods
Constructors
ContextFlowMetrics(IOptions<ContextObservabilityOptions>)
Initializes a new instance of the ContextFlowMetrics class.
public ContextFlowMetrics(IOptions<ContextObservabilityOptions> options)
Parameters
optionsIOptions<ContextObservabilityOptions>Configuration options for context observability.
ContextFlowMetrics(IMeterFactory, IOptions<ContextObservabilityOptions>)
Initializes a new instance of the ContextFlowMetrics class using an IMeterFactory.
public ContextFlowMetrics(IMeterFactory meterFactory, IOptions<ContextObservabilityOptions> options)
Parameters
meterFactoryIMeterFactoryThe meter factory for DI-managed meter lifecycle.
optionsIOptions<ContextObservabilityOptions>Configuration options for context observability.
Methods
Dispose()
Disposes the metrics resources.
public void Dispose()
GetMetricsSummary()
Gets current metrics summary.
public ContextMetricsSummary GetMetricsSummary()
Returns
- ContextMetricsSummary
A summary of current metrics.
RecordContextError(string, string)
Records a context error event.
public void RecordContextError(string errorType, string stage)
Parameters
RecordContextMutation(ContextChangeType, string, string)
Records a context mutation event.
public void RecordContextMutation(ContextChangeType changeType, string fieldName, string stage)
Parameters
changeTypeContextChangeTypeType of change detected.
fieldNamestringName of the field that changed.
stagestringPipeline stage where the mutation occurred.
RecordContextPreservationSuccess(string)
Records successful context preservation.
public void RecordContextPreservationSuccess(string stage)
Parameters
stagestringThe pipeline stage.
RecordContextSize(string, int)
Records context size metrics.
public void RecordContextSize(string stage, int sizeBytes)
Parameters
RecordContextSizeThresholdExceeded(string, int)
Records when context size exceeds threshold.
public void RecordContextSizeThresholdExceeded(string stage, int sizeBytes)
Parameters
RecordContextSnapshot(string, int, int)
Records a context snapshot event.
public void RecordContextSnapshot(string stage, int fieldCount, int sizeBytes)
Parameters
stagestringThe pipeline stage where the snapshot was taken.
fieldCountintNumber of fields in the context.
sizeBytesintSize of the context in bytes.
RecordContextValidationFailure(string)
Records a context validation failure.
public void RecordContextValidationFailure(string failureReason)
Parameters
failureReasonstringReason for the validation failure.
RecordCrossBoundaryTransition(string, bool)
Records a cross-boundary transition event.
public void RecordCrossBoundaryTransition(string serviceBoundary, bool contextPreserved)
Parameters
serviceBoundarystringThe service boundary identifier.
contextPreservedboolWhether context was preserved across the boundary.
RecordDeserializationLatency(string, long)
Records context deserialization latency.
public void RecordDeserializationLatency(string operationType, long latencyMs)
Parameters
RecordPipelineStageLatency(string, long)
Records pipeline stage latency.
public void RecordPipelineStageLatency(string stage, long latencyMs)
Parameters
RecordSerializationLatency(string, long)
Records context serialization latency.
public void RecordSerializationLatency(string operationType, long latencyMs)
Parameters
UpdateActiveContextCount(int)
Updates the count of active contexts.
public void UpdateActiveContextCount(int delta)
Parameters
deltaintChange in active context count (positive or negative).
UpdateLineageDepth(int)
Updates the maximum observed lineage depth.
public void UpdateLineageDepth(int depth)
Parameters
depthintThe observed lineage depth.