Class StorageObjectMetricsCounters
StorageObject instance, increment it around each
I/O call, and surface the latest values via snapshot() from
StorageObject.metrics().
The split between this mutable struct and the immutable StorageObjectMetrics
snapshot mirrors the Collector(LongAdder, LongAdder) / BlobStoreActionStats
pattern used by ES repository plugins (see GcsRepositoryStatsCollector).
LongAdder is preferred over AtomicLong because async SDK callbacks
may concurrently increment from multiple threads and contention on a single AtomicLong
would dominate hot paths in object-store reads.
In addition to the profile snapshot, the same request/retry events are published to the node
ExternalSourceMetrics once a StorageObjectMetricsCounters.Sink is attached (the operator wiring
does this when it opens a storage object). Until then the sink is StorageObjectMetricsCounters.Sink.NONE and the publishing
path is skipped entirely, so the profile-only behaviour is unchanged and allocation-free.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddError()Records one object-store read that exhausted retries and gave up terminally.voidaddReadStall(long millis) Records the cumulative time an object-store read spent in retry backoff.voidaddRequest(long durationNanos, long bytes) Records one completed request with its duration and the bytes returned.voidaddRetry()Records one automatic retry triggered inside an in-flight request.voidRecords one retry for the per-query profile snapshot only — bumpsretryCountbut does not publish to the nodeExternalSourceMetricssink.voidRecords one object-store read whose terminal failure was a provider throttling response.voidattach(ExternalSourceMetrics metrics, String scheme) Attaches the node telemetry sink and the storageschemedimension, so subsequent request/retry events are published toExternalSourceMetricsas well as the profile snapshot.snapshot()Returns an immutable snapshot of the current counter values.
-
Constructor Details
-
StorageObjectMetricsCounters
public StorageObjectMetricsCounters()
-
-
Method Details
-
attach
Attaches the node telemetry sink and the storageschemedimension, so subsequent request/retry events are published toExternalSourceMetricsas well as the profile snapshot. Idempotent; safe to call again as the same object is reused across reads. -
addRequest
public void addRequest(long durationNanos, long bytes) Records one completed request with its duration and the bytes returned. -
addRetry
public void addRetry()Records one automatic retry triggered inside an in-flight request. -
addRetryProfileOnly
public void addRetryProfileOnly()Records one retry for the per-query profile snapshot only — bumpsretryCountbut does not publish to the nodeExternalSourceMetricssink. Used by metadata ops (length/lastModified/exists) onRetryableStorageObject: those ops never bump the read-scopedrequests.total, so publishing their retries to the registry would leakstorage.retries.totalpaststorage.requests.total(a scope violation on retryable providers). The read path usesaddRetry()so its retries reach the registry as before. -
addError
public void addError()Records one object-store read that exhausted retries and gave up terminally. Telemetry-only: it does not touch the profile snapshot (only request/retry/bytes counters surface there). No-op when no sink is attached; the record method self-guards so an instrumentation failure never breaks the read path. -
addThrottled
public void addThrottled()Records one object-store read whose terminal failure was a provider throttling response. Telemetry-only. -
addReadStall
public void addReadStall(long millis) Records the cumulative time an object-store read spent in retry backoff. Telemetry-only; skipped when the read never backed off (millis <= 0) so the histogram is not flooded with zero observations. -
snapshot
Returns an immutable snapshot of the current counter values.
-