Skip to content

[server] Add metrics of log startOffset#3229

Merged
luoyuxia merged 3 commits intoapache:mainfrom
zuston:log-start-metric
May 8, 2026
Merged

[server] Add metrics of log startOffset#3229
luoyuxia merged 3 commits intoapache:mainfrom
zuston:log-start-metric

Conversation

@zuston
Copy link
Copy Markdown
Member

@zuston zuston commented Apr 29, 2026

Purpose

Linked issue: #3228 .

When the outOfRange exception, I hope I can find the tablet log startOffset from the metric system.

Brief change log

Tests

API and Format

Documentation

Copy link
Copy Markdown
Contributor

@luoyuxia luoyuxia left a comment

Choose a reason for hiding this comment

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

@zuston Thanks for the pr. Left minor comments. PTAL

}
MetricGroup metricGroup = bucketMetricGroup.addGroup("remoteLog");
metricGroup.gauge(MetricNames.LOG_NUM_SEGMENTS, () -> numRemoteLogSegments);
metricGroup.gauge(MetricNames.LOG_START_OFFSET, () -> remoteLogStartOffset);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

also update the monitor-metrics doc

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

when no remote log, remoteLogStartOffset will be Long.MAX_VALUE, which will be werid, I think maybe we can use -1 for metric report?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

when no remote log, remoteLogStartOffset will be Long.MAX_VALUE, which will be werid, I think maybe we can use -1 for metric report?

make sense!

@zuston
Copy link
Copy Markdown
Member Author

zuston commented May 8, 2026

@zuston Thanks for the pr. Left minor comments. PTAL

updated.

@zuston zuston requested a review from luoyuxia May 8, 2026 08:15
}
MetricGroup metricGroup = bucketMetricGroup.addGroup("remoteLog");
metricGroup.gauge(MetricNames.LOG_NUM_SEGMENTS, () -> numRemoteLogSegments);
metricGroup.gauge(MetricNames.LOG_START_OFFSET, this::getRemoteLogStartOffsetForMetric);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: how about use lambda to inline it:

() -> {
   if (remoteLogStartOffset == INIT_REMOTE_LOG_START_OFFSET) {
            return -1L;
        }
        return remoteLogStartOffset;
}

@zuston zuston requested a review from luoyuxia May 8, 2026 08:27
Copy link
Copy Markdown
Contributor

@luoyuxia luoyuxia left a comment

Choose a reason for hiding this comment

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

+1

@luoyuxia luoyuxia merged commit 53732b0 into apache:main May 8, 2026
8 checks passed
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.

2 participants