Skip to content

Avoid metrics persistence setup for in-memory event buffering#4877

Merged
dimas-b merged 1 commit into
apache:mainfrom
mj006648:feature/issue-4594-inmemory-metrics
Jun 30, 2026
Merged

Avoid metrics persistence setup for in-memory event buffering#4877
dimas-b merged 1 commit into
apache:mainfrom
mj006648:feature/issue-4594-inmemory-metrics

Conversation

@mj006648

Copy link
Copy Markdown
Contributor

Summary

Fixes #4594.

This avoids creating MetricsPersistence for InMemoryBufferEventListener. The listener only needs to write buffered event entities, so it now passes a no-op MetricsPersistence into PolarisCallContext instead of asking the MetaStoreManagerFactory to create one.

The focused buffer-size test now verifies that flushing events does not request metrics persistence.

Tests

Checklist

@github-project-automation github-project-automation Bot moved this to PRs In Progress in Basic Kanban Board Jun 24, 2026
@mj006648 mj006648 force-pushed the feature/issue-4594-inmemory-metrics branch from a320d4a to 35dc590 Compare June 24, 2026 06:36
@mj006648 mj006648 marked this pull request as ready for review June 24, 2026 07:05
dimas-b
dimas-b previously approved these changes Jun 24, 2026

@dimas-b dimas-b left a comment

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.

Thanks for the fix, @mj006648 ! LGTM 👍

@github-project-automation github-project-automation Bot moved this from PRs In Progress to Ready to merge in Basic Kanban Board Jun 24, 2026
nandorKollar
nandorKollar previously approved these changes Jun 25, 2026
@dimas-b

dimas-b commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Planning to merge on Jun 26

var metricsPersistence = metaStoreManagerFactory.getOrCreateMetricsPersistence(realmContext);
var callContext = new PolarisCallContext(realmContext, basePersistence, metricsPersistence);
var callContext =
new PolarisCallContext(realmContext, basePersistence, NO_OP_METRICS_PERSISTENCE);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

hmmm, I feel the right fix should be undo the metric persistence being part of the polaris call context param. But not sure if that's gonna affecting Anand's ongoing work

If we want a quick fix, wonder if the arg takes null value? I'm inclined this approach as it does not introduce the MetricsPersistence class dependency, which its class path will be changed for sure.

@dimas-b dimas-b Jun 26, 2026

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.

AFAIK, the impact on @obelix74 's work is going to be minimal (bearable).

@obelix74 : Please comment if you have a concern.

var metricsPersistence = metaStoreManagerFactory.getOrCreateMetricsPersistence(realmContext);
var callContext = new PolarisCallContext(realmContext, basePersistence, metricsPersistence);
var callContext =
new PolarisCallContext(realmContext, basePersistence, NO_OP_METRICS_PERSISTENCE);

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.

I think this is a side effect of separating metricsPersistence, which forces PolarisCallContext to carry more xxxPersistence that is not needed. I don't like that direction, but since we are here. I'd create a new PolarisCallContext constructor to avoid something like NO_OP_METRICS_PERSISTENCE. If u look at the class, we actually have that constructor. Maybe we just need to remove the depreaction annotation.

@mj006648

Copy link
Copy Markdown
Contributor Author

Thanks @flyrain and @flyingImer for the pointers.

I updated this to remove the MetricsPersistence dependency from InMemoryBufferEventListener. The listener now just passes the BasePersistence it already needs, and the fallback stays inside PolarisCallContext through the convenience constructor.

CI is green now.

@dimas-b dimas-b requested review from flyingImer and flyrain June 26, 2026 15:09
flyrain
flyrain previously approved these changes Jun 26, 2026

@flyrain flyrain left a comment

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.

+1 Thanks @mj006648 for the change.

@dimas-b

dimas-b commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

@mj006648 : sorry to cause conflicts here... Could you rebase, please?

@mj006648 mj006648 force-pushed the feature/issue-4594-inmemory-metrics branch from 98cf109 to e061203 Compare June 27, 2026 06:44
@mj006648

Copy link
Copy Markdown
Contributor Author

Rebased on main to resolve the conflict.

@flyrain

flyrain commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

Looks like the latest commit removed the changes needed, @mj006648, can you double check?

@mj006648

Copy link
Copy Markdown
Contributor Author

Thanks for checking, @flyrain.

The code path this PR was changing appears to have been updated on main by #4866, which is why the rebase conflicted. After rebasing, this PR only keeps the regression coverage that InMemoryBufferEventListener does not create MetricsPersistence.

If you prefer not to keep this PR with only the regression coverage, I can close it.

@dimas-b dimas-b left a comment

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.

The test change looks small, but it makes sense for the purpose of closing #4594, I think.

@dimas-b

dimas-b commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Merging now. If there are objections, we can revert :)

@dimas-b dimas-b merged commit 5b6983e into apache:main Jun 30, 2026
24 checks passed
@github-project-automation github-project-automation Bot moved this from Ready to merge to Done in Basic Kanban Board Jun 30, 2026
@dimas-b

dimas-b commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Thanks again for your contribution, @mj006648 !

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.

Do not instantiate MetricsPersistence for InMemoryBufferEventListener

6 participants