Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public enum PCMetricsDef {

INCOMPLETE_OFFSETS_TOTAL("incomplete.offsets.total", "Total number of incomplete offsets", PCMetricsSubsystem.SHARD_MANAGER, GAUGE),
SHARDS_SIZE("shards.size", "Number of records queued for processing across all shards", PCMetricsSubsystem.SHARD_MANAGER, GAUGE),
SHARDS_MAX_SIZE("shards.max.size", "The number of queued records in the shards with the most queued records", PCMetricsSubsystem.SHARD_MANAGER, GAUGE),


//TODO: Not implemented yet - add to Metrics.adoc when implemented
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ public class ShardManager<K, V> {
private Optional<ShardKey> iterationResumePoint = Optional.empty();

private Gauge shardsSizeGauge;
private Gauge shardsMaxSizeGauge;
private Gauge numberOfShardsGauge;

private final PCMetrics pcMetrics;
Expand Down Expand Up @@ -302,7 +303,10 @@ private void initMetrics() {
shardsSizeGauge = pcMetrics.gaugeFromMetricDef(PCMetricsDef.SHARDS_SIZE,
this, shardManager -> shardManager.processingShards.values().stream()
.mapToInt(processingShard -> processingShard.getEntries().size()).sum());
shardsMaxSizeGauge = pcMetrics.gaugeFromMetricDef(PCMetricsDef.SHARDS_MAX_SIZE,
this, shardManager -> shardManager.processingShards.values().stream()
.mapToInt(processingShard -> processingShard.getEntries().size()).max().orElse(0));
numberOfShardsGauge = pcMetrics.gaugeFromMetricDef(PCMetricsDef.NUMBER_OF_SHARDS,
this, shardManager -> shardManager.processingShards.keySet().size());
this, shardManager -> shardManager.processingShards.size());
}
}
Loading