Record Class RepositoriesMetrics

java.lang.Object
java.lang.Record
org.elasticsearch.repositories.RepositoriesMetrics

public record RepositoriesMetrics(MeterRegistry meterRegistry, LongCounter requestCounter, LongCounter exceptionCounter, LongCounter requestRangeNotSatisfiedExceptionCounter, LongCounter throttleCounter, LongCounter operationCounter, LongCounter unsuccessfulOperationCounter, LongHistogram exceptionHistogram, LongHistogram throttleHistogram, LongHistogram httpRequestTimeInMillisHistogram) extends Record
The common set of metrics that we publish for BlobStoreRepository implementations.
  • Field Details

    • NOOP

      public static final RepositoriesMetrics NOOP
    • METRIC_REQUESTS_TOTAL

      public static final String METRIC_REQUESTS_TOTAL
      Is incremented for each request sent to the blob store (including retries) Exposed as requestCounter()
      See Also:
    • METRIC_EXCEPTIONS_TOTAL

      public static final String METRIC_EXCEPTIONS_TOTAL
      Is incremented for each request which returns a non 2xx response OR fails to return a response (includes throttling and retryable errors) Exposed as exceptionCounter()
      See Also:
    • METRIC_EXCEPTIONS_REQUEST_RANGE_NOT_SATISFIED_TOTAL

      public static final String METRIC_EXCEPTIONS_REQUEST_RANGE_NOT_SATISFIED_TOTAL
      Is incremented each time an operation ends with a 416 response Exposed as requestRangeNotSatisfiedExceptionCounter()
      See Also:
    • METRIC_THROTTLES_TOTAL

      public static final String METRIC_THROTTLES_TOTAL
      Is incremented each time we are throttled by the blob store, e.g. upon receiving an HTTP 429 response Exposed as throttleCounter()
      See Also:
    • METRIC_OPERATIONS_TOTAL

      public static final String METRIC_OPERATIONS_TOTAL
      Is incremented for each operation we attempt, whether it succeeds or fails, this doesn't include retries Exposed via operationCounter()
      See Also:
    • METRIC_UNSUCCESSFUL_OPERATIONS_TOTAL

      public static final String METRIC_UNSUCCESSFUL_OPERATIONS_TOTAL
      Is incremented for each operation that ends with a non 2xx response or throws an exception Exposed via unsuccessfulOperationCounter()
      See Also:
    • METRIC_EXCEPTIONS_HISTOGRAM

      public static final String METRIC_EXCEPTIONS_HISTOGRAM
      Each time an operation has one or more failed requests (from non 2xx response or exception), the count of those is sampled Exposed via exceptionHistogram()
      See Also:
    • METRIC_THROTTLES_HISTOGRAM

      public static final String METRIC_THROTTLES_HISTOGRAM
      Each time an operation has one or more throttled requests, the count of those is sampled Exposed via throttleHistogram()
      See Also:
    • HTTP_REQUEST_TIME_IN_MILLIS_HISTOGRAM

      public static final String HTTP_REQUEST_TIME_IN_MILLIS_HISTOGRAM
      Every operation that is attempted will record a time. The value recorded here is the sum of the duration of each of the requests executed to try and complete the operation. The duration of each request is the time between sending the request and either a response being received, or the request failing. Does not include the consumption of the body of the response or any time spent pausing between retries. Exposed via httpRequestTimeInMillisHistogram()
      See Also:
  • Constructor Details

    • RepositoriesMetrics

      public RepositoriesMetrics(MeterRegistry meterRegistry)
    • RepositoriesMetrics

      public RepositoriesMetrics(MeterRegistry meterRegistry, LongCounter requestCounter, LongCounter exceptionCounter, LongCounter requestRangeNotSatisfiedExceptionCounter, LongCounter throttleCounter, LongCounter operationCounter, LongCounter unsuccessfulOperationCounter, LongHistogram exceptionHistogram, LongHistogram throttleHistogram, LongHistogram httpRequestTimeInMillisHistogram)
      Creates an instance of a RepositoriesMetrics record class.
      Parameters:
      meterRegistry - the value for the meterRegistry record component
      requestCounter - the value for the requestCounter record component
      exceptionCounter - the value for the exceptionCounter record component
      requestRangeNotSatisfiedExceptionCounter - the value for the requestRangeNotSatisfiedExceptionCounter record component
      throttleCounter - the value for the throttleCounter record component
      operationCounter - the value for the operationCounter record component
      unsuccessfulOperationCounter - the value for the unsuccessfulOperationCounter record component
      exceptionHistogram - the value for the exceptionHistogram record component
      throttleHistogram - the value for the throttleHistogram record component
      httpRequestTimeInMillisHistogram - the value for the httpRequestTimeInMillisHistogram record component
  • Method Details

    • createAttributesMap

      public static Map<String,Object> createAttributesMap(RepositoryMetadata repositoryMetadata, OperationPurpose purpose, String operation)
      Create the map of attributes we expect to see on repository metrics
    • 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 Objects::equals(Object,Object).
      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.
    • meterRegistry

      public MeterRegistry meterRegistry()
      Returns the value of the meterRegistry record component.
      Returns:
      the value of the meterRegistry record component
    • requestCounter

      public LongCounter requestCounter()
      Returns the value of the requestCounter record component.
      Returns:
      the value of the requestCounter record component
    • exceptionCounter

      public LongCounter exceptionCounter()
      Returns the value of the exceptionCounter record component.
      Returns:
      the value of the exceptionCounter record component
    • requestRangeNotSatisfiedExceptionCounter

      public LongCounter requestRangeNotSatisfiedExceptionCounter()
      Returns the value of the requestRangeNotSatisfiedExceptionCounter record component.
      Returns:
      the value of the requestRangeNotSatisfiedExceptionCounter record component
    • throttleCounter

      public LongCounter throttleCounter()
      Returns the value of the throttleCounter record component.
      Returns:
      the value of the throttleCounter record component
    • operationCounter

      public LongCounter operationCounter()
      Returns the value of the operationCounter record component.
      Returns:
      the value of the operationCounter record component
    • unsuccessfulOperationCounter

      public LongCounter unsuccessfulOperationCounter()
      Returns the value of the unsuccessfulOperationCounter record component.
      Returns:
      the value of the unsuccessfulOperationCounter record component
    • exceptionHistogram

      public LongHistogram exceptionHistogram()
      Returns the value of the exceptionHistogram record component.
      Returns:
      the value of the exceptionHistogram record component
    • throttleHistogram

      public LongHistogram throttleHistogram()
      Returns the value of the throttleHistogram record component.
      Returns:
      the value of the throttleHistogram record component
    • httpRequestTimeInMillisHistogram

      public LongHistogram httpRequestTimeInMillisHistogram()
      Returns the value of the httpRequestTimeInMillisHistogram record component.
      Returns:
      the value of the httpRequestTimeInMillisHistogram record component