Class ElasticsearchMetrics
- Namespace
- Excalibur.Data.ElasticSearch.Monitoring
- Assembly
- Excalibur.Data.ElasticSearch.dll
Provides comprehensive metrics collection for Elasticsearch operations including performance, resilience, and health indicators.
public sealed class ElasticsearchMetrics : IDisposable
- Inheritance
-
ElasticsearchMetrics
- Implements
- Inherited Members
Constructors
ElasticsearchMetrics(string, string?, double[]?)
Initializes a new instance of the ElasticsearchMetrics class.
public ElasticsearchMetrics(string meterName = "Excalibur.Data.ElasticSearch", string? version = null, double[]? durationHistogramBuckets = null)
Parameters
meterNamestringThe name of the meter for metrics collection.
versionstringThe version of the meter.
durationHistogramBucketsdouble[]The histogram buckets for duration measurements.
Methods
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public void Dispose()
RecordCircuitBreakerStateChange(string, string, string?)
Records a circuit breaker state change.
public void RecordCircuitBreakerStateChange(string fromState, string toState, string? operationType = null)
Parameters
fromStatestringThe previous circuit breaker state.
toStatestringThe new circuit breaker state.
operationTypestringThe operation type that triggered the state change.
RecordPermanentFailure(string, string, string?)
Records an operation that failed permanently after exhausting all resilience mechanisms.
public void RecordPermanentFailure(string operationType, string errorType, string? indexName = null)
Parameters
operationTypestringThe type of operation that failed permanently.
errorTypestringThe type of error that caused the failure.
indexNamestringThe name of the index being operated on.
RecordRetryAttempt(string, int, string?)
Records a retry attempt for an operation.
public void RecordRetryAttempt(string operationType, int attemptNumber, string? indexName = null)
Parameters
operationTypestringThe type of operation being retried.
attemptNumberintThe retry attempt number.
indexNamestringThe name of the index being operated on.
StartOperation(string, string?)
Records the start of an Elasticsearch operation.
public ElasticsearchMetrics.ElasticsearchOperationContext StartOperation(string operationType, string? indexName = null)
Parameters
operationTypestringThe type of operation (e.g., "search", "index", "delete").
indexNamestringThe name of the index being operated on.
Returns
- ElasticsearchMetrics.ElasticsearchOperationContext
An operation context for tracking the operation lifecycle.
UpdateHealthStatus(bool, string?)
Updates the cluster health status.
public void UpdateHealthStatus(bool isHealthy, string? healthStatus = null)