forked from elastic/elasticsearch
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add metrics for retries by S3RetryingInputStream (elastic#105600)
This PR exposes retries in S3RetryingInputStream as metrics for easier observability. At the class API level, retries can happen when either opening an input stream and reading from an input stream. Retry reading from an input stream internally can also retry re-opening the input stream. All these retries are counted under the retries for reading since the higher API usage is a read instead of open. The list of new metrics are: * `es.repositories.s3.input_stream.retry.event.total` - Number of times a retry cycle has been triggered. * `es.repositories.s3.input_stream.retry.success.total` - Number of a times a retry cycle has been successfully completed. This should match the above metric in numbers. Otherwise it indicates there are threads stuck in infinite retries. * `es.repositories.s3.input_stream.retry.attempts.histogram` - Number of attempts to complete a retry cycle successfully. Relates: elastic#103300 (comment) Relates: ES-7666
- Loading branch information
Showing
16 changed files
with
216 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
.../repository-s3/src/main/java/org/elasticsearch/repositories/s3/S3RepositoriesMetrics.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
|
||
package org.elasticsearch.repositories.s3; | ||
|
||
import org.elasticsearch.repositories.RepositoriesMetrics; | ||
import org.elasticsearch.telemetry.metric.LongCounter; | ||
import org.elasticsearch.telemetry.metric.LongHistogram; | ||
|
||
public record S3RepositoriesMetrics( | ||
RepositoriesMetrics common, | ||
LongCounter retryStartedCounter, | ||
LongCounter retryCompletedCounter, | ||
LongHistogram retryHistogram | ||
) { | ||
|
||
public static S3RepositoriesMetrics NOOP = new S3RepositoriesMetrics(RepositoriesMetrics.NOOP); | ||
|
||
public static final String METRIC_RETRY_EVENT_TOTAL = "es.repositories.s3.input_stream.retry.event.total"; | ||
public static final String METRIC_RETRY_SUCCESS_TOTAL = "es.repositories.s3.input_stream.retry.success.total"; | ||
public static final String METRIC_RETRY_ATTEMPTS_HISTOGRAM = "es.repositories.s3.input_stream.retry.attempts.histogram"; | ||
|
||
public S3RepositoriesMetrics(RepositoriesMetrics common) { | ||
this( | ||
common, | ||
common.meterRegistry().registerLongCounter(METRIC_RETRY_EVENT_TOTAL, "s3 input stream retry event count", "unit"), | ||
common.meterRegistry().registerLongCounter(METRIC_RETRY_SUCCESS_TOTAL, "s3 input stream retry success count", "unit"), | ||
common.meterRegistry() | ||
.registerLongHistogram(METRIC_RETRY_ATTEMPTS_HISTOGRAM, "s3 input stream retry attempts histogram", "unit") | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.