Class OtelMetrics

java.lang.Object
org.apache.solr.crossdc.manager.consumer.OtelMetrics
All Implemented Interfaces:
ConsumerMetrics

public class OtelMetrics extends Object implements ConsumerMetrics
  • Field Details

    • REGISTRY

      public static final String REGISTRY
      See Also:
    • NAME_PREFIX

      public static final String NAME_PREFIX
      See Also:
    • ATTR_TYPE

      public static final String ATTR_TYPE
      See Also:
    • ATTR_SUBTYPE

      public static final String ATTR_SUBTYPE
      See Also:
    • ATTR_RESULT

      public static final String ATTR_RESULT
      See Also:
    • attributesCache

      protected final Map<String,io.opentelemetry.api.common.Attributes> attributesCache
    • metricManager

      protected SolrMetricManager metricManager
    • inputMsg

      protected io.opentelemetry.api.metrics.LongCounter inputMsg
    • inputReq

      protected io.opentelemetry.api.metrics.LongCounter inputReq
    • collapsed

      protected io.opentelemetry.api.metrics.LongCounter collapsed
    • output

      protected io.opentelemetry.api.metrics.LongCounter output
    • outputBatchSizeHistogram

      protected io.opentelemetry.api.metrics.LongHistogram outputBatchSizeHistogram
    • outputTimeHistogram

      protected io.opentelemetry.api.metrics.LongHistogram outputTimeHistogram
    • outputBackoffHistogram

      protected io.opentelemetry.api.metrics.LongHistogram outputBackoffHistogram
    • outputFirstAttemptHistogram

      protected io.opentelemetry.api.metrics.LongHistogram outputFirstAttemptHistogram
    • KEY_SEPARATOR

      protected static final String KEY_SEPARATOR
      See Also:
  • Constructor Details

    • OtelMetrics

      public OtelMetrics()
  • Method Details

    • register

      protected void register(String scope)
    • attr

      protected io.opentelemetry.api.common.Attributes attr(String key1, String value1)
    • attr

      protected io.opentelemetry.api.common.Attributes attr(String key1, String value1, String key2, String value2)
    • getMetricManager

      public SolrMetricManager getMetricManager()
    • incrementCollapsedCounter

      public void incrementCollapsedCounter()
      Description copied from interface: ConsumerMetrics
      Increments the counter for collapsed "add" requests.
      Specified by:
      incrementCollapsedCounter in interface ConsumerMetrics
    • incrementInputMsgCounter

      public void incrementInputMsgCounter(long delta)
      Description copied from interface: ConsumerMetrics
      Increments the counter for input messages.
      Specified by:
      incrementInputMsgCounter in interface ConsumerMetrics
      Parameters:
      delta - increase the counter by this value
    • incrementInputReqCounter

      public void incrementInputReqCounter(String type, String subType, int delta)
      Description copied from interface: ConsumerMetrics
      Increments the counter for input requests by type, subtype, and delta.
      Specified by:
      incrementInputReqCounter in interface ConsumerMetrics
      Parameters:
      type - request type, one of MirroredSolrRequest.Type values.
      subType - additional subtype: add, delete_by_id, delete_by_query, or action for other request types.
      delta - increase the counter by this value
    • incrementOutputCounter

      public void incrementOutputCounter(String type, String result, int delta)
      Description copied from interface: ConsumerMetrics
      Increments the counter for output requests by type, result, and delta.
      Specified by:
      incrementOutputCounter in interface ConsumerMetrics
      Parameters:
      type - the type of the request
      result - the result of the request, such as success or failure
      delta - the value by which the counter should be increased
    • recordOutputBatchSize

      public void recordOutputBatchSize(MirroredSolrRequest.Type type, org.apache.solr.client.solrj.SolrRequest<?> solrRequest)
      Description copied from interface: ConsumerMetrics
      Records the batch size of the output request. Batch size is defined as the number of operations in an output SolrRequest (which may be different from the input size due to collapsing).
      Specified by:
      recordOutputBatchSize in interface ConsumerMetrics
      Parameters:
      type - the type of the request, corresponding to one of the MirroredSolrRequest.getType() values
      solrRequest - SolrRequest object for which the batch size is being recorded
    • recordOutputBackoffTime

      public void recordOutputBackoffTime(MirroredSolrRequest.Type type, long backoffTimeMs)
      Description copied from interface: ConsumerMetrics
      Records the backoff time for output requests. Backoff time represents the delay before the next retry for the specified request type.
      Specified by:
      recordOutputBackoffTime in interface ConsumerMetrics
      Parameters:
      type - the type of the request, corresponding to one of the MirroredSolrRequest.getType() values.
      backoffTimeMs - the backoff time in milliseconds.
    • recordOutputFirstAttemptTime

      public void recordOutputFirstAttemptTime(MirroredSolrRequest.Type type, long firstAttemptTimeNs)
      Description copied from interface: ConsumerMetrics
      Records the latency between the time when the message was sent at source and the time of the first attempt at processing.
      Specified by:
      recordOutputFirstAttemptTime in interface ConsumerMetrics
      Parameters:
      type - the type of the request, corresponding to one of the MirroredSolrRequest.getType() values
      firstAttemptTimeNs - the latency of the first attempt in milliseconds.
    • startOutputTimeTimer

      public ConsumerMetrics.ConsumerTimer startOutputTimeTimer(String requestType)
      Description copied from interface: ConsumerMetrics
      Starts a timer to measure the duration of an output request processing by the given request type.
      Specified by:
      startOutputTimeTimer in interface ConsumerMetrics
      Parameters:
      requestType - the type of the request for which the timer is started
      Returns:
      a ConsumerMetrics.ConsumerTimer that allows to measure the elapsed time