Table of Contents

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

meterName string

The name of the meter for metrics collection.

version string

The version of the meter.

durationHistogramBuckets double[]

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

fromState string

The previous circuit breaker state.

toState string

The new circuit breaker state.

operationType string

The 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

operationType string

The type of operation that failed permanently.

errorType string

The type of error that caused the failure.

indexName string

The 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

operationType string

The type of operation being retried.

attemptNumber int

The retry attempt number.

indexName string

The 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

operationType string

The type of operation (e.g., "search", "index", "delete").

indexName string

The 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)

Parameters

isHealthy bool

Whether the cluster is currently healthy.

healthStatus string

The detailed health status from Elasticsearch.