Table of Contents

Public classSealed MeterMetricsCollector

Namespace
Rowles.LeanLucene.Diagnostics
Assembly
Rowles.LeanLucene.dll

IMetricsCollector backed by System.Diagnostics.Metrics.Meter. Instruments are published under the meter name Rowles.LeanLucene and can be consumed by any System.Diagnostics.Metrics.MeterListener — including OpenTelemetry OTLP exporters.

public sealed class MeterMetricsCollector : IMetricsCollector, IDisposable
MeterMetricsCollector
Implements

Remarks

Construct once and assign to both Metrics and Metrics so all operations share the same meter. Pass an System.Diagnostics.Metrics.IMeterFactory when using the Microsoft.Extensions.DependencyInjection hosting model; otherwise a standalone System.Diagnostics.Metrics.Meter is created automatically.

Public constructor MeterMetricsCollector(IMeterFactory?)

Initialises a MeterMetricsCollector using the provided System.Diagnostics.Metrics.IMeterFactory (for hosted / DI scenarios). If meterFactory is null a standalone System.Diagnostics.Metrics.Meter is created and owned by this instance.

Public method Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

Public method GetSnapshot()

Takes a point-in-time snapshot of all metrics.

Public method RecordCacheHit()

Records a query cache hit.

Public method RecordCacheMiss()

Records a query cache miss.

Public method RecordCommit(TimeSpan)

Records a commit event.

Public method RecordFlush(TimeSpan)

Records a segment flush event.

Public method RecordHnswBuild(TimeSpan, int)

Records a single HNSW graph build (flush or merge). nodes is the number of vectors inserted. Default implementation is a no-op for backwards compatibility.

Public method RecordHnswSearch(TimeSpan, int)

Records a single HNSW graph traversal. nodesVisited is the number of distinct nodes visited during the layer-zero search and is the primary recall-vs-cost signal. Default implementation is a no-op for backwards compatibility.

Public method RecordMerge(TimeSpan, int)

Records a segment merge event.

Public method RecordSearchLatency(TimeSpan)

Records a search latency sample.