Record Class StorageObjectMetrics

java.lang.Object
java.lang.Record
org.elasticsearch.xpack.esql.datasources.spi.StorageObjectMetrics
Record Components:
requestCount - number of read requests issued against the underlying store (including retries)
requestNanos - cumulative wall time spent opening read streams against the store (best-effort: providers measure between calling the SDK's getObject/reader/openInputStream and the stream being returned; the time spent draining bytes off the network after the stream is returned is not currently captured)
bytesRead - planned read bytes against the underlying store, before any decompression (best-effort: providers record the requested range length or the response Content-Length at stream-open time, not the bytes actually drained — close enough for a per-query I/O budget, not for measuring end-of-stream truncation)
retryCount - number of automatic retries triggered by the underlying client. Only tracked at the RetryableStorageObject decorator boundary today; SDK-internal retry counts (AWS / GCS / Azure) are not yet wired
All Implemented Interfaces:
Writeable, ToXContent, ToXContentObject

public record StorageObjectMetrics(long requestCount, long requestNanos, long bytesRead, long retryCount) extends Record implements Writeable, ToXContentObject
Immutable snapshot of cumulative I/O counters for a StorageObject instance.

Counters are produced live by a StorageObjectMetricsCounters held by each provider implementation and snapshotted via StorageObject.metrics() when the format reader needs to surface I/O numbers in the ES|QL query profile. Snapshots are immutable values so they ride the wire alongside operator status without additional synchronisation.

The split (mutable counter struct vs. immutable snapshot record) mirrors the BlobStoreActionStats / GCS Collector pattern used by repository plugins.

  • Field Details

  • Constructor Details

    • StorageObjectMetrics

      public StorageObjectMetrics(long requestCount, long requestNanos, long bytesRead, long retryCount)
      Creates an instance of a StorageObjectMetrics record class.
      Parameters:
      requestCount - the value for the requestCount record component
      requestNanos - the value for the requestNanos record component
      bytesRead - the value for the bytesRead record component
      retryCount - the value for the retryCount record component
    • StorageObjectMetrics

      public StorageObjectMetrics(StreamInput in) throws IOException
      Throws:
      IOException
  • Method Details

    • writeTo

      public void writeTo(StreamOutput out) throws IOException
      Specified by:
      writeTo in interface Writeable
      Throws:
      IOException
    • add

      Returns the element-wise sum of this and other. Overflow wraps silently — these are metrics counters, not invariants; a wrapped value is preferable to throwing through the producer's metrics() call chain. Reaching Long.MAX_VALUE on any field (~9.2 * 10^18) is implausible in practice (each counter would need a corresponding number of requests / nanoseconds / bytes / retries on a single object).
    • isZero

      public boolean isZero()
    • toXContent

      public XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params params) throws IOException
      Specified by:
      toXContent in interface ToXContent
      Throws:
      IOException
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • requestCount

      public long requestCount()
      Returns the value of the requestCount record component.
      Returns:
      the value of the requestCount record component
    • requestNanos

      public long requestNanos()
      Returns the value of the requestNanos record component.
      Returns:
      the value of the requestNanos record component
    • bytesRead

      public long bytesRead()
      Returns the value of the bytesRead record component.
      Returns:
      the value of the bytesRead record component
    • retryCount

      public long retryCount()
      Returns the value of the retryCount record component.
      Returns:
      the value of the retryCount record component