Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix lost prometheus metric in OrderedExecutor #4374

Merged

Conversation

TakaHiR07
Copy link
Contributor

@TakaHiR07 TakaHiR07 commented May 17, 2024

Descriptions of the changes in this PR:

Fix #4373

Motivation

As shown in the issue.

This is the first pr to fix the lost metric problem. And the other pr improve the metric in SingleThreadExecutor.

Changes

If we only fix the problem but do not change the metric , the metric is as follow, the metric become visible, though the format is not same.

企业微信截图_179bc46b-3d59-427b-957b-ec185eff3e38
企业微信截图_ac0c1ec5-6363-48e9-9378-a82d95e3af0d

@TakaHiR07 TakaHiR07 changed the title Fix metric lost problem in OrderedExecutor Improve prometheus metric in OrderedExecutor May 17, 2024
@TakaHiR07
Copy link
Contributor Author

@merlimat Could you take a look of this problem?

Copy link
Member

@hezhangjian hezhangjian left a comment

Choose a reason for hiding this comment

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

Nice catch.

I think we can change createSingleThreadExecutor return SingleThreadExecutor directly.
BTW, I prefer split this pr, one to fix problem, one to modify the metric name.

Copy link
Member

@StevenLuMT StevenLuMT left a comment

Choose a reason for hiding this comment

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

LGTM,
I think this kind of metric change require adding a testcase to cover it

@TakaHiR07
Copy link
Contributor Author

Nice catch.

I think we can change createSingleThreadExecutor return SingleThreadExecutor directly. BTW, I prefer split this pr, one to fix problem, one to modify the metric name.

ok, I would split to 2 pr. But I guess we can't change createSingleThreadExecutor return SingleThreadExecutor directly, because OrderedScheduler#createSingleThreadExecutor do not return SingleThreadExecutor

@TakaHiR07 TakaHiR07 force-pushed the fix_orderExecutor_lost_some_metric branch from 6814b3c to aa3ee80 Compare May 22, 2024 08:25
@TakaHiR07 TakaHiR07 changed the title Improve prometheus metric in OrderedExecutor fix lost prometheus metric in OrderedExecutor May 22, 2024
@nicoloboschi nicoloboschi requested a review from eolivelli May 22, 2024 09:33
@hezhangjian hezhangjian requested review from hangc0276 and zymap May 25, 2024 00:26
Copy link
Member

@hezhangjian hezhangjian left a comment

Choose a reason for hiding this comment

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

Would you mind update the description since we split the PR? I would be glad to proceed with the merge once the updates are made.

@TakaHiR07 TakaHiR07 requested a review from hezhangjian May 25, 2024 02:29
@hezhangjian hezhangjian merged commit e5300a0 into apache:master May 25, 2024
21 checks passed
@hezhangjian
Copy link
Member

Thanks for your contribution. :)

hezhangjian pushed a commit that referenced this pull request May 25, 2024
Fix [#4373](#4373)

### Motivation

As shown in the issue.

This is the first pr to fix the lost metric problem. And the other pr improve the metric in SingleThreadExecutor.

Co-authored-by: fanjianye <[email protected]>
(cherry picked from commit e5300a0)
hezhangjian pushed a commit that referenced this pull request May 25, 2024
Fix [#4373](#4373)

### Motivation

As shown in the issue.

This is the first pr to fix the lost metric problem. And the other pr improve the metric in SingleThreadExecutor.

Co-authored-by: fanjianye <[email protected]>
(cherry picked from commit e5300a0)
@@ -391,6 +391,10 @@ protected OrderedExecutor(String baseName, int numThreads, ThreadFactory threadF
ExecutorService thread = createSingleThreadExecutor(
new ThreadFactoryBuilder().setNameFormat(name + "-" + getClass().getSimpleName() + "-" + i + "-%d")
.setThreadFactory(threadFactory).build());
SingleThreadExecutor ste = null;
if (thread instanceof SingleThreadExecutor) {
Copy link
Contributor

Choose a reason for hiding this comment

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

We can registerMetrics here instead of the instanceOf check

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do you mean that remove the check if (thread instanceof SingleThreadExecutor) directly ?
But createSingleThreadExecutor() is also triggered in OrderedScheduler. In OrderedScheduler, createSingleThreadExecutor() do not return SingleThreadExecutor, so I keep the check here.

@hangc0276 hangc0276 added this to the 4.18.0 milestone May 26, 2024
Ghatage pushed a commit to sijie/bookkeeper that referenced this pull request Jul 12, 2024
Fix [apache#4373](apache#4373)

### Motivation

As shown in the issue.

This is the first pr to fix the lost metric problem. And the other pr improve the metric in SingleThreadExecutor.

Co-authored-by: fanjianye <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bookie server lost some metrics of OrderedExecutor
5 participants