-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added stats for permits and queue in repository-s3 for permit backed …
…transfers Signed-off-by: vikasvb90 <vikasvb@amazon.com>
- Loading branch information
Showing
14 changed files
with
384 additions
and
125 deletions.
There are no files selected for viewing
74 changes: 74 additions & 0 deletions
74
...pository-s3/src/main/java/org/opensearch/repositories/s3/GenericStatsMetricPublisher.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,74 @@ | ||
/* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* The OpenSearch Contributors require contributions made to | ||
* this file be licensed under the Apache-2.0 license or a | ||
* compatible open source license. | ||
*/ | ||
|
||
package org.opensearch.repositories.s3; | ||
|
||
import java.util.HashMap; | ||
import java.util.Map; | ||
import java.util.concurrent.atomic.AtomicInteger; | ||
import java.util.concurrent.atomic.AtomicLong; | ||
|
||
/** | ||
* Generic stats of repository-s3 plugin. | ||
*/ | ||
public class GenericStatsMetricPublisher { | ||
|
||
private final AtomicLong normalPriorityQSize = new AtomicLong(); | ||
private final AtomicInteger normalPriorityPermits = new AtomicInteger(); | ||
private final AtomicLong lowPriorityQSize = new AtomicLong(); | ||
private final AtomicInteger lowPriorityPermits = new AtomicInteger(); | ||
|
||
public void updateNormalPriorityQSize(long qSize) { | ||
normalPriorityQSize.addAndGet(qSize); | ||
} | ||
|
||
public void updateLowPriorityQSize(long qSize) { | ||
lowPriorityQSize.addAndGet(qSize); | ||
} | ||
|
||
public void updateNormalPermits(boolean increment) { | ||
if (increment) { | ||
normalPriorityPermits.incrementAndGet(); | ||
} else { | ||
normalPriorityPermits.decrementAndGet(); | ||
} | ||
} | ||
|
||
public void updateLowPermits(boolean increment) { | ||
if (increment) { | ||
lowPriorityPermits.incrementAndGet(); | ||
} else { | ||
lowPriorityPermits.decrementAndGet(); | ||
} | ||
} | ||
|
||
public long getNormalPriorityQSize() { | ||
return normalPriorityQSize.get(); | ||
} | ||
|
||
public int getAcquiredNormalPriorityPermits() { | ||
return normalPriorityPermits.get(); | ||
} | ||
|
||
public long getLowPriorityQSize() { | ||
return lowPriorityQSize.get(); | ||
} | ||
|
||
public int getAcquiredLowPriorityPermits() { | ||
return lowPriorityPermits.get(); | ||
} | ||
|
||
Map<String, Long> stats() { | ||
final Map<String, Long> results = new HashMap<>(); | ||
results.put("NormalPriorityQSize", normalPriorityQSize.get()); | ||
results.put("LowPriorityQSize", lowPriorityQSize.get()); | ||
results.put("AcquiredNormalPriorityPermits", (long) normalPriorityPermits.get()); | ||
results.put("AcquiredLowPriorityPermits", (long) lowPriorityPermits.get()); | ||
return results; | ||
} | ||
} |
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.