Skip to content

IGNITE-27573 Adapt jraft node metrics to ignite metric framework#7722

Open
Phillippko wants to merge 16 commits intoapache:mainfrom
gridgain:ignite-27573
Open

IGNITE-27573 Adapt jraft node metrics to ignite metric framework#7722
Phillippko wants to merge 16 commits intoapache:mainfrom
gridgain:ignite-27573

Conversation

@Phillippko
Copy link
Contributor

@Phillippko Phillippko commented Mar 6, 2026

https://issues.apache.org/jira/browse/IGNITE-27573

added metric sources:

raft.logmanager.<group_id>
raft.readonlyservice.<group_id>
raft.fsmcaller.<group_id>
raft.node.<group_id>

So every partition / system group will have it's own set of metrics

didn't touch replicator and thread metrics to keep PR a little bit simpler

@Phillippko Phillippko changed the title WIP x2 IGNITE-27573 Adapt jraft node metrics to ignite metric framework Mar 6, 2026
@Phillippko Phillippko marked this pull request as ready for review March 6, 2026 09:10
new MetricSource().name(THREAD_POOLS_METRICS_SOURCE_NAME + "striped.messaging.inbound.deploymentunits").enabled(true),
new MetricSource().name(THREAD_POOLS_METRICS_SOURCE_NAME + "striped.messaging.inbound.scalecube").enabled(true),
new MetricSource().name(THREAD_POOLS_METRICS_SOURCE_NAME + "messaging.outbound").enabled(true)
new MetricSource().name("thread.pools.striped.messaging.inbound.default").enabled(true),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be nice to sort them alphabetically, but maybe that's too much to ask


private final List<Metric> metrics;

private final HashMap<TaskType, DistributionMetric> taskDurations = new HashMap<>();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Type should be declared as Map, not HashMap. Why did you do this?
  2. Please use EnumMap for enums. A dedicated type of map is better than a universal one.

Comment on lines 121 to +125
metrics = new ArrayList<>();

metrics.add(applyTasksSize);
metrics.add(lastApplyTasksTime);
metrics.add(lastCommitTime);
metrics.add(applyTasksTime);
metrics.add(commitTime);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could be metrics = List.of(applyTasksSize, applyTasksTime, commitTime).

I wonder why you decided to write it this way, for future extensibility? Will this list become dynamic in the near future?

static class Holder implements AbstractMetricSource.Holder<Holder> {
private final AtomicLongMetric lastTruncateLogSuffixTime = new AtomicLongMetric(
private static final long[] HISTOGRAM_BUCKETS =
{10, 50, 100, 200, 500, 1000, 2000, 5000, 10000, 20000, 50000, 100000, 200000, 500000};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Up to 500 thousands? Woooow, that's too much. Are these milliseconds, what will they measure?

Some operations are better measured in microseconds, it has to be metric-dependent. Let's discuss these bounds separately

this.metricName = "fsm-" + name().toLowerCase().replaceAll("_", "-");
}
return this.metricName;
IDLE ("IdleDuration"),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are FSMCaller task types, so they have nothing in common with "...Duration". Why did you name them this way?


private final DistributionMetric handleAppendEntriesDuration = new DistributionMetric(
"HandleAppendEntriesDuration",
"Duration of handling append entries request in node impl in milliseconds",
Copy link
Contributor

@alievmirza alievmirza Mar 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these messages exposed to a user? In that case, what is node impl? Users know nothing about internal naming

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants