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
4 changes: 4 additions & 0 deletions CHANGELOG.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ endif::[]

* fix: keep instantiated OffsetMapCodecManager so that metrics will not be recreated every commit (#859)

=== Improvements

* improvement: add metric to monitor the maximum number of queued records for the shard

== 0.5.3.3

=== Fixes
Expand Down
6 changes: 6 additions & 0 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -1129,6 +1129,12 @@ Gauge `pc.shards.size{subsystem=shardmanager}`

Number of records queued for processing across all shards

**Max Shards Size**

Gauge `pc.shards.max.size{subsystem=shardmanager}`

The number of queued records in the shards with the most queued records

==== Work Manager

**Inflight Records**
Expand Down
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());
}
}