
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
- 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.
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.
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
GetSnapshot()
Takes a point-in-time snapshot of all metrics.
RecordCacheHit()
Records a query cache hit.
RecordCacheMiss()
Records a query cache miss.
RecordCommit(TimeSpan)
Records a commit event.
RecordFlush(TimeSpan)
Records a segment flush event.
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.
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.
RecordMerge(TimeSpan, int)
Records a segment merge event.
RecordSearchLatency(TimeSpan)
Records a search latency sample.